/* ============================================
   SESSION TYPE FILTER STYLES + DUAL CHART SYSTEM
   Versione Completa Integrata + RADAR RESPONSIVE
   ============================================ */

/* ================================================
   FILTERS CONTAINER - VERSIONE COMPATTA
   ================================================ */

.filters-container {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-label svg {
    color: #fd9002;
    width: 12px;
    height: 12px;
}

.filter-select {
    background: #0f172a;
    color: white;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.filter-select:hover {
    border-color: #fd9002;
    background: #1e293b;
}

.filter-select:focus {
    border-color: #fd9002;
    box-shadow: 0 0 0 2px rgba(253, 144, 2, 0.15);
    background: #1e293b;
}

/* Responsive Filters */
@media (max-width: 1024px) {
    .filters-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .filters-container {
        padding: 0.6rem 0.75rem;
    }

    .filters-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .filter-label {
        font-size: 0.65rem;
    }

    .filter-select {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* ================================================
   BOTTONE ANALISI AVANZATA - VERSIONE MINIMAL COMPATTA
   Con commenti per regolazioni facili
   ================================================ */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CONTAINER PRINCIPALE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.analisi-avanzata-container {
    /* 📏 SPAZIATURA VERTICALE - Riduci questi valori per meno spazio */
    margin-top: 0.25rem;     /* ⬆️ SPAZIO SOPRA (tra cards e bottone) - REGOLA QUI */
    margin-bottom: 0.25rem;  /* ⬇️ SPAZIO SOTTO (tra bottone e grafico) - REGOLA QUI */
    padding: 0 1rem;         /* Padding orizzontale */

    /* Layout */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BOTTONE - DESIGN COMPATTO
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn-analisi-avanzata-chart {
    /* 🎨 COLORI - Cambia qui per colori diversi */
    background: linear-gradient(135deg, #fd9002 0%, #ec4899 100%);
    color: white;
    border: none;

    /* 📐 DIMENSIONI - Riduci questi per bottone più piccolo */
    padding: 0.6rem 0.75rem;    /* Verticale | Orizzontale - REGOLA QUI */
    font-size: 0.9rem;          /* Dimensione testo - REGOLA QUI */
    border-radius: 8px;         /* Angoli arrotondati */

    /* 🔤 TESTO */
    font-weight: 600;
    letter-spacing: 0.2px;

    /* Layout interno */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;                /* Spazio tra icone e testo */

    /* Dimensioni min/max */
    min-width: 240px;           /* Larghezza minima - REGOLA QUI */
    max-width: 450px;           /* Larghezza massima */

    /* 🌟 OMBRE - Riduci o rimuovi per stile più flat */
    box-shadow:
        0 4px 12px rgba(253, 144, 2, 0.3),  /* Ombra arancione */
        0 2px 6px rgba(236, 72, 153, 0.2);  /* Ombra rosa */

    /* Transizioni */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ICONE SVG
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn-analisi-avanzata-chart svg {
    flex-shrink: 0;
    /* 📏 DIMENSIONI ICONE - Riduci per icone più piccole */
    width: 18px;                /* REGOLA QUI */
    height: 18px;               /* REGOLA QUI */
    transition: transform 0.3s ease;
}

.btn-analisi-avanzata-chart svg:first-child {
    /* Icona sinistra - grafico */
}

.btn-analisi-avanzata-chart svg:last-child {
    /* Icona destra - freccia */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TESTO
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn-analisi-avanzata-chart span {
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   STATI HOVER E ACTIVE (animazioni ridotte)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn-analisi-avanzata-chart:hover {
    /* 🎭 EFFETTO HOVER - Riduci o rimuovi per meno movimento */
    transform: translateY(-2px);  /* Solleva di 2px - REGOLA QUI (0px per disabilitare) */
    box-shadow:
        0 6px 16px rgba(253, 144, 2, 0.4),
        0 4px 10px rgba(236, 72, 153, 0.3);
}

.btn-analisi-avanzata-chart:hover svg:last-child {
    /* Freccia si muove a destra al hover */
    transform: translateX(3px);   /* REGOLA QUI (0px per disabilitare) */
}

.btn-analisi-avanzata-chart:active {
    /* Effetto click */
    transform: translateY(0px);
    box-shadow:
        0 3px 10px rgba(253, 144, 2, 0.3),
        0 2px 6px rgba(236, 72, 153, 0.2);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FOCUS (accessibilità)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn-analisi-avanzata-chart:focus {
    outline: none;
    box-shadow:
        0 4px 12px rgba(253, 144, 2, 0.3),
        0 2px 6px rgba(236, 72, 153, 0.2),
        0 0 0 3px rgba(253, 144, 2, 0.3);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   RESPONSIVE - Mobile
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Tablet */
@media (max-width: 768px) {
    .analisi-avanzata-container {
        margin-top: 0.6rem;       /* ⬆️ SPAZIO SOPRA tablet - REGOLA QUI */
        margin-bottom: 0.6rem;    /* ⬇️ SPAZIO SOTTO tablet - REGOLA QUI */
        padding: 0 0.75rem;
    }

    .btn-analisi-avanzata-chart {
        padding: 0.55rem 1.1rem;      /* REGOLA QUI */
        font-size: 0.875rem;          /* REGOLA QUI */
        min-width: 220px;
    }

    .btn-analisi-avanzata-chart svg {
        width: 16px;                   /* REGOLA QUI */
        height: 16px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .analisi-avanzata-container {
        margin-top: 0.5rem;        /* ⬆️ SPAZIO SOPRA mobile - REGOLA QUI */
        margin-bottom: 0.5rem;     /* ⬇️ SPAZIO SOTTO mobile - REGOLA QUI */
        padding: 0 0.5rem;
    }

    .btn-analisi-avanzata-chart {
        padding: 0.5rem 1rem;          /* REGOLA QUI */
        font-size: 0.85rem;            /* REGOLA QUI */
        min-width: 200px;
        max-width: 100%;
        width: 100%;                   /* Full width su mobile */
    }

    .btn-analisi-avanzata-chart svg {
        width: 15px;                   /* REGOLA QUI */
        height: 15px;
    }
}

/* Mobile molto piccolo */
@media (max-width: 480px) {
    .analisi-avanzata-container {
        margin-top: 0.5rem;        /* ⬆️ SPAZIO SOPRA mobile piccolo - REGOLA QUI */
        margin-bottom: 0.5rem;     /* ⬇️ SPAZIO SOTTO mobile piccolo - REGOLA QUI */
    }

    .btn-analisi-avanzata-chart {
        padding: 0.45rem 0.9rem;       /* REGOLA QUI */
        font-size: 0.8rem;             /* REGOLA QUI */
        gap: 0.4rem;
    }

    .btn-analisi-avanzata-chart svg {
        width: 14px;                   /* REGOLA QUI */
        height: 14px;
    }
}

/* ========================================
   MODAL ANALISI AVANZATA
   ======================================== */
.advanced-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.advanced-modal.active {
    opacity: 1;
}

.advanced-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1rem;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.advanced-modal.active .advanced-modal-content {
    transform: scale(1);
}

/* ========================================
   MODAL HEADER
   ======================================== */
.advanced-modal-header {
    background: linear-gradient(135deg, #fd9002, #ec4899);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-info svg {
    width: 32px;
    height: 32px;
    stroke-width: 2;
}

.header-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
}

.header-info p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.modal-close {
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-close svg {
    display: block;
}

/* ========================================
   TABS
   ======================================== */
.advanced-tabs {
    display: flex;
    background: rgba(45, 55, 72, 0.5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: #ffffff;
    background: rgba(71, 85, 105, 0.3);
}

.tab-btn.active {
    color: #fd9002;
    background: rgba(15, 23, 42, 0.5);
    border-bottom-color: #fd9002;
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   CONTENT AREA
   ======================================== */
.advanced-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
    font-size: 1rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #a0aec0;
    font-size: 1.1rem;
}

/* ========================================
   SECTION TITLE
   ======================================== */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fd9002;
    margin-bottom: 1.5rem;
}

.section-title svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   SPLIT COMPARISON VIEW
   ======================================== */
.split-comparison {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid;
    background: rgba(15, 23, 42, 0.5);
}

.stat-card h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #ffffff;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-item span:first-child {
    color: #94a3b8;
    font-size: 0.875rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

/* ========================================
   COMPARISON CHART
   ======================================== */
.comparison-chart {
    background: rgba(30, 41, 59, 0.3);
    border-radius: 14px;
    padding: 1.75rem;
    margin-top: 2rem;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.comparison-chart h4 {
    margin: 0 0 0.5rem 0;
    color: white;
    font-size: 1.15rem;
    font-weight: 600;
}

/* ========================================
   DUAL CHART SYSTEM - SWITCH
   ======================================== */

/* Switch container */
.chart-switch-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.chart-switch-container h4 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Toggle wrapper */
.chart-toggle-wrapper {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Toggle buttons */
.chart-toggle-btn {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: rgba(51, 65, 85, 0.5);
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chart-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(253, 144, 2, 0.2), transparent);
    transition: left 0.5s ease;
}

.chart-toggle-btn:hover::before {
    left: 100%;
}

.chart-toggle-btn:hover {
    background: rgba(71, 85, 105, 0.6);
    border-color: rgba(253, 144, 2, 0.4);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 144, 2, 0.2);
}

.chart-toggle-btn.active {
    background: linear-gradient(135deg, rgba(253, 144, 2, 0.25) 0%, rgba(251, 191, 36, 0.15) 100%);
    border-color: #fd9002;
    color: white;
    box-shadow: 0 4px 16px rgba(253, 144, 2, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chart-toggle-btn.active svg {
    filter: drop-shadow(0 0 8px rgba(253, 144, 2, 0.6));
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.chart-toggle-btn svg {
    transition: all 0.3s ease;
}

.chart-toggle-btn:hover svg {
    transform: scale(1.1) rotate(5deg);
}

.chart-toggle-btn.active svg {
    transform: scale(1.15);
}

/* Responsive buttons */
@media (max-width: 600px) {
    .chart-toggle-wrapper {
        flex-direction: column;
    }

    .chart-toggle-btn {
        min-width: 100%;
    }
}

/* ========================================
   DUAL CHART CONTAINER
   ======================================== */

/* Container ottimizzato per i grafici */
.dual-chart-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    margin-top: 1.5rem;
}

/* Chart wrappers */
.chart-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0.5s;
}

.chart-wrapper.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0s;
}

/* Canvas sizing */
.chart-wrapper canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 500px;
}

/* Combo chart specific */
#combo-chart-wrapper canvas {
    min-height: 400px;
}

/* Sunburst chart specific */
#sunburst-chart-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#sunburst-chart-wrapper canvas {
    max-width: 600px;
    max-height: 600px;
    min-height: 450px;
}

/* Chart enter animation */
.chart-wrapper.active canvas {
    animation: chart-enter 0.8s ease-out;
}

@keyframes chart-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.chart-wrapper.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-wrapper.loading::after {
    content: '⏳ Caricamento grafico...';
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   RADAR CHART CONTAINER (Retrocompatibilità)
   ======================================== */
.radar-chart-container {
    background: rgba(255,255,255,0.03);
    padding: 2rem;
    border-radius: 8px;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-chart-container canvas {
    width: 100% !important;
    max-width: 500px !important;
    height: 100% !important;
}

/* ========================================
   BAR COMPARISON (Timeline e altri)
   ======================================== */
.bar-comparison {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
}

.bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar {
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    transition: all 0.3s ease;
    min-width: 80px;
}

/* ========================================
   INDIVIDUAL ANALYSIS VIEW
   ======================================== */
.individual-analysis {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.type-section {
    background: rgba(45, 55, 72, 0.5);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border-left: 4px solid;
}

.type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.type-section h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.mini-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.mini-stat {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
}

.mini-stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.mini-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

/* ========================================
   TYPE CHART SECTION
   ======================================== */
.type-chart-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.type-chart-section h5 {
    margin: 0 0 1rem 0;
    color: #e2e8f0;
    font-size: 1rem;
}

.type-chart-container {
    background: rgba(255,255,255,0.03);
    padding: 1rem;
    border-radius: 8px;
    height: 300px;
}

.type-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   TIMELINE VIEW
   ======================================== */
.timeline-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.timeline-period-filter {
    display: flex;
    gap: 0.5rem;
    background: rgba(45, 55, 72, 0.5);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.period-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.period-btn:hover {
    color: #ffffff;
    background: rgba(253, 144, 2, 0.1);
}

.period-btn.active {
    background: linear-gradient(135deg, #fd9002, #ec4899);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(253, 144, 2, 0.3);
}

.timeline-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: rgba(45, 55, 72, 0.5);
    border-radius: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
}

.legend-item span {
    font-size: 0.875rem;
    color: #cbd5e1;
}

.timeline-chart-container {
    background: rgba(255,255,255,0.05);
    padding: 1.5rem;
    border-radius: 10px;
    min-height: 450px;
}

.timeline-chart-container canvas {
    width: 100% !important;
    height: 400px !important;
}

/* ========================================
   FILTRO PERIODO INLINE (per Split e Individual)
   ======================================== */

/* Header con filtro periodo */
.split-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.split-header > div:first-child {
    flex: 1;
    min-width: 250px;
}

/* Filtro periodo inline - design compatto */
.period-filter-inline {
    display: flex;
    gap: 0.5rem;
    background: rgba(45, 55, 72, 0.5);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.period-filter-inline .period-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 50px;
    position: relative;
    overflow: hidden;
}

.period-filter-inline .period-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(253, 144, 2, 0.2), transparent);
    transition: left 0.4s ease;
}

.period-filter-inline .period-btn:hover::before {
    left: 100%;
}

.period-filter-inline .period-btn:hover {
    color: #ffffff;
    background: rgba(253, 144, 2, 0.1);
    transform: translateY(-1px);
}

.period-filter-inline .period-btn.active {
    background: linear-gradient(135deg, #fd9002, #ec4899);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(253, 144, 2, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(0);
}

.period-filter-inline .period-btn.active::before {
    display: none;
}

/* Animazione al click */
.period-filter-inline .period-btn:active {
    transform: scale(0.95);
}

/* Badge con animazione */
@keyframes badge-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

/* Focus per accessibilità */
.period-filter-inline .period-btn:focus {
    outline: 2px solid #fd9002;
    outline-offset: 2px;
}

/* ========================================
   RADAR CHART STYLES
   ======================================== */
.radar-chart-main {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid rgba(253, 144, 2, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.chart-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.chart-controls h4 {
    color: #fd9002;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.chart-subtitle {
    color: #a0aec0;
    font-size: 0.9rem;
    font-style: italic;
}

.radar-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.radar-container canvas {
    filter: drop-shadow(0 4px 20px rgba(253, 144, 2, 0.2));
    transition: filter 0.3s ease;
}

.radar-container canvas:hover {
    filter: drop-shadow(0 6px 30px rgba(253, 144, 2, 0.4));
}

/* METRICS LEGEND - VERSIONE COMPATTA */
.metrics-legend {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.metrics-legend h5 {
    color: #fd9002;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.metric-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.metric-info strong {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-info span {
    color: #a0aec0;
    font-size: 0.7rem;
    line-height: 1.2;
}

/* CARDS COMPATTE */
.stats-cards-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card-compact {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.stat-card-compact:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h4 {
    font-size: 1.1rem;
    margin: 0;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #a0aec0;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.stat-mini {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-mini .label {
    font-size: 0.75rem;
    color: #a0aec0;
}

.stat-mini .value {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
}

/* ========================================
   MOBILE RESPONSIVE - RADAR CHART
   ======================================== */
@media (max-width: 768px) {
    .radar-chart-main {
        padding: 1rem;
        margin-top: 1rem;
        border-radius: 12px;
    }

    .chart-controls h4 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    .chart-subtitle {
        font-size: 0.75rem;
        display: none;
    }

    .radar-container {
        padding: 0.5rem;
        max-width: 100%;
    }

    .stats-cards-compact {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stat-card-compact {
        padding: 1rem;
    }

    .card-header h4 {
        font-size: 0.95rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .card-stats {
        gap: 0.5rem;
    }

    .stat-mini .label {
        font-size: 0.7rem;
    }

    .stat-mini .value {
        font-size: 0.95rem;
    }

    .metrics-legend {
        margin-top: 1rem;
        padding: 0.75rem;
    }

    .metrics-legend h5 {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .metric-item {
        padding: 0.4rem;
    }

    .metric-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .metric-info strong {
        font-size: 0.75rem;
    }

    .metric-info span {
        font-size: 0.65rem;
    }

    .split-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .period-filter-inline {
        justify-content: center;
        width: 100%;
    }

    .period-filter-inline .period-btn {
        flex: 1;
        min-width: 45px;
    }
}

@media (max-width: 480px) {
    .radar-chart-main {
        padding: 0.75rem;
    }

    .chart-controls h4 {
        font-size: 1rem;
    }

    .radar-container {
        padding: 0.25rem;
    }

    .stats-cards-compact {
        gap: 0.5rem;
    }

    .stat-card-compact {
        padding: 0.75rem;
    }

    .metrics-grid {
        gap: 0.4rem;
    }

    .metric-item {
        gap: 0.4rem;
    }

    .period-filter-inline {
        padding: 0.2rem;
        gap: 0.3rem;
    }

    .period-filter-inline .period-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        min-width: 40px;
    }
}

/* ========================================
   RESPONSIVE OPTIMIZATION GENERALE
   ======================================== */

@media (max-width: 1024px) {
    .dual-chart-container {
        min-height: 450px;
    }

    .chart-wrapper canvas {
        max-height: 450px;
    }

    #combo-chart-wrapper canvas {
        min-height: 350px;
    }

    #sunburst-chart-wrapper canvas {
        max-width: 500px;
        max-height: 500px;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .advanced-modal {
        padding: 0.5rem;
    }

    .advanced-modal-content {
        max-height: 95vh;
    }

    .advanced-modal-header {
        padding: 1rem;
    }

    .header-info {
        gap: 0.5rem;
    }

    .header-info h2 {
        font-size: 1.125rem;
    }

    .header-info p {
        font-size: 0.75rem;
    }

    .advanced-tabs {
        overflow-x: auto;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .advanced-content {
        padding: 1rem;
    }

    .stats-cards-grid {
        grid-template-columns: 1fr;
    }

    .mini-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .timeline-legend {
        gap: 1rem;
    }

    .timeline-header {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline-period-filter {
        justify-content: center;
    }

    .dual-chart-container {
        min-height: 400px;
    }

    .chart-wrapper canvas {
        max-height: 400px;
    }

    #combo-chart-wrapper canvas {
        min-height: 300px;
    }

    #sunburst-chart-wrapper canvas {
        max-width: 400px;
        max-height: 400px;
        min-height: 350px;
    }

    .comparison-chart {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .btn-analisi-avanzata-chart,
    .btn-advanced-analysis,
    #analisi-avanzata-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    #tipo-sessione-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .advanced-modal-header {
        padding: 0.75rem;
    }

    .header-info svg {
        width: 24px;
        height: 24px;
    }

    .header-info h2 {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .comparison-chart {
        padding: 1rem;
    }

    .dual-chart-container {
        min-height: 350px;
    }

    #sunburst-chart-wrapper canvas {
        max-width: 100%;
        min-height: 300px;
    }

    .chart-switch-container {
        padding: 1rem;
    }
}

/* ========================================
   ANIMAZIONI E EFFETTI AGGIUNTIVI
   ======================================== */

@keyframes subtle-pulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.005);
        filter: brightness(1.02);
    }
}

.fade-enter {
    opacity: 0;
    transform: translateY(10px);
}

.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chart-wrapper canvas {
    transition: filter 0.3s ease;
}

.chart-wrapper.active:hover canvas {
    filter: brightness(1.05);
}

#chart-description {
    transition: color 0.3s ease;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.5rem !important;
}

.mb-2 {
    margin-bottom: 1rem !important;
}

.mb-3 {
    margin-bottom: 1.5rem !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 0.5rem !important;
}

.mt-2 {
    margin-top: 1rem !important;
}

.mt-3 {
    margin-top: 1.5rem !important;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

.chart-toggle-btn:focus,
.tab-btn:focus,
.period-btn:focus,
.modal-close:focus {
    outline: 2px solid #fd9002;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .chart-wrapper {
        transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    }

    .chart-wrapper.active {
        transition: opacity 0.2s ease, visibility 0s linear 0s;
    }

    .chart-toggle-btn,
    .tab-btn,
    .btn-analisi-avanzata-chart {
        transition: background-color 0.2s ease, color 0.2s ease;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .advanced-modal {
        position: static;
        background: white;
    }

    .advanced-modal-content {
        max-height: none;
        box-shadow: none;
    }

    .modal-close,
    .chart-toggle-wrapper,
    .timeline-period-filter {
        display: none !important;
    }

    .chart-wrapper {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .chart-wrapper.active {
        page-break-after: always;
    }
}

/* ========================================
   DARK MODE ENHANCEMENTS
   ======================================== */

@media (prefers-color-scheme: dark) {
    .filter-select,
    #tipo-sessione-select {
        background: #0f172a;
        color: white;
    }

    .chart-toggle-btn {
        background: rgba(51, 65, 85, 0.5);
        color: rgba(255, 255, 255, 0.7);
    }

    .chart-toggle-btn.active {
        color: white;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.advanced-content::-webkit-scrollbar {
    width: 8px;
}

.advanced-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.advanced-content::-webkit-scrollbar-thumb {
    background: rgba(253, 144, 2, 0.5);
    border-radius: 4px;
}

.advanced-content::-webkit-scrollbar-thumb:hover {
    background: rgba(253, 144, 2, 0.7);
}

.advanced-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(253, 144, 2, 0.5) rgba(15, 23, 42, 0.5);
}

/* ========================================
   LOADING SPINNER
   ======================================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fd9002;
    animation: spin 1s linear infinite;
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
    .chart-toggle-btn {
        border-width: 3px;
    }

    .chart-toggle-btn.active {
        border-color: #ffffff;
    }

    .filter-select:focus,
    #tipo-sessione-select:focus {
        box-shadow: 0 0 0 3px rgba(253, 144, 2, 0.5);
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

.chart-wrapper,
.chart-toggle-btn,
.advanced-modal-content {
    will-change: transform, opacity;
}

.chart-wrapper:not(.active),
.chart-toggle-btn:not(:hover):not(.active) {
    will-change: auto;
}

/* ========================================
   ANIMAZIONI BADGE
   ======================================== */

.type-badge {
    animation: badge-pulse 2s ease-in-out infinite;
}

/* ========================================
   STATO DISABLED PERIODO FILTER
   ======================================== */

.period-filter-inline .period-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   LOADING STATE PERIODO FILTER
   ======================================== */

.period-filter-inline.loading {
    opacity: 0.6;
    pointer-events: none;
}

.period-filter-inline.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fd9002;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin-period {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ========================================
   EFFETTO GLOW ATTIVO PERIODO FILTER
   ======================================== */

.period-filter-inline .period-btn.active {
    animation: glow-active 2s ease-in-out infinite;
}

@keyframes glow-active {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(253, 144, 2, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 2px 12px rgba(253, 144, 2, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* ========================================
   VARIANTI BOTTONE ANALISI AVANZATA
   ======================================== */

/* VARIANTE ULTRA-MINIMAL (ancora più compatto) */
.btn-analisi-avanzata-chart.ultra-minimal {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(253, 144, 2, 0.25);
}

.btn-analisi-avanzata-chart.ultra-minimal svg {
    width: 14px;
    height: 14px;
}

/* VARIANTE FLAT (senza ombre) */
.btn-analisi-avanzata-chart.flat {
    box-shadow: none;
    border: 2px solid rgba(253, 144, 2, 0.5);
}

.btn-analisi-avanzata-chart.flat:hover {
    transform: none;
    box-shadow: none;
    border-color: #fd9002;
}

/* VARIANTE OUTLINE (solo bordo) */
.btn-analisi-avanzata-chart.outline {
    background: transparent;
    border: 2px solid #fd9002;
    color: #fd9002;
    box-shadow: none;
}

.btn-analisi-avanzata-chart.outline:hover {
    background: linear-gradient(135deg, #fd9002 0%, #ec4899 100%);
    color: white;
    border-color: transparent;
}