/* css/style.css */

/* --- Import Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&family=Inter:wght@300;400;600;700&display=swap');

/* --- Variabili CSS Globali Migliorate --- */
:root {
    --font-primary: 'Orbitron', sans-serif;
    --font-secondary: 'Inter', sans-serif;

    --primary-color: #FFC107;
    /* Oro/Ambra - Colore accent dal sito TE.S.I */
    --primary-color-dark: #e6ad00;
    /* Oro scuro per hover/active */
    --secondary-color: #1a1e21;
    /* Scuro profondo - Per header, footer, testi importanti */
    --accent-color: #FFC107;
    /* Oro - Coerente con il sito principale */
    --accent-color-dark: #e6ad00;

    --background-light: #f8f9fa;
    /* Grigio molto chiaro per sfondi di pagina o sezioni */
    --background-card: rgba(255, 255, 255, 0.65);
    /* Bianco al 30% di trasparenza */

    --text-color-dark: #333333;
    /* Testo principale scuro */
    --text-color-medium: #777777;
    /* Testo secondario, placeholder */
    --text-color-light: #ffffff;
    /* Bianco - Testo su sfondi scuri */

    --border-color-light: #e9ecef;
    /* Bordo molto leggero per separatori, input */
    --border-color-medium: #ced4da;
    /* Bordo per elementi più definiti */

    --success-color: #4caf50;
    /* Verde Material - Per successo, giorni compilati */
    --success-color-dark: #388e3c;
    --warning-color: #ff9800;
    /* Arancio Material */
    --warning-color-dark: #f57c00;
    --danger-color: #f44336;
    /* Rosso Material - Per errori, ferie */
    --danger-color-dark: #d32f2f;
    --info-color: #00bcd4;
    /* Ciano Material per info, mutua */
    --info-color-dark: #0097a7;
    --holiday-color: #9b59b6;
    /* Amethyst - Per festività */
    --holiday-color-dark: #8e44ad;

    --border-radius-sm: 2px;
    --border-radius-md: 4px;
    --border-radius-lg: 6px;

    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.2);

    /* Colori RGB per rgba() */
    --primary-color-rgb: 255, 193, 7;
    --success-color-rgb: 76, 175, 80;
}

/* --- Reset e Stili Globali --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-secondary);
    background-image: url('../images/DSC_6767-1080-bw.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-color-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.65;
    /* Aumentata per leggibilità */
    -webkit-font-smoothing: antialiased;
    /* Migliora rendering font */
    -moz-osx-font-smoothing: grayscale;
    /* RIMOSSO: Padding superiore per compensare l'header fisso */
    /* padding-top: 7rem; */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.8em;
    line-height: 1.3;
}

h1 {
    font-size: 2em;
    margin-bottom: 1em;
}

h2 {
    font-size: 1.6em;
    margin-bottom: 0.8em;
}

h3 {
    font-size: 1.35em;
    margin-bottom: 0.6em;
}

h4 {
    font-size: 1.15em;
    margin-bottom: 0.5em;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--primary-color-dark);
}

/* --- Header --- */
/* Gli stili dell'header sono stati spostati in header.css */

/* --- Main Content Area --- */
main {
    flex-grow: 1;
    padding: 2rem 1.5rem;
    max-width: 1400px;
    /* MODIFICATO: Ridotto il margine inferiore */
    margin: 25px auto 10px auto;
    width: 100%;
}

/* --- Footer --- */
footer {
    background-color: var(--secondary-color);
    color: var(--text-color-light);
    text-align: center;
    padding: 0.75rem;
    font-size: 0.85em;
    font-family: var(--font-secondary);
    margin-top: auto;
    width: 100%;
    margin: -100px 0 15px 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

/* --- Card Style per Sezioni --- */
.card {
    background-color: var(--background-card);
    padding: 25px 30px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color-light);
    border-top: 4px solid var(--primary-color);
}

.card h2,
.card h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 0.6em;
    margin-bottom: 1.2em;
}

/* --- Login Page --- */
/* Gli stili della pagina di login sono stati spostati in css/login.css */

/* --- Form Elements (Stili Generali) --- */
.form-group {
    /* MODIFICATO: Ridotto il margine inferiore */
    margin-bottom: 15px;
    /* Era 22px */
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-family: var(--font-secondary);
    font-size: 0.9em;
    color: var(--text-color-dark);
    text-align: center;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="month"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius-md);
    font-family: var(--font-secondary);
    font-size: 1em;
    color: var(--text-color-dark);
    background-color: rgba(255, 255, 255, 0.65);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="month"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3.5px rgba(var(--primary-color-rgb), 0.2);
    outline: none;
}

/* MODIFICATO: Centra il placeholder, ma mantiene il testo inserito a sinistra */
input::placeholder {
    color: var(--text-color-medium);
    opacity: 0.8;
    text-align: center;
}

input[disabled] {
    background-color: #e9ecef !important;
    cursor: not-allowed;
    opacity: 0.7;
}

small.form-text {
    font-size: 0.8em;
    color: var(--text-color-medium);
    display: block;
    margin-top: 4px;
}

/* --- Buttons --- */
button,
button[type="submit"] {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    padding: 10px 18px;
    /* Leggermente ridotto padding verticale, aumentato orizzontale */
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    font-family: var(--font-primary);
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    text-align: center;
    display: inline-block;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}

button:hover,
button[type="submit"]:hover {
    background-color: var(--primary-color-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

button:active,
button[type="submit"]:active {
    transform: translateY(0px);
    box-shadow: var(--shadow-sm);
}

.login-message {
    text-align: center;
    color: var(--secondary-color);
    font-size: 1.3em;
    margin-bottom: 0px;
    font-family: var(--font-primary);
    font-weight: 500;
}

button:disabled,
button.loading {
    background-color: var(--medium-gray) !important;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
}

button.secondary {
    background-color: var(--secondary-color);
}

button.secondary:hover {
    background-color: #2c3640;
}

button.danger {
    background-color: var(--danger-color);
}

button.danger:hover {
    background-color: var(--danger-color-dark);
}

button.accent {
    background-color: var(--accent-color);
}

button.accent:hover {
    background-color: var(--accent-color-dark);
}

.login-container button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 1.05em;
    margin-top: 10px;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-container button[type="submit"]:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* --- Messages --- */
.error-message {
    color: var(--danger-color);
    font-size: 0.9em;
    margin-top: 10px;
    text-align: left;
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    background-color: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.3);
    /* AGGIUNTO: Nasconde l'elemento di default */
    display: none;
}

.error-message.global-error {
    margin-bottom: 1.5rem;
    text-align: center;
}

.loading-message,
.info-message {
    color: var(--text-color-medium);
    font-style: italic;
    text-align: center;
    padding: 15px;
    background-color: rgba(189, 195, 199, 0.08);
    border-radius: var(--border-radius-sm);
    margin: 15px 0;
    border: 1px dashed var(--border-color-medium);
}

/* --- Dashboards Layout --- */
.employee-dashboard,
.admin-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- Calendar (Employee) --- */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-nav h3 {
    margin: 0;
    font-size: 1.5em;
    color: var(--secondary-color);
}

.calendar-nav button {
    padding: 0.6rem 1.1rem;
    font-size: 0.9em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
}

.calendar-grid div {
    padding: 10px 5px;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-sm);
    /* Angoli leggermente arrotondati */
    height: 90px;
    /* MODIFICATO: Imposta un'altezza fissa invece di minima */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    /* MODIFICATO: Dimezzato da 1.8em */
    transition: all 0.2s ease-out;
    position: relative;
    background-color: var(--background-card);
}

/* Rimuovere la seguente regola CSS: */
/* .calendar-grid div.day-name { background-color: transparent; font-weight: 600; color: var(--text-color-medium); cursor: default; border: none; min-height: auto; padding-bottom: 8px; } */
.calendar-grid div.empty-day {
    background-color: #f0f3f5;
    cursor: default;
    opacity: 0.6;
    border-color: #e4e7ea;
}

.calendar-grid div.day {
    cursor: pointer;
}

.calendar-grid div.day:hover:not(.weekend):not(.holiday):not(.selected-day) {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.calendar-grid div.day.uncompiled {
    background-color: rgba(243, 156, 18, 0.2);
    /* MODIFICATO: Arancio più tenue e trasparente */
    color: var(--text-color-dark);
    /* MODIFICATO: Testo scuro per leggibilità */
    border-color: rgba(243, 156, 18, 0.3);
    /* AGGIUNTO: Bordo tenue */
}

.calendar-grid div.day.uncompiled:hover:not(.selected-day) {
    background-color: rgba(243, 156, 18, 0.4);
    /* MODIFICATO: Arancio scuro e trasparente per hover */
    border-color: rgba(243, 156, 18, 0.6);
    /* AGGIUNTO: Bordo scuro per hover */
}

.calendar-grid div.day.compiled {
    background-color: var(--success-color);
    color: var(--text-color-light);
}

.calendar-grid div.day.compiled:hover:not(.selected-day) {
    background-color: var(--success-color-dark);
}

.calendar-grid div.day.ferie {
    background-color: var(--danger-color);
    color: var(--text-color-light);
}

.calendar-grid div.day.ferie:hover:not(.selected-day) {
    background-color: var(--danger-color-dark);
}

.calendar-grid div.day.mutua {
    background-color: var(--info-color);
    color: var(--text-color-light);
}

.calendar-grid div.day.mutua:hover:not(.selected-day) {
    background-color: var(--info-color-dark);
}

.calendar-grid div.day.compiled .day-summary,
.calendar-grid div.day.ferie .day-summary,
.calendar-grid div.day.mutua .day-summary,
.calendar-grid div.day.holiday .day-summary {
    color: var(--text-color-light);
    background-color: rgba(0, 0, 0, 0.15);
}

.calendar-grid div.day.weekend {
    background-color: #e9ecef;
    color: var(--text-color-medium);
    cursor: not-allowed !important;
    border-color: #dfe3e7;
}

.calendar-grid div.day.weekend:hover {
    background-color: #e9ecef;
    transform: none;
    box-shadow: none;
}

.calendar-grid div.day.weekend .day-summary {
    color: var(--text-color-medium);
}

.calendar-grid div.day.holiday {
    background-color: var(--holiday-color);
    color: var(--text-color-light);
    cursor: not-allowed !important;
    border-color: var(--holiday-color-dark);
}

.calendar-grid div.day.holiday:hover {
    background-color: var(--holiday-color);
    transform: none;
    box-shadow: none;
}

.calendar-grid div.day.holiday .day-summary {
    font-weight: 500;
}

.calendar-grid div.day.today {
    border: 2px solid var(--secondary-color);
    font-weight: bold;
    padding: calc(10px - 2px) calc(5px - 2px);
}

.calendar-grid div.day.today .day-number {
    color: var(--secondary-color);
}

.calendar-grid div.day.holiday.today {
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.calendar-grid div.day.holiday.today .day-number {
    color: var(--text-color-light);
}

.calendar-grid div.day.selected-day,
.calendar-grid div.day.selected-day:hover {
    background-color: var(--secondary-color) !important;
    color: var(--text-color-light) !important;
    border-color: var(--secondary-color) !important;
}

.calendar-grid div.day:not(.weekend):not(.holiday).selected-day,
.calendar-grid div.day:not(.weekend):not(.holiday).selected-day:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3) !important;
}

.calendar-grid div.day.selected-day .day-summary {
    color: var(--text-color-light) !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
}

.calendar-grid div.day.weekend.selected-day,
.calendar-grid div.day.holiday.selected-day {
    font-weight: normal !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Nuovi stili per le intestazioni dei giorni della settimana */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    /* Ridotto per mobile, potrebbe essere diverso da calendar-grid gap */
    padding: 5px 0;
    font-weight: bold;
    text-align: center;
    background-color: var(--light-gray);
    /* Un leggero sfondo per distinguerle */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
    /* Spazio prima della griglia dei giorni */
}

.calendar-weekdays div {
    padding: 8px 2px;
    /* Padding ridotto per far stare il testo */
    font-size: 0.75em;
    /* Dimensione font ridotta per mobile */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stili Mobile per il Calendario */
@media (max-width: 768px) {
    .calendar-section {
        padding: 8px;
        /* Riduci ulteriormente il padding della sezione */
    }

    .calendar-nav h3 {
        font-size: 1em;
        /* Riduci ulteriormente dimensione titolo mese/anno */
        margin: 0 5px;
        /* Aggiungi un po' di margine laterale se i bottoni sono troppo vicini */
    }

    .calendar-nav button {
        padding: 5px 8px;
        /* Riduci ulteriormente padding bottoni navigazione */
        font-size: 0.8em;
        /* Riduci font bottoni */
    }

    .calendar-weekdays {
        display: grid;
        /* Assicurati che sia grid */
        grid-template-columns: repeat(7, 1fr) !important;
        /* Forza 7 colonne */
        gap: 1px;
        padding: 2px 0;
        /* Padding verticale ridotto */
        margin-bottom: 2px;
        /* Margine inferiore ridotto */
    }

    .calendar-weekdays div {
        font-size: 0.65em;
        /* MODIFICATO: Era 0.6em. Ora corrisponde a .calendar-grid > div */
        padding: 2px 1px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-height: 20px;
        /* MODIFICATO: Imposta altezza fissa a 20px */
        /* min-height: auto; /* Rimuovi min-height se usi height */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-grid {
        display: grid;
        /* Assicurati che sia grid */
        grid-template-columns: repeat(7, 1fr) !important;
        /* Forza 7 colonne */
        gap: 1px;
        min-height: auto;
    }

    /* Stile generale per tutte le celle dirette della griglia (inclusi .empty-day) */
    .calendar-grid>div {
        /* Selettore più specifico per le celle dirette */
        padding: 2px 1px;
        /* MODIFICATO: Ridotto l'altezza del 30% per mobile (da 60px a 10px) */
        height: 20px;
        /* Questa regola verrà sovrascritta da una più specifica in employee.css per mobile */
        font-size: 1.3em;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        position: relative;
        overflow: hidden;
        /* Assicura che il contenuto non fuoriesca */
    }

    .calendar-grid div .day-number {
        font-size: 0.85em;
        /* Mantenuto relativo */
        margin-bottom: 1px;
        padding: 1px;
        font-weight: 500;
    }

    .calendar-grid div .day-summary {
        font-size: 0.75em;
        /* Mantenuto relativo */
        padding: 0;
        line-height: 1.1;
        max-height: 2.2em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        width: 100%;
        text-align: center;
        word-break: break-word;
    }

    .calendar-grid div.day.today {
        border-width: 1px;
        padding: 1px 0px;
        /* Padding ancora più ridotto per compensare il bordo */
        /* Il font-weight bold è già nello stile base di .today, non serve ripeterlo qui
           a meno che non si voglia cambiarlo specificamente per mobile */
    }

    .calendar-grid div.day.holiday.today {
        border-width: 1px;
        padding: 1px 0px;
        /* Consistente */
    }

    /* Rimuovi trasformazioni e ombre che potrebbero influire sul layout su mobile */
    .calendar-grid div.day:hover:not(.weekend):not(.holiday):not(.selected-day) {
        transform: none;
        box-shadow: none;
        /* Puoi mantenere un leggero background-color per l'hover se desiderato */
        /* background-color: rgba(var(--primary-color-rgb), 0.05); */
    }

    .calendar-grid div.day.selected-day,
    .calendar-grid div.day.selected-day:hover {
        transform: none !important;
        box-shadow: none !important;
        /* Il colore di sfondo e testo per selected-day è già definito,
           non dovrebbe essere necessario ripeterlo qui a meno di override specifici */
    }
}

.calendar-grid div .day-number {
    font-size: 1.3em;
    font-weight: 500;
}

.calendar-grid div .day-summary {
    font-size: 0.75em;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 2px 5px;
    border-radius: var(--border-radius-sm);
    margin-top: auto;
    /* Spinge in basso */
    max-width: 95%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Daily Form (Employee) */
.daily-form-section h3 {
    margin-bottom: 1.5rem;
}

.daily-form-section h3 #selectedDateDisplay {
    color: #000;
    font-size: 1.6em;
}

#commesseContainer .commessa-entry {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

#commesseContainer input.commessa-nome {
    flex-grow: 1;
}

#commesseContainer input.commessa-ore {
    width: 85px;
    flex-grow: 0;
    text-align: center;
}

#commesseContainer .remove-commessa {
    padding: 6px 9px;
    font-size: 0.8em;
}

.options-group {
    margin: 20px 0;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0;
    border-top: 1px solid var(--border-color-light);
    border-bottom: 1px solid var(--border-color-light);
}

.options-group .permesso-group {
    gap: 8px;
}

.options-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95em;
    font-family: var(--font-primary);
}

.options-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* --- GLI STILI SEGUENTI SONO STATI SPOSTATI IN css/admin.css --- */
/*
.monthly-summary-controls .summary-header {  margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.monthly-summary-controls .summary-header h3 { color: var(--primary-color); font-weight: 500; font-size: 1.2em; }
.month-navigation { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.month-navigation input[type="month"] { padding: 8px 10px; border-radius: var(--border-radius-sm); border: 1px solid var(--border-color-medium); font-size: 0.9em; max-width: 180px; display: inline-block; }
.month-navigation button { padding: 8px 15px; font-size: 0.9em; display: inline-block; }

.employee-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
*/
.employee-card {
    background-color: var(--background-card);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    padding: 0;
    display: flex;
    flex-direction: column;
    border-top: 6px solid var(--primary-color);
    border-top-color: var(--primary-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.employee-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Rimuove trasparenza specificamente per le card dipendenti nella dashboard admin */
.admin-page .employee-card {
    background-color: rgba(255, 255, 255, 0.65);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Rimosso: regola colori card dipendenti */

.employee-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color-dark);
    padding: 10px 15px;
    background-color: var(--primary-color);
}

.employee-card-header h4 {
    margin: 0;
    font-size: 1.15em;
    font-weight: 500;
    color: var(--text-color-dark);
}

.employee-card-header .details-link {
    color: var(--text-color-dark);
    opacity: 0.8;
    font-size: 1.2em;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.employee-card-header .details-link:hover {
    opacity: 1;
    transform: translateX(2px);
}

.employee-card-content {
    padding: 15px;
}

.employee-card-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.employee-card-summary .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9em;
    border-bottom: 1px solid var(--border-color-light);
}

.employee-card-summary .summary-row:last-child {
    border-bottom: none;
}

.employee-card-summary .summary-row span:first-child {
    color: #000000;
    font-weight: 500;
    /* Leggermente più grassetto per maggiore leggibilità */
}

.employee-card-summary .summary-row span:last-child {
    font-weight: 500;
    color: var(--text-color-dark);
    background-color: rgba(var(--primary-color-rgb), 0.08);
    padding: 2px 7px;
    border-radius: var(--border-radius-sm);
}

.employee-card-summary .summary-row.total-hours-row {
    background-color: rgba(var(--success-color-rgb), 0.08);
    margin-top: 5px;
    padding: 8px 10px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    border-bottom: none;
}

.employee-card-summary .summary-row.total-hours-row span:last-child {
    color: var(--success-color-dark);
    background-color: transparent;
    font-size: 1.05em;
}

.employee-card-completion {
    margin-bottom: 12px;
}

.employee-card-completion p {
    font-size: 0.8em;
    color: #000000;
    margin-bottom: 4px;
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    background-color: var(--border-color-light);
    border-radius: var(--border-radius-sm);
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success-color);
    border-radius: var(--border-radius-sm);
    transition: width 0.5s ease-in-out;
}

.employee-card-commesse {
    margin-top: 12px;
    border-top: 1px solid var(--border-color-light);
    padding-top: 12px;
}

.employee-card-commesse h5 {
    font-size: 1em;
    /* Dimensione leggermente ridotta per il titolo della sezione commesse */
    color: var(--secondary-color);
    margin-bottom: 0.8em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border-color-light);
}

.employee-card-commesse .commessa-item {
    display: flex;
    justify-content: space-between;
    /* Allinea nome a sx e ore a dx */
    align-items: center;
    padding: 6px 10px;
    /* Padding per dare l'effetto riquadro */
    font-size: 0.9em;
    /* border-bottom: 1px dashed var(--border-color-light); Rimosso per il nuovo stile */
    background-color: rgba(var(--primary-color-rgb), 0.05);
    /* Sfondo leggero simile a total-hours-row ma con colore primario */
    border-radius: var(--border-radius-sm);
    /* Angoli arrotondati */
    margin-bottom: 6px;
    /* Spazio tra i riquadri delle commesse */
}

.employee-card-commesse .commessa-item:last-child {
    /* border-bottom: none; Rimosso */
    margin-bottom: 0;
    /* Nessun margine inferiore per l'ultimo elemento */
}

.employee-card-commessa {
    flex-grow: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color-dark);
    /* Assicura un buon contrasto */
}

.employee-card-commessa .commessa-hours {
    font-weight: 500;
    color: #000000;
    flex-shrink: 0;
    background-color: transparent;
    /* Assicura che non ci sia uno sfondo aggiuntivo qui */
    padding: 2px 5px;
    /* Leggero padding per allineamento visivo se necessario */
    border-radius: var(--border-radius-sm);
}

.employee-card-commessa .no-commesse {
    font-style: italic;
    color: #000000;
    font-size: 0.9em;
    padding: 0.5em 0;
    font-weight: 500;
}


/* --- Summary Table (Old UI) --- */
.summary-card table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

.summary-card th,
.summary-card td {
    border: 1px solid var(--border-color-medium);
    padding: 10px 12px;
    text-align: left;
}

.summary-card th {
    background-color: #f0f3f5;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--secondary-color);
}

.summary-card tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.summary-card tbody tr:hover {
    background-color: #e9ecef;
}

.summary-card .total-row td {
    font-weight: bold;
    background-color: #e6f4ea;
    color: var(--success-color-dark);
}

/* Gestione Dipendenti CRUD Admin */
.manage-employees-card .add-employee-button {
    margin-bottom: 20px;
    display: inline-block;
}

#employeeListTableContainerCRUD table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

#employeeListTableContainerCRUD th,
#employeeListTableContainerCRUD td {
    border: 1px solid var(--border-color-medium);
    padding: 10px 12px;
    text-align: left;
}

#employeeListTableContainerCRUD th {
    background-color: #f0f3f5;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--secondary-color);
}

#employeeListTableContainerCRUD tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#employeeListTableContainerCRUD tbody tr:hover {
    background-color: #e9ecef;
}

#employeeListTableContainerCRUD .actions-cell button {
    margin-right: 8px;
    padding: 6px 10px;
    font-size: 0.85em;
}

#employeeListTableContainerCRUD .actions-cell button:last-child {
    margin-right: 0;
}

/* --- Stili per i Modali --- */
.modal {
    display: none;
    /* Nasconde il modale per impostazione predefinita */
    position: fixed;
    z-index: 1050;
    /* Assicura che sia sopra gli altri contenuti, incluso l'header sticky */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Sfondo semi-trasparente più scuro */
    animation: fadeInModal 0.3s ease-out;
}

.modal.is-open {
    display: flex;
    /* Usa flex per centrare il contenuto */
    align-items: center;
    justify-content: center;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--background-card);
    padding: 25px 30px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--primary-color);
    width: 90%;
    max-width: 550px;
    position: relative;
    animation: slideInModal 0.3s ease-out forwards;
    margin: 20px;
}

@keyframes slideInModal {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    /* Più spazio sotto il titolo del modale */
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color-light);
}

.close-modal-button {
    color: var(--text-color-medium);
    position: absolute;
    top: 15px;
    /* Posizionamento più preciso */
    right: 20px;
    font-size: 2rem;
    /* Più grande per facilitare il click */
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal-button:hover,
.close-modal-button:focus {
    color: var(--text-color-dark);
    text-decoration: none;
}

/* --- Toast Notifications --- */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--secondary-color);
    color: var(--text-color-light);
    padding: 15px 25px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    /* Sopra tutto */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    font-family: var(--font-primary);
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.success {
    background-color: var(--success-color);
}

.toast-notification.error {
    background-color: var(--danger-color);
}

.toast-notification.warning {
    background-color: var(--warning-color);
    color: var(--text-color-dark);
}

.toast-notification.info {
    background-color: var(--info-color);
}

.toast-notification::before {
    /* Icona base (può essere sovrascritta) */
    content: "ℹ️";
    /* Icona di default per info */
    font-size: 1.2em;
}

.toast-notification.success::before {
    content: "✅";
}

.toast-notification.error::before {
    content: "❌";
}

.toast-notification.warning::before {
    content: "⚠️";
}

/* Responsive Design */
@media (max-width: 768px) {

    /* header { flex-direction: column; gap: 10px; padding: 1rem; } */
    /* Spostato in header.css */
    /* header h1 { font-size: 1.3em; text-align: center; } */
    /* Spostato in header.css */
    main {
        padding: 1.5rem 1rem;
    }

    .card {
        padding: 20px;
    }

    .login-container {
        margin: 5vh auto;
        padding: 30px;
        width: 90%;
    }

    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 4px;
    }

    .calendar-grid div {
        min-height: 70px;
        font-size: 0.8em;
    }

    .calendar-grid div .day-number {
        font-size: 1.1em;
    }

    .calendar-grid div .day-summary {
        font-size: 0.7em;
    }

    .options-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .monthly-summary-controls .summary-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .month-navigation {
        justify-content: center;
    }

    .employee-cards-grid {
        grid-template-columns: 1fr;
    }

    /* Una card per riga su mobile */
    #commesseContainer .commessa-entry {
        flex-direction: column;
        align-items: stretch;
    }

    #commesseContainer input.commessa-ore {
        width: 100%;
    }

    .admin-dashboard .filter-section-card .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-dashboard .filter-section-card .filter-section button {
        align-self: stretch;
    }

    /* La parentesi graffa superflua che era qui è stata rimossa */
    .toast-notification {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 20px;
        font-size: 0.9em;
    }
}

/* AGGIUNTO: Riduci la dimensione del logo del 20% sui dispositivi mobile */
/* #logo-img { */
/* Spostato in header.css */
/* max-height: 128px; */
/* 160px * 0.80 = 128px */
/* } */

/* AGGIUNTO: Riduci il margine superiore del footer sui dispositivi mobile */
footer {
    margin-top: 0;
    /* Rimuove lo spazio superiore */
    margin-bottom: 10px;
    /* Riduci leggermente il margine inferiore */
}

/* AGGIUNTO: Riduci i margini per gli elementi della pagina di login in mobile */
/* header { */
/* Spostato in header.css */
/* margin: 5px 0 0px 0; */
/* Riduci margine inferiore dell'header */
/* padding: 0.8rem 1rem; */
/* Riduci padding dell'header */
/* } */
.login-container {
    margin: 2vh auto 0vh auto;
    /* Riduci margine superiore e inferiore del container */
    padding: 20px;
    /* Riduci padding interno del container */
}

.login-container h2 {
    margin-bottom: 15px;
    /* Riduci margine inferiore del titolo */
    font-size: 1.6em;
    /* Riduci dimensione font titolo */
}

.form-group {
    margin-bottom: 10px;
    /* Riduci margine inferiore dei gruppi form */
}

.form-group label {
    margin-bottom: 5px;
    /* Riduci margine inferiore delle label */
    font-size: 0.8em;
    /* Riduci dimensione font label */
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="month"],
input[type="date"],
select {
    padding: 8px 10px;
    /* Riduci padding degli input */
    font-size: 0.9em;
    /* Riduci dimensione font input */
}

.login-container button[type="submit"] {
    margin-top: 8px;
    /* Riduci margine superiore del bottone submit */
    padding: 10px;
    /* Riduci padding del bottone submit */
    font-size: 0.95em;
    /* Riduci dimensione font bottone submit */
}

.login-message {
    font-size: 1.1em;
    /* Riduci dimensione font messaggio */
    margin-bottom: 0px;
    /* Assicurati che non ci sia margine inferiore */
}

#dailyFormSection {
    background-color: var(--background-card);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 20px;
}

/* AGGIUNTO: Centra il titolo "Dettaglio del giorno:" */
#dailyFormSection h4 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 5px;
    /* Spazio tra titolo e data */
}

/* AGGIUNTO: Centra la data sotto il titolo */
#selectedDateDisplay {
    display: block;
    /* Assicura che prenda tutta la larghezza disponibile per centrare */
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color-dark);
    margin-bottom: 15px;
    /* Spazio tra data e form */
}

.commessa-entry {
    /* Questa definizione di .commessa-entry è meno completa di quella già inclusa sopra, quindi la sua rimozione è corretta */
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.commessa-entry input[type="text"] {
    flex-grow: 2;
    /* Permette al campo nome di espandersi */
}

.commessa-entry input[type="number"] {
    flex-grow: 1;
    /* Permette al campo ore di espandersi */
    max-width: 80px;
    /* Limita la larghezza del campo ore */
}

/* AGGIUNTO: Stile per il pulsante "Aggiungi Commessa" */
#addCommessa {
    display: block;
    /* Rende l'elemento un blocco per poterlo centrare con margin: auto */
    margin: 10px auto;
    /* Centra orizzontalmente e aggiunge margine */
    background-color: var(--danger-color);
    /* Colore rosso */
    color: var(--text-color-light);
    /* Testo bianco */
    border-color: var(--danger-color-dark);
    /* Bordo leggermente più scuro */
    transition: background-color 0.2s ease;
}

#addCommessa:hover {
    background-color: var(--danger-color-dark);
    /* Colore rosso scuro al passaggio del mouse */
}

button.remove-commessa {
    background-color: var(--danger-color);
    color: var(--text-color-light);
    border-color: var(--danger-color-dark);
    padding: 5px 10px;
    font-size: 0.8em;
    transition: background-color 0.2s ease;
}

button.remove-commessa:hover {
    background-color: var(--danger-color-dark);
}

.form-actions {
    margin-top: 20px;
    text-align: right;
    /* Allinea i pulsanti a destra */
}

.form-actions button {
    margin-left: 10px;
    /* Spazio tra i pulsanti */
}

/* Stili per le checkbox esclusive */
.exclusive-checkboxes {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    /* Permette di andare a capo su schermi piccoli */
}

.exclusive-checkboxes label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    /* Rimuove il grassetto predefinito delle label */
    color: var(--text-color-dark);
}

.exclusive-checkboxes input[type="checkbox"] {
    margin-right: 5px;
}

#permessoHoursContainer {
    display: flex;
    /* Usa flexbox per allineare input e label */
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    /* Spazio sopra il campo ore permesso */
    margin-bottom: 15px;
    /* Spazio sotto il campo ore permesso */
    padding: 10px;
    background-color: var(--light-gray);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
}

#permessoHoursContainer label {
    margin: 0;
    /* Rimuove margini extra dalla label */
    font-weight: bold;
}

#permessoHoursInput {
    flex-grow: 1;
    /* Permette all'input di riempire lo spazio rimanente */
    max-width: 80px;
    /* Limita la larghezza */
    padding: 8px;
    /* Aggiungi padding per coerenza */
}

/* Responsive adjustments for form */
@media (max-width: 576px) {
    .commessa-entry {
        flex-direction: column;
        /* Impila gli input su schermi molto piccoli */
        gap: 5px;
    }

    .commessa-entry input[type="text"],
    .commessa-entry input[type="number"] {
        width: 100%;
        /* Fai in modo che gli input prendano tutta la larghezza */
        max-width: none;
        /* Rimuovi il max-width */
    }

    button.remove-commessa {
        width: 100%;
        /* Fai in modo che il pulsante prenda tutta la larghezza */
    }

    .form-actions {
        text-align: center;
        /* Centra i pulsanti su schermi piccoli */
    }

    .form-actions button {
        margin: 5px auto;
        /* Centra i pulsanti e aggiunge spazio verticale */
        display: block;
        /* Rende i pulsanti blocchi per centrarli */
    }

    .exclusive-checkboxes {
        flex-direction: column;
        /* Impila le checkbox su schermi piccoli */
        gap: 10px;
    }

    #permessoHoursContainer {
        flex-direction: column;
        /* Impila label e input ore permesso */
        align-items: flex-start;
        /* Allinea a sinistra */
    }

    #permessoHoursInput {
        width: 100%;
        max-width: none;
    }
}

/* AGGIUNTO: Centra il titolo "Dettaglio Giorno" */
.daily-form-section h3 {
    text-align: center;
}

/* Stili per le singole voci commessa */
.commessa-entry {
    display: flex;
    /* Usa flexbox per allineare gli elementi sulla stessa riga */
    align-items: center;
    /* Allinea verticalmente al centro */
    gap: 10px;
    /* Spazio tra gli elementi */
    margin-bottom: 15px;
    /* Spazio tra le righe delle commesse */
    padding: 10px;
    /* Padding interno */
    border: 1px solid var(--border-color-light);
    /* Bordo leggero */
    border-radius: var(--border-radius-sm);
    /* Angoli arrotondati */
    background-color: rgba(255, 255, 255, 0.65);
    /* Sfondo semi-trasparente */
    box-shadow: var(--shadow-sm);
    /* Ombra leggera */
}

.commessa-entry input[type="text"].commessa-nome {
    flex-grow: 1;
    /* Permette al nome commessa di occupare lo spazio disponibile */
    /* AGGIUNTO: Allinea il testo inserito e il placeholder a sinistra */
    text-align: left;
}

.commessa-entry input[type="number"].commessa-ore {
    width: 80px;
    /* Larghezza fissa per l'input delle ore */
    flex-shrink: 0;
    /* Impedisce all'input delle ore di rimpicciolirsi */
    /* AGGIUNTO: Allinea il testo e il placeholder a sinistra */
    text-align: left;
}

.commessa-entry input[type="number"].commessa-ore::placeholder {
    /* MODIFICATO: Centra il testo del placeholder */
    text-align: center;
}

.commessa-entry input[type="number"].commessa-ore::placeholder {
    /* MODIFICATO: Centra il testo del placeholder */
    text-align: center;
}

/* AGGIUNTO: Stili per l'icona Rimuovi Commessa */
.remove-commessa {
    cursor: pointer;
    /* Indica che è cliccabile */
    font-size: 1.2em;
    /* Rende l'icona leggermente più grande */
    padding: 5px;
    /* Aggiunge spazio intorno all'icona per un'area cliccabile più ampia */
    /* margin-left: 10px; */
    /* Rimosso, gestito dal gap del flexbox */
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
    /* Aggiunge transizioni fluide */
    /* MODIFICATO: Imposta border-radius al 50% per rendere l'elemento tondo */
    border-radius: 50%;
    display: inline-flex;
    /* Assicura che padding e margin funzionino correttamente */
    align-items: center;
    /* Centra verticalmente l'icona se il contenitore ha altezza */
    justify-content: center;
    /* Centra orizzontalmente l'icona */
    flex-shrink: 0;
    /* Impedisce all'icona di rimpicciolirsi */
    /* AGGIUNTO: Stili per farlo sembrare un tasto rosso */
    background-color: var(--danger-color);
    /* Sfondo rosso */
    color: var(--text-color-light);
    /* Mantieni l'icona bianca */
    /* AGGIUNTO: Forza l'elemento ad essere quadrato per garantire la circolarità */
    width: 30px;
    /* Imposta larghezza fissa */
    height: 30px;
    /* Imposta altezza fissa uguale alla larghezza */
}

.remove-commessa:hover {
    /* MODIFICATO: Usa il colore scuro per l'hover */
    background-color: var(--danger-color-dark);
    /* Sfondo rosso scuro al passaggio del mouse */
    color: var(--text-color-light);
    /* Mantieni l'icona bianca */
    transform: scale(1.1);
    /* Piccolo ingrandimento al passaggio del mouse */
    box-shadow: var(--shadow-sm);
    /* Aggiungi una leggera ombra */
}

.remove-commessa:active {
    transform: scale(0.95);
    /* Piccolo rimpicciolimento al click */
    /* MODIFICATO: Usa un colore ancora più scuro o leggermente diverso per l'active */
    background-color: #a93226;
    /* Un rosso ancora più scuro */
    box-shadow: var(--shadow-sm);
    /* Mantieni l'ombra */
}

.site-footer {
    text-align: center;
    padding: 15px 10px;
    margin-top: 30px;
    font-size: 0.85rem;
    color: var(--text-color-medium, #555);
    border-top: 1px solid var(--border-color, #ddd);
}