/* =========================================
   1. ROOT VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* Brand Colors */
    --primary: #4D7EA8;
    --primary-hover: #3d6a8a;
    --secondary: #728C69;
    --accent: #E76F51;

    /* State Colors */
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;

    /* Neutrals */
    --white: #FFFFFF;
    --light: #F8F9FA;
    --gray-light: #F2F2F2;
    --gray: #D1D1D1;
    --gray-dark: #6C757D;
    --dark: #343A40;
    --black: #000000;

    /* Backgrounds */
    --bg-body: #ecf0f5;
    --bg-container: transparent;

    /* Typography */
    --font-family-base: 'Roboto', 'Arial', sans-serif;
    --font-family-mono: 'Courier New', Courier, monospace;

    /* Spacing & Borders */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* =========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================= */
body {
    font-family: var(--font-family-base);
    background-color: var(--bg-body);
    color: var(--dark);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: none;
    color: var(--primary);
}

.navbar{
    z-index: 1000;
}

/* =========================================
   3. LAYOUT & CONTAINERS
   ========================================= */
.container {
    background: var(--bg-container);
    padding: 20px;
    margin-top: 15px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    width: auto;
}

.dashboard-container {
    padding: 20px;
}

.errors-container {
    display: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-mono);
    font-weight: 600;
    background-color: rgba(220, 53, 69, 0.9);
    /* Danger with opacity */
    color: var(--white);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* =========================================
   4. CARDS
   ========================================= */
.card,
.content-card,
.stats-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: none;
    /* Reset default borders */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

/* Hover effects for interactive cards */
.stats-card:hover,
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Stats Card Specifics */
.stats-card {
    padding: 20px;
    display: flex;
    align-items: center;
    height: 100%;
}

.stat-icon {
    background-color: rgba(77, 126, 168, 0.1);
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: var(--primary);
    font-size: 24px;
}

.stat-content {
    flex-grow: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-dark);
    margin: 0;
}

/* Card Header */
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--white);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header a {
    cursor: pointer;
}



.card-body {
    padding: 20px;
}

.stats-highlight {
    animation: shine 1.8s ease-in-out;
}

/* =========================================
   5. BUTTONS (Standardized)
   ========================================= */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1.5;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    opacity: 0.95;
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Variants */
.btn-primary {
    background-color: var(--primary) !important;
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover);
    color: var(--white);
}

.btn-primary:focus,
.btn-primary:active,
.btn-primary:active:focus,
.btn-primary.active,
.btn-primary:focus-visible {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;

    box-shadow: none !important;
    outline: none !important;
}




.btn-secondary {
    background-color: var(--secondary);
    color: var(--white);
    border-color: var(--secondary);
}

.btn-danger,
.btn-delete {
    background-color: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-warning {
    background-color: var(--warning);
    color: var(--dark);
    border-color: var(--warning);
}

.btn-info {
    background-color: var(--info);
    color: var(--white);
    border-color: var(--info);
}

/* Outline Variants (often used for View/Edit) */
.btn-outline-primary,
.view-btn {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline-primary:hover,
.view-btn:hover {
    background-color: var(--primary);
    color: var(--white);
}

/* Action Buttons (The big square ones) */
.action-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
    color: var(--dark);
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    min-width: 120px;
    flex: 1;
    /* Responsive flex */
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-align: center;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    color: var(--primary);
}

.action-btn i {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--primary);
}

.action-btn span {
    font-size: 14px;
    font-weight: 500;
}

/* Mini Action Buttons (Table actions) */
.btn-action {
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    margin-right: 5px;
    font-size: 14px;
    color: var(--white);
    border: none;
    display: inline-flex;
    align-items: center;
}

.btn-action i {
    margin-right: 4px;
}

.btn-action.view {
    background-color: var(--primary);
}

.btn-action.edit {
    background-color: var(--warning);
    color: var(--dark);
}

.btn-action.delete {
    background-color: var(--danger);
}

.btn-header {
    display: inline-flex;
    /* Fondamentale per allineare gli elementi */
    align-items: center;
    /* Centra verticalmente icona e testo */
    justify-content: center;
    /* Centra il contenuto nel bottone */
    gap: 8px;
    /* Crea lo spazio tra icona e testo senza usare margin */
    background-color: white;
    padding: 6px 12px;
    /* Un po' di padding per renderlo cliccabile */
    border-radius: 4px !important;
}

/* Stile specifico per l'icona dentro questo bottone */
.btn-header i {
    font-size: 0.75rem;
    /* Rende l'icona più piccola del testo (come richiesto) */
    opacity: 0.8;
    /* (Opzionale) La rende leggermente più morbida */
    top: 0 !important;
}

/* (Opzionale) Assicura che il testo non vada a capo */
.btn-header span {
    white-space: nowrap;
    line-height: 1;
    /* Allineamento preciso col centro dell'icona */
    top: 0 !important;
}

/* Back Button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: var(--gray-dark);
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: var(--border-radius-md);
    cursor: pointer;
}

.back-button:hover {
    color: var(--primary);
    background: rgba(77, 126, 168, 0.05);
    transform: translateX(-3px);
    /* Subtle shift left */
}

.back-button i {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.back-button:hover i {
    transform: translateX(-2px);
}

/* Stats Card Refined */
.stats-card-refined {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    /* height: 100%; */
}

.stats-card-refined .icon-box {
    width: 50px;
    height: 50px;
    background: rgba(77, 126, 168, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 20px;
    flex-shrink: 0;
}

.stats-card-refined .content-box {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.stats-card-refined .stat-item {
    display: flex;
    flex-direction: column;
}

.stats-card-refined .stat-item.divider {
    border-left: 1px solid var(--gray-light);
    padding-left: 20px;
}

.stats-card-refined .label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray-dark);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stats-card-refined .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

/* =========================================
   6. UTILITIES & HELPERS
   ========================================= */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--gray-dark) !important;
}

.not-implemented {
    cursor: not-allowed !important;
    opacity: 0.6;
    position: relative;
    filter: grayscale(100%);
}

.not-implemented:hover::after {
    content: "Not Available";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* Legacy Support / Overrides */
.edited-style {
    box-shadow: 0 0 0 2px var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Stats Card Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Stats Progress Bar */
.progress-container {
    width: 100%;
    background-color: var(--gray-light);
    border-radius: 10px;
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success);
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}

.stat-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* Section Breakdown */
.section-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--border-radius-md);
}

.breakdown-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.breakdown-value {
    font-weight: 700;
    font-size: 15px;
}


/* Container Principale della Notifica */
[data-notify="container"] {
    /* Resetta i bordi standard di Bootstrap */
    border: none !important;
    border-radius: 4px !important;

    /* Aggiunge profondità (sembra galleggiare) */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;

    /* Spaziatura interna più ariosa */
    padding: 15px 20px !important;
    padding-right: 30px !important;
    /* Spazio per la X di chiusura */

    /* Font leggermente più grande e leggibile */
    font-size: 14px;
    font-weight: 500;
}

/* -------------------------------------------
   VARIANTE SUCCESS (Verde)
   Coerente con i tuoi errori, ma in verde.
   ------------------------------------------- */
[data-notify="container"].alert-success {
    background-color: #e8f5e9 !important;
    /* Verde molto chiaro */
    color: #2e7d32 !important;
    /* Verde scuro (testo) */
    border-left: 5px solid #43a047 !important;
    /* Barra laterale Verde */
}


[data-notify="container"].alert-info {
    background-color: #2faed370 !important;
    /* Verde molto chiaro */
    color: #025384  !important;
    /* Verde scuro (testo) */
    border-left: 5px solid #025384 !important;
    /* Barra laterale Verde */
}




/* -------------------------------------------
   VARIANTE DANGER (Rosso)
   Nel caso usassi notify anche per gli errori generali
   ------------------------------------------- */
[data-notify="container"].alert-danger {
    background-color: #fdecea !important;
    color: #8a1f1f !important;
    border-left: 5px solid #d32f2f !important;
}

/* Stile del testo del messaggio */
[data-notify="message"] {
    vertical-align: middle;
    display: inline-block;
    margin-left: 5px;
}

/* Stile del pulsante "X" (Chiudi) */
[data-notify="container"] .close {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%);
    /* Centra verticalmente */
    color: inherit !important;
    /* Prende il colore del testo (verde scuro) */
    opacity: 0.4;
    font-size: 20px;
    text-shadow: none !important;
    /* Rimuove l'ombra bianca brutta di default */
}

[data-notify="container"] .close:hover {
    opacity: 1;
}


/* 1. Di base, il messaggio DEVE essere nascosto */
.dropzone .dz-preview .dz-error-message {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 2. Il messaggio compare SOLO quando il contenitore ha la classe .dz-error */
.dropzone .dz-preview.dz-error .dz-error-message {
    display: block !important;
    opacity: 1 !important;

    /* Posizionamento e Stile */
    position: absolute;
    top: -10px;
    /* Un po' più in alto dell'immagine */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 53, 69, 0.9);
    /* Rosso Bootstrap */
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1000;
    min-width: 120px;
    text-align: center;
    pointer-events: none;
}

/* Il triangolino sotto il messaggio */
.dropzone .dz-preview.dz-error .dz-error-message:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(220, 53, 69, 0.9) transparent transparent transparent;
}

.dropzone .dz-preview .dz-progress {
    display: none !important;
}

.dropzone .dz-preview .dz-success-mark svg path {
    fill: #4caf50 !important;
}

/* --- SIDEBAR STRUTTURA --- */

.sidebar {
    background-color: #222d32;
    /* Sfondo scuro Dashboard */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: all 0.3s ease;
}

/* --- PANNELLO UTENTE --- */
.user-panel {
    position: relative;
    width: 100%;
    padding: 20px 15px;
    background-color: #1a2226;
    /* Stacco leggermente più scuro */
    margin-bottom: 10px;
    display: table;
    /* Hack per allineamento */
}

.user-panel .image {
    display: table-cell;
    vertical-align: top;
    padding-right: 15px;
}

.user-panel img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    /* Immagine rotonda */
    border: 3px solid #3c8dbc;
    /* Bordo Tech Blue */
    padding: 3px;
}

.user-panel .info {
    display: table-cell;
    vertical-align: middle;
}

.user-panel .info p {
    font-weight: 600;
    margin-bottom: 5px;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.user-panel .role-badge {
    color: #b8c7ce;
    font-size: 11px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.user-panel .role-badge:hover {
    color: #fff;
}

/* Dropdown menu utente scuro */
.user-panel .dropdown-menu {
    background-color: #2c3e50;
    border: 1px solid #1a2226;
    margin-top: 10px;
}

.user-panel .dropdown-menu>li>a {
    color: #b8c7ce;
    padding: 8px 15px;
}

.user-panel .dropdown-menu>li>a:hover {
    background-color: #3c8dbc;
    color: #fff;
}

/* --- MENU LISTA --- */
.sidebar-list .list-group-item {
    background-color: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: #b8c7ce;
    padding: 12px 15px;
    border-radius: 0;
}

.sidebar-list .list-group-item:hover {
    background-color: #1e282c;
    color: #fff;
    border-left-color: #3c8dbc;
    /* Effetto hover laterale */
}

/* Dropzone Success Mark Fix */
/* Override default animation that fades out the checkmark */
.dropzone .dz-preview.dz-success .dz-success-mark {
    opacity: 1 !important;
    animation: none !important;
}

.sidebar-list .list-group-item.active,
.sidebar-list .list-group-item.active:hover {
    background-color: #1e282c;
    color: #fff;
    border-left-color: #3c8dbc;
    /* Bordo blu attivo */
    z-index: 2;
}

.sidebar-list .list-group-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Sovrascrive lo stile active di default di Bootstrap 3 */
#navbar-element .list-group-item.active,
#navbar-element .list-group-item.active:hover,
#navbar-element .list-group-item.active:focus {
    z-index: 2;
    color: #fff;
    background-color: #2c3e50;
    /* Blu scuro tecnico */
    border-color: #2c3e50;
}

/* Distanzia leggermente l'icona dal testo */
#navbar-element .list-group-item .fa {
    margin-right: 8px;
    font-size: 1.1em;
    /* Leggermente più grandi */
}

/* =========================================
   7. GROUPED STATS CARDS
   ========================================= */
.grouped-stats-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 15px 20px;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.grouped-stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.gs-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Correct: Left align items overall */
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-light);
}

.gs-title-block {
    display: flex;
    align-items: center;
    flex: 0 0 45%;
    /* FIXED: Ensures title block takes left portion */
}

.gs-icon {
    width: 36px;
    height: 36px;
    background: rgba(77, 126, 168, 0.1);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 12px;
}

.gs-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Header Labels Row */
.gs-labels-container {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    /* Evenly distribute labels */
    flex: 1;
    /* Take remaining space */
}

.gs-label-col {
    text-align: center;
    flex: 1;
    font-size: 11px;
    color: var(--gray-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Values Row - Match structure of Header */
.gs-content {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Spacer matching title block width */
.gs-spacer {
    flex: 0 0 45%;
}

/* Container for values matching labels container */
.gs-values-container {
    display: flex;
    justify-content: space-evenly;
    flex: 1;
    align-items: center;
}

.gs-value-col {
    text-align: center;
    flex: 1;
    position: relative;
}

.gs-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    line-height: 1;
}

.gs-col-divider {
    width: 1px;
    height: 25px;
    background: var(--gray-light);
    margin: 0 5px;
}
