* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
    padding: 16px;
    padding-top: 80px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 166, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 204, 0, 0.1) 0%, transparent 50%);
    animation: float-bg 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float-bg {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 900;
    color: #ffa600;
    text-shadow: 0 0 20px rgba(255, 166, 0, 0.5);
    margin-bottom: 8px;
}

.header-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* KPI Cards Dashboard */
.kpi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(255, 166, 0, 0.2);
    border-color: rgba(255, 166, 0, 0.3);
}

.kpi-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffa600;
    text-shadow: 0 0 20px rgba(255, 166, 0, 0.5);
    margin-bottom: 6px;
    line-height: 1;
}

.kpi-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.kpi-trend {
    font-size: 0.95rem;
    font-weight: 600;
}

.trend-up { color: #10b981; }
.trend-down { color: #ef4444; }
.trend-neutral { color: #94a3b8; }

/* Chart Section */
.chart-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffa600;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 166, 0, 0.2);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.tab-btn:hover {
    background: rgba(255, 166, 0, 0.2);
    border-color: #ffa600;
}

.tab-btn.active {
    background: linear-gradient(135deg, #ffa600, #ff8c00);
    border-color: #ffa600;
    box-shadow: 0 4px 12px rgba(255, 166, 0, 0.4);
}

.chart-container {
    position: relative;
    height: 350px;
    margin-top: 20px;
}

.chart-info {
    text-align: center;
    color: #94a3b8;
    margin-top: 12px;
    font-size: 0.95rem;
}

/* Period Filters */
.period-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.period-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.period-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.period-btn.active {
    background: rgba(255, 166, 0, 0.2);
    border-color: #ffa600;
    color: #ffa600;
    font-weight: 600;
}

/* Sessions Timeline */
.sessions-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.filter-chips {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-chip.active {
    background: linear-gradient(135deg, #ffa600, #ff8c00);
    border-color: #ffa600;
    font-weight: 600;
}

/* Session Timeline Item */
.session-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #ffa600;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    min-height: 80px;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.session-main {
    flex: 1;
    min-width: 200px;
}

.session-date {
    font-size: 1.1rem;
    color: #ffa600;
    font-weight: 700;
    margin-bottom: 6px;
}

.session-details {
    font-size: 1rem;
    color: #94a3b8;
    line-height: 1.5;
}

.session-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.stat-badge {
    text-align: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    min-width: 70px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffa600;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-top: 4px;
}

.session-badge {
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-analyzed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
    background: rgba(255, 166, 0, 0.2);
    color: #ffa600;
    border: 1px solid rgba(255, 166, 0, 0.3);
}

.badge-insufficient {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.session-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #ffa600, #ff8c00);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 166, 0, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ============================================
   NUOVO: PERFORMANCE BADGES STYLES
   ============================================ */
.performance-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.perf-badge {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    border: 1px solid;
}

.perf-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Badge Levels */
.badge-excellent {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}

.badge-good {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
}

.badge-warning {
    background: rgba(255, 166, 0, 0.2);
    color: #ffa600;
    border-color: rgba(255, 166, 0, 0.4);
}

.badge-critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    animation: pulse-critical 2s ease-in-out infinite;
}

@keyframes pulse-critical {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #0a0e27, #1a1f3a);
    border: 2px solid rgba(255, 166, 0, 0.3);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #0a0e27, #1a1f3a);
    z-index: 1;
}

.modal-header h2 {
    color: #ffa600;
    font-size: 1.5rem;
    font-weight: 900;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.modal-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.modal-tab:hover {
    color: #fff;
}

.modal-tab.active {
    color: #ffa600;
    border-bottom-color: #ffa600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.score-display {
    text-align: center;
    padding: 30px;
    background: rgba(255, 166, 0, 0.1);
    border-radius: 16px;
    margin-bottom: 24px;
}

.score-value {
    font-size: 4rem;
    font-weight: 900;
    color: #ffa600;
    text-shadow: 0 0 30px rgba(255, 166, 0, 0.6);
}

.score-label {
    font-size: 1rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.info-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 18px;
    border-radius: 12px;
    border-left: 3px solid #ffa600;
}

.info-card-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.info-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffa600;
    line-height: 1.2;
}

.recommendation {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #ffa600;
    padding: 18px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.rec-title {
    font-weight: 700;
    color: #ffa600;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.rec-high { border-left-color: #ef4444; }
.rec-medium { border-left-color: #ffa600; }
.rec-low { border-left-color: #10b981; }

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 166, 0, 0.2);
    border-top-color: #ffa600;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
        padding: 70px 12px 12px 12px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .kpi-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-value {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .tab-btn, .period-btn, .filter-chip {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .session-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
        gap: 16px;
    }

    .session-main {
        width: 100%;
    }

    .session-date {
        font-size: 1.15rem;
    }

    .session-details {
        font-size: 1.05rem;
    }

    .session-stats {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
    }

    .stat-badge {
        padding: 12px 16px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .session-badge {
        font-size: 0.95rem;
        padding: 10px 16px;
    }

    .session-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }

    .action-btn {
        width: 100%;
        font-size: 1rem;
        padding: 12px 16px;
        min-height: 48px;
    }

    .chart-container {
        height: 280px;
    }

    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header h2 {
        font-size: 1.3rem;
        padding-right: 40px;
    }

    .modal-tab {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .score-value {
        font-size: 3rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .performance-badges {
        gap: 8px;
        padding: 12px;
    }

    .perf-badge {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .kpi-dashboard {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        padding: 20px;
    }

    .kpi-value {
        font-size: 2.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tabs, .period-filters, .filter-chips {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-container {
        height: 250px;
    }
}