/* --- 1. OVERRIDE CORE PER BIANCO TOTALE E STICKY FOOTER --- */
:root {
    --ins-body-bg: #ffffff !important;
    --ins-page-bg: #ffffff !important;
    --bs-body-bg: #ffffff !important;
}

html, body {
    /* ELIMINATO height: 100% e overflow-x: hidden CHE ROMPEVANO I CALCOLI DI SYNCFUSION */
    min-height: 100vh;
    background-color: #ffffff !important;
    margin: 0;
    padding: 0;
}

/* Struttura per tenere il footer sempre in fondo */
.page {
    display: flex;
    flex-direction: column;
    /*min-height: 100%;*/
    min-height: 100vh;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1; /* Occupa tutto lo spazio disponibile */
    background-color: #ffffff !important;
}

.page-body {
    flex: 1; /* Questo spinge il footer verso il basso */
    padding-top: 2rem !important;
}

.footer {
    margin-top: auto; /* Forza il footer a stare in fondo al wrapper */
    background-color: #ffffff !important;
    border-top: 1px solid rgba(101, 109, 119, 0.1) !important;
    padding: 1rem 0;
}

/* --- 2. LOGICA ORIGINALE BLAZOR (Dalla tua copia) --- */
app {
    position: relative;
    display: flex;
    flex-direction: column;
}

.top-row {
    height: 3.5rem;
    display: flex;
    align-items: center;
}

/* --- 3. TUTTI I TUOI OVERRIDE SYNCFUSION (Spostati dal MainLayout) --- */
.e-panel-header {
    background-color: rgb(231, 241, 255) !important;
    text-align: center;
}

.e-panel-content {
    text-align: center;
    margin-top: 10px;
}

.highlight-row {
    background-color: #f0f2f7 !important;
}

.e-treegrid .e-headercell {
    background-color: #E7F1FF !important;
    color: black !important;
    font-weight: bold !important;
}

div.e-toolbar-items {
    background-color: #E7F1FF !important;
}

.e-rowdragheader {
    background-color: #E7F1FF !important;
}

/* Nascondi comandi specifici come avevi nel layout */
.e-removeCommand .e-unboundcell .e-unboundcelldiv button.e-Editbutton,
.e-removeCommandDelete .e-unboundcell .e-unboundcelldiv button.e-Deletebutton,
.e-removeEye .e-unboundcell .e-unboundcelldiv button.e-Nonebutton {
    display: none;
}

.e-showEye .e-unboundcell .e-unboundcelldiv button.e-Nonebutton {
    display: inline;
}

/* --- 4. FIX NAVBAR SAFECORE --- */
.navbar {
    background-color: #f7f7f7 !important; /* Ripristinato il tuo grigio originale */
    border-bottom: 1px solid rgba(101, 109, 119, 0.1) !important;
    box-shadow: none !important;
}

.navbar-nav .nav-item.active .nav-link {
    color: #206bc4 !important;
    border-bottom: 2px solid #206bc4 !important;
    font-weight: 600 !important;
}


/* Allinea la Dropdown Syncfusion nella Navbar */
.custom-dropdown.e-input-group {
    border: none !important;
    background-color: transparent !important;
    min-width: 150px;
}

.custom-dropdown .e-input {
    font-weight: 600;
    color: #495057 !important;
}

/* --- 5. STILE PROFILO UTENTE (Hover Verde Inspinia) --- */

.user-profile-dropdown {
    transition: all 0.2s ease;
    padding: 5px 10px !important;
    border-radius: 4px;
}

    /* Quando passi il mouse, il nome diventa Verde Inspinia */
    .user-profile-dropdown:hover .user-name-label {
        color: #1ab394 !important;
    }

    .user-profile-dropdown:hover {
        background-color: rgba(26, 179, 148, 0.05) !important;
    }

/* Stile per gli elementi del dropdown */
.dropdown-menu {
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

.dropdown-item {
    border-radius: 4px;
    padding: 0.6rem 1rem;
    font-size: 13px;
    transition: all 0.2s;
}

    /* Hover Standard (Verde) */
    .dropdown-item:hover {
        background-color: #1ab394 !important;
        color: #ffffff !important;
    }

    /* Hover Logout (Rosso Inspinia) */
    .dropdown-item.text-danger:hover {
        background-color: #ed5565 !important;
        color: #ffffff !important;
    }
/* --- 6. FIX POPUP SYNCFUSION PULITO --- */

/* Alziamo solo il livello per battere le modali di Bootstrap, senza toccare l'overflow */
.e-dropdown-popup,
.e-timepicker-popup,
.e-datepicker-popup {
    z-index: 999999 !important;
}


/* --- 7. RIPRISTINO STILI BOTTONI YES/NO (ADD ITEM) --- */

/*.new-item-content {
    display: flex;
    align-items: center;
}

.new-item-text {
    color: #495057;*/ /* Grigio scuro elegante */
/*}

.new-item-icon {
    cursor: pointer;
    color: #206bc4;
}*/

/* Il bottone carino */
/*.box-icon {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #206bc4;
    border-radius: 4px;
    color: #206bc4;
    text-align: center;
    min-width: 50px;
    background-color: #f0f6fc;*/ /* Azzurrino chiarissimo */
    /*font-style: normal;*/ /* Evita che SfIcon lo metta in corsivo */
    /*font-weight: 600;
    margin-left: 8px;
    transition: all 0.2s ease-in-out;
}

    .box-icon:hover {
        background-color: #206bc4;
        color: #ffffff !important;
        border-color: #206bc4;
    }*/

/* Rimuove lo sfondo dai singoli contenitori degli item della toolbar */
.sf-grid .e-toolbar div.e-toolbar-item {
    background: transparent !important;
    border: none !important;
}

/* --- 9. FIX DEFINITIVO: TOOLBAR AZZURRE E TAB BIANCHI --- */

/* 1. Ripristiniamo l'azzurrino SOLO nelle toolbar delle GRIGLIE */
.e-grid .e-toolbar,
.e-grid .e-toolbar-items {
    background-color: #E7F1FF !important;
    border-bottom: 1px solid #d1e3ff !important;
}

/* 2. Forziamo i TAB a rimanere BIANCHI (come SafeCore) */
.e-tab .e-tab-header,
.e-tab .e-toolbar-items {
    background-color: #ffffff !important;
}

/* 3. Evidenziamo il TAB SELEZIONATO (Sfondo bianco e bordo blu) */
.e-tab .e-toolbar-item.e-active .e-tab-wrap {
    background-color: #E7F1FF !important;
    border-bottom: 2px solid #206bc4 !important;
}

/* 4. BOTTONI TOOLBAR: Senza sfondo (trasparenza) e con hover azzurro */
.e-toolbar .e-tbar-btn,
.e-toolbar .e-btn {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

    .e-toolbar .e-tbar-btn:hover {
        background-color: #bcd9ff !important; /* Azzurro più scuro all'hover */
        color: #0056b3 !important;
        border-radius: 4px;
    }


/* --- 10. STILE TIMELINE (FormCompile) --- */

.custom-timeline {
    padding: 5px 0 !important;
    background: transparent !important;
}

/* Contenitore del singolo step */
.template-container {
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 180px;
    text-align: center;
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0 !important; /* Bordo sottile invece di 5px solid */
}

    /* Stato: Selezionato (Blu SafeCore) */
    .template-container.item-Selected {
        background: #f0f7ff;
        border-color: #206bc4 !important;
        box-shadow: 0 4px 6px -1px rgba(32, 107, 196, 0.1);
    }

        .template-container.item-Selected .timeline-content {
            color: #206bc4;
            font-weight: 600;
        }

/* Testo dentro la timeline */
.timeline-content {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

/* Linea di progresso e indicatori */
.progress-line {
    height: 4px;
    background: #e2e8f0;
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    display: inline-block;
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
}

.item-Selected .indicator {
    background: #206bc4;
    box-shadow: 0 0 0 4px rgba(32, 107, 196, 0.2);
}


/* --- 11. EVIDENZIAZIONE STORICA (Solo per la Timeline) --- */

/* Classe specifica per il confronto dei frammenti storici */
.timeline-diff-highlight {
    background-color: #fff9db !important; /* Giallo chiarissimo */
    border-left: 4px solid #fcc419 !important; /* Bordo giallo ambra */
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

    /* Etichetta informativa visibile solo quando si guarda il passato */
    .timeline-diff-highlight::before {
        content: 'VALORE NEL FRAMMENTO SELEZIONATO';
        display: block;
        font-size: 9px;
        font-weight: 800;
        color: #997404;
        margin-bottom: 4px;
        text-transform: uppercase;
    }

/* --- 11. SWITCH A 3 STATI --- */
/* STATO 1: Null -> Grigetto */
.tri-null.e-switch-wrapper .e-switch-inner,
.tri-null.e-switch-wrapper.e-switch-active .e-switch-inner {
    background-color: #adb5bd !important;
    border-color: #adb5bd !important;
}

/* STATO 2: True -> Verde */
.tri-state-true.e-switch-wrapper.e-switch-active .e-switch-inner {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

/* STATO 3: False -> Rosso (anche se lo switch risulta nativamente "spento") */
.tri-state-false.e-switch-wrapper .e-switch-inner {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

/* --- AGGIUNGI QUESTO IN FONDO AL FILE PER L'ERRORE BLAZOR --- */

#blazor-error-ui {
    background: #fff3cd; /* Giallo chiaro classico */
    bottom: 0;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
    display: none; /* NASCOSTO DI DEFAULT */
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed; /* Sta sopra a tutto solo quando serve */
    width: 100%;
    z-index: 9999;
    color: #856404;
    border-top: 1px solid #ffeeba;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }