/* RESET E REGISTRI GLOBALI */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@keyframes Spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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;
    }

.su-btn-scuro {
    background-color: #255; /* Verde Excel */
    color: #fff;
}

    .su-btn-scuro:hover {
        background-color: #244;
    }


/* 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 STANDARD PER PAGINE
   ========================================================================== */
.esu-page-light {
    width: 100%;
    text-align: left;
    color: #1a1a1a;
    padding: 1rem;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.esu-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 0.4rem;
}

.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 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    vertical-align: top;
}

.esu-btn-light-cancel {
    background-color: #f3f3f3;
    color: #222;
}

    .esu-btn-light-cancel:hover {
        background-color: #ddd;
    }

.esu-btn-light-save {
    background-color: #107c41;
    color: white;
}

    .esu-btn-light-save:hover {
        background-color: #0b592e;
    }

.esu-btn-light-busy {
    background-color: #ff3355;
    color: white;
}

.esu-btn-light-add {
    background-color: #adf;
    color: #222;
}

    .esu-btn-light-add:hover {
        background-color: #9ce;
    }

.esu-btn-light-excel {
    background-color: #068;
    color: white;
}

    .esu-btn-light-excel:hover {
        background-color: #056;
    }

.esu-btn-light-action {
    background-color: #b44;
    color: white;
}

    .esu-btn-light-action:hover {
        background-color: #933;
    }

.esu-btn-light-cancel,
.esu-btn-light-save,
.esu-btn-light-busy,
.esu-btn-light-add,
.esu-btn-light-excel,
.esu-btn-light-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    gap: 5px;
    min-height: 1.7rem;
    min-width: 6rem;
    border: none;
    border-radius: 4px;
    padding: 0 10px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.pg-busy-spinner {
    display: inline-block;
    vertical-align: middle;
    width: 22px;
    height: 22px;
    border: 3px solid #dfe8f5;
    border-top: 3px solid #005a9e;
    border-radius: 50%;
    animation: Spin 1s linear infinite;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* FILTRI */
.filter-bar {
    background-color: #f9f9f9;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    column-gap: 15px;
    row-gap: 5px;
    align-items: center;
    font-size: 13px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-break {
    flex-basis: 100%;
}

.filter-bar-control {
    min-height: 25px;
    height: 25px;
    line-height: 13px;
    box-sizing: border-box;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

select.filter-bar-control,
input[type="date"].filter-bar-control,
input[type="month"].filter-bar-control {
    cursor: pointer;
}

.filter-bar-reset {
    background: none;
    border: none;
    color: #a00;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.hidden {
    visibility: hidden;
}

/* ==========================================================================
   TABELLA HANDSONTABLE
   ========================================================================== */
.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;
    }

    /* 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;
    }

.esu-checkbox-top {
    vertical-align: top !important;
}

.esu-checkbox-bottom {
    vertical-align: bottom !important;
}

/* 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); /* 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;
    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); /* 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;
}

/* 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); /* 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;
    }

/* ==========================================================================
   FILE MANAGER 
   ========================================================================== */
.esu-tree-node {
    cursor: pointer;
    user-select: none;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .esu-tree-node:hover {
        background-color: #eef6ff;
    }

.esu-tree-node-selected {
    background-color: #dcecff;
    color: #003f73;
    font-weight: 600;
    border-radius: 4px;
}

.fm-link {
    color: #005a9e;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

    .fm-link:hover {
        color: #003f73;
        background-color: #eef6ff;
    }

.fm-folder-selected {
    border-radius: 4px;
    padding: 2px 4px;
    cursor: pointer;
    background: #c6dcf7;
    color: #003f73;
    font-weight: 600;
}

.esu-tree-node-drop-target {
    background-color: #c7ebd4 !important;
    color: #064e2b !important;
    outline: 2px dashed #107c41;
    outline-offset: -2px;
    font-weight: 700;
}

/* ==========================================================================
   POPUP MODALE
   ========================================================================== */
.popup-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1px);
}

.popup-busy-box {
    background: white;
    border-radius: 10px;
    padding: 30px;
    min-width: 350px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    animation: fadeIn .1s ease-in;
}

.popup-busy-title {
    font-size: 18px;
    font-weight: 700;
    margin-top: 15px;
    color: #555;
}

.popup-busy-subtitle {
    margin-top: 8px;
    color: #666;
}

.popup-busy-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #dfe8f5;
    border-top: 5px solid #005a9e;
    border-radius: 50%;
    margin: 0 auto;
    animation: Spin 1s linear infinite;
}

.popup-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(1px);
}

.popup-modal-body {
    display: flex;
    flex-direction: column;
    width: clamp(200px, 80vw, 800px);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,.35);
    animation: fadeIn .1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-modal-title {
    color: #005a9e;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 3px;
}

    .popup-modal-title img {
        position: relative;
        top: -2px;
    }

.popup-modal-subtitle {
    color: #666;
    border-bottom: 1px solid #ccc;
    margin-bottom: 1.2rem;
    padding-bottom: 3px;
}

    .popup-modal-subtitle img {
        position: relative;
        top: -3px;
    }

.popup-input-label {
    display: block;
    font-size: 13px;
    color: #333;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.popup-input {
    width: 100%;
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.popup-btn-light {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: right;
    vertical-align: top;
    border-top: 1px solid #ccc;
    padding-top: 12px;
}

/* ==========================================================================
   GRAFICO ApexChart 
   ========================================================================== */
.apexcharts-tooltip-title {
    font-size: 16px !important;
    font-weight: 700 !important;
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 3px !important;
}

.esu-pun-chart .apexcharts-xaxis-label {
    font-size: 13px !important;
}

.esu-pun-chart .apexcharts-yaxis-label {
    font-size: 13px !important;
}
