/* ==========================================================================
   GOOGLE FONTS IMPORT & GLOBAL MATERIAL DESIGN SETUP
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

html {
    font-size: 16px; /* Base standard Material Design per una lettura ottimale su mobile */
}

/* ==========================================================================
   VIEW STYLES & DRAWER MENU
   ========================================================================== */
:root {
    --color-primary: #2e7d32;
    --color-primary-dark: #1b5e20;
    --color-surface: #ffffff;
    --color-background: #f5f5f5;
    --color-on-surface: #1f1f1f;
    --shadow-md-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --radius-card: 1rem;
    --radius-badge: 9999px;
}

body {
    background-color: var(--color-background);
    color: var(--color-on-surface);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem; /* 16px effettivi */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-header {
    background-color: var(--color-primary);
    box-shadow: var(--shadow-md-2);
}

.card-material {
    background-color: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md-1);
}

/* Side Drawer Component */
.drawer-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: var(--color-surface);
    z-index: 60;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease-in-out;
}

.drawer-menu.open {
    transform: translateX(280px);
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* Sincronizzato con la classe .open gestita via JS */
.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Intestazione della tabella sticky posizionata appena sotto il blocco utenza */
#view-calendario thead th {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Rimuoviamo il padding errato dal contenitore e gestiamo lo scroll con precisione sulla riga */
#view-calendario {
    scroll-padding-top: 0;
}

/* Altezza esatta del blocco testata + intestazione tabella per centrare la riga al millimetro */
#tbody-calendario tr {
    scroll-margin-top: 140px; 
}

/* ==========================================================================
   MOBILE TYPOGRAPHY & PROPORTIONAL SCALING (Material Design Optimization)
   ========================================================================== */
/* Solleviamo in blocco tutte le classi di Tailwind per garantire una leggibilità nativa superiore */
.text-xs {
    font-size: 0.875rem !important; /* Portato a 14px (ex 12px) */
    line-height: 1.25rem;
}

.text-sm, small {
    font-size: 1rem !important; /* Portato a 16px (ex 14px) */
    line-height: 1.5rem;
}

.text-base {
    font-size: 1.125rem !important; /* Portato a 18px per corpi di testo principali */
    line-height: 1.6rem;
}

/* Ottimizzazione dei campi di input e selezione per favorire il touch su mobile */
select, input, button {
    font-size: 1rem !important;
}

/* ==========================================================================
   BADGE SYSTEM - BILANCIATO (Leggermente più grandi ma protetti dal capo riga)
   ========================================================================== */
.badge-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem; /* Dimensione bilanciata (12px / ex text-xs) */
    font-weight: 700;
    padding: 0.3rem 0.75rem; /* Padding intermedio per un aspetto più pieno */
    border-radius: var(--radius-badge);
    margin-right: 0.25rem;
    margin-top: 0.125rem;
    margin-bottom: 0.125rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: 0.025em;
    white-space: nowrap; /* Impedisce categoricamente al testo di andare a capo */
}

/* Organico -> Marrone terra */
.badge-organico { 
    background-color: #854d0e; 
    color: #ffffff; 
}

/* Vetro -> Verde smeraldo */
.badge-vetro { 
    background-color: #059669; 
    color: #ffffff; 
}

/* Scarti Vegetali -> Verde prato brillante e scritta bianca */
.badge-vegetali { 
    background-color: #22c55e; 
    color: #ffffff; 
}

/* Indifferenziato -> Sfondo nero, scritta bianca */
.badge-indifferenziato { 
    background-color: #000000; 
    color: #ffffff; 
}

/* Carta e Cartone -> Sfondo bianco, scritta nera */
.badge-carta { 
    background-color: #ffffff; 
    color: #000000; 
    border: 1px solid #d1d5db; 
}

.badge-cartone { 
    background-color: #ffffff; 
    color: #000000; 
    border: 1px solid #d1d5db; 
}

/* Plastica e Metallo -> Sfondo rosa scuro e scritta bianca */
.badge-plastica { 
    background-color: #db2777; 
    color: #ffffff; 
}
/* Se l'app è aperta in modalità installata (standalone), nasconde permanentemente tutti i banner di installazione */
@media (display-mode: standalone) {
    #pwa-install-banner,
    #container-installa-app {
        display: none !important;
    }
}