/* RESET E REGISTRI GLOBALI */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px; /* Dimensione ideale per gestionali densi */
    color: #2d3748;
    background-color: lightslategray;
    line-height: 1.5;
}

/* TIPOGRAFIA */
h1, h2, h3, h4 {
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

/* COMPONENTI GRAFICI COMUNI (Utility Classes) */
.su-card {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* PULSANTI */
.su-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.1s ease-in-out;
}

.su-btn-primary {
    background-color: #005a9e; /* Blu Enterprise */
    color: #fff;
}

    .su-btn-primary:hover {
        background-color: #004578;
    }

.su-btn-success {
    background-color: #107c41; /* Verde Excel */
    color: #fff;
}

    .su-btn-success:hover {
        background-color: #0b5930;
    }

/* REGOLE DI SISTEMA PER LA BARRA DEGLI ERRORI DI BLAZOR */
#blazor-error-ui {
    background: #fff3cd;
    color: #664d03;
    bottom: 0;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
    display: none; /* Questa riga fondamentale nasconde la barra di base */
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid #ffecb5;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* ==========================================================================
   TEMA CHIARO STANDARD PER PAGINE
   ========================================================================== */
.esu-page-light {
    width: 100%;
    text-align: left;
    background-color: #fff;
    color: #1a1a1a;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.esu-header-title {
    color: #005a9e;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.esu-header-subtitle {
    color: #666;
    font-size: 13px;
    margin: 4px 0 0 0;
}

/* PULSANTI STANDARD */
.esu-btn-light-cancel {
    background-color: #f3f3f3;
    color: #222;
    border: none;
    padding: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

    .esu-btn-light-cancel:hover {
        background-color: #ddd;
    }

.esu-btn-light-save {
    background-color: #107c41;
    color: white;
    border: none;
    width: 7rem;
    padding: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

    .esu-btn-light-save:hover {
        background-color: #0b592e;
    }

.esu-btn-light-add {
    background-color: #adf;
    color: #222;
    border: none;
    padding: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

    .esu-btn-light-add:hover {
        background-color: #9ce;
    }

.esu-btn-light-excel {
    background-color: #060;
    color: white;
    border: none;
    padding: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

    .esu-btn-light-excel:hover {
        background-color: #040;
    }

.esu-btn-light-action {
    background-color: #b44;
    color: white;
    border: none;
    padding: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

    .esu-btn-light-action:hover {
        background-color: #933;
    }

/* TABELLE HANSONTABLE */
.esu-hot-excel-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 13px;
}

    .esu-hot-excel-container .rowHeader {
        font-weight: 300 !important;
    }

    .esu-hot-excel-container .handsontable th {
        background-color: #ddd;
        color: #226 !important;
        font-weight: 600;
    }

    /* Regole condivise per Intestazioni e Celle */
    .esu-hot-excel-container .handsontable th,
    .esu-hot-excel-container .handsontable td {
        vertical-align: middle !important;
    }

    /* Fallback di base per le celle (se da C# non specifichi il Wrap) */
    .esu-hot-excel-container .handsontable td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
    }


/* HANDSONTABLE */
.handsontable th:first-child:empty,
.handsontable thead tr:first-child th:first-child {
    cursor: pointer !important;
}

/* Colore di sfondo soft blu per l'intera riga selezionata */
.handsontable tbody tr td.riga-selezionata-evidenziata {
    background-color: rgba(224, 237, 255, 0.4) !important; /* Blu trasparente molto delicato */
}

/* Opzionale: Colore di sfondo per l'intestazione di riga (il numero a sinistra) per continuitą visiva */
.handsontable tbody tr th.riga-selezionata-evidenziata {
    background-color: #d0e1fd !important;
    font-weight: bold;
}

/* Effetto Hover: Colore verdino estremamente soft per la riga sotto il puntatore del mouse */
.handsontable tbody tr:hover td {
    background-color: rgba(230, 247, 235, 0.4) !important; /* Verdino chiaro e trasparente */
}

/* Opzionale: Evidenzia anche il numero di riga a sinistra al passaggio del mouse */
.handsontable tbody tr:hover th {
    background-color: #d8f3e1 !important;
}

/* La riga SELEZIONATA (blu) rimane sopraffatta dal verdino al passaggio del mouse */
.handsontable tbody tr:hover td.riga-selezionata-evidenziata {
    background-color: rgba(215, 242, 240, 0.5) !important; /* Un mix verdino leggermente pił visibile sulle righe blu */
}


/* Cella non valida */
.handsontable tbody tr td.htInvalid {
    background-color: #ff3333 !important; /* Mantiene il rosso acceso originario o il tuo codice colore d'errore */
    color: #fff !important; /* Opzionale: mantiene il testo bianco o scuro leggibile */
}

    /* Impedisce al colore della riga selezionata di sovrascrivere la cella non valida */
    .handsontable tbody tr td.htInvalid.riga-selezionata-evidenziata {
        background-color: #ff3333 !important; /* Mantiene il rosso acceso originario o il tuo codice colore d'errore */
        color: #fff !important; /* Opzionale: mantiene il testo bianco o scuro leggibile */
    }

/* Impedisce all'effetto Hover di riga di sovrascrivere la cella non valida */
.handsontable tbody tr:hover td.htInvalid {
    background-color: #ff3333 !important; /* Un rosso leggermente pił scuro/evidente al passaggio del mouse */
    color: #fff !important;
}

    /* Gestione del caso specifico: riga selezionata + effetto hover sopra la cella non valida */
    .handsontable tbody tr:hover td.htInvalid.riga-selezionata-evidenziata {
        background-color: #ff3333 !important;
    }

/* casella di editing */
.handsontableInput,
textarea.handsontableInput {
    background-color: #fff9db !important;
    color: #333333 !important;
    font-weight: 500 !important;
}
/* Elenco DropDown */
.handsontable.listbox td {
    background: #fff9db !important;
    color: #333 !important;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.6) !important;
}

    .handsontable.listbox td.current {
        background: #f5e79e !important;
        color: #000 !important;
        font-weight: 500 !important;
    }
