/* --- STILI SPECIFICI DASHBOARD (Responsive Completo) --- */

body {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
}

/* --- 1. SIDEBAR LATERALE (Desktop) --- */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
    border-right: 1px solid rgba(255,255,255,0.1);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Impedisce alla sidebar di schiacciarsi */
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}

.sidebar-header {
    margin-bottom: 40px;
    padding-left: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-dash {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #FFFFFF;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

/* Icona Hamburger (Nascosta su Desktop) */
.mobile-menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: #FFFFFF;
    cursor: pointer;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.menu-item {
    padding: 12px 15px;
    border-radius: 12px;
    color: #94A3B8;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    font-size: 0.95rem;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    transform: translateX(5px);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(6, 182, 212, 0.1));
    color: #FFFFFF;
    border-left: 4px solid #0EA5E9;
}

.menu-item i { width: 24px; text-align: center; font-size: 1.1rem; }

.logout-btn {
    margin-top: auto; /* Spinge in fondo */
    color: #F87171;
}
.logout-btn:hover { background: rgba(239, 68, 68, 0.1); color: #EF4444; }

/* --- 2. AREA CONTENUTO PRINCIPALE --- */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto; /* Scrolla solo questa parte */
    position: relative;
    width: 100%;
}

/* Header della pagina */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid rgba(14, 165, 233, 0.1);
    flex-wrap: wrap;
    gap: 20px;
}

.welcome-text h2 { 
    font-size: 2rem; 
    color: var(--dark); 
    margin-bottom: 8px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.welcome-text p { 
    color: #64748B; 
    font-size: 0.95rem;
}

/* Card di Input (Il Form) */
.control-panel {
    background: white;
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Griglia flessibile */
    gap: 25px;
    margin-bottom: 30px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--dark);
    outline: none;
    transition: 0.3s;
    background: #F8FAFC;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* --- 3. AREA RISULTATI --- */
.result-container {
    background: white;
    border-radius: 24px;
    min-height: 200px;
    padding: 40px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.result-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #334155;
    white-space: pre-wrap;
}

/* Spinner */
.loading-state {
    text-align: center;
    padding: 40px;
    display: none;
}
.spinner {
    width: 50px; height: 50px;
    border: 5px solid #E0E7FF; border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- STATISTICHE & DOCUMENTI --- */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.stat-card-dash {
    background: white; padding: 25px; border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.05);
    display: flex; align-items: center; gap: 20px;
}
.stat-icon-dash {
    width: 50px; height: 50px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.stat-icon-dash.blue { background: #EEF2FF; color: var(--primary); }
.stat-icon-dash.green { background: #DCFCE7; color: #10B981; }
.stat-icon-dash.orange { background: #FEF3C7; color: #F59E0B; }

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.doc-card {
    background: white; border-radius: 16px; padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05);
    transition: 0.3s; display: flex; flex-direction: column;
}
.doc-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(99, 102, 241, 0.1); border-color: var(--primary); }

/* --- MODALE --- */
.doc-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px);
    z-index: 2000; opacity: 0; transition: opacity 0.3s ease;
}
.doc-modal.active { display: flex; align-items: center; justify-content: center; opacity: 1; }
.doc-modal-content {
    background: white; border-radius: 20px; width: 90%; max-width: 800px; max-height: 85vh;
    display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.doc-modal-header { padding: 20px 30px; border-bottom: 1px solid #E2E8F0; display: flex; justify-content: space-between; align-items: center; }
.doc-close-btn { background: #F1F5F9; border: none; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.doc-modal-body { padding: 30px; overflow-y: auto; flex: 1; }
.doc-modal-footer { padding: 20px 30px; border-top: 1px solid #E2E8F0; display: flex; justify-content: flex-end; gap: 10px; }

/* --- FILTRI --- */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.875rem;
    color: #64748B;
    font-weight: 500;
}

/* --- GRIGLIA DOCUMENTI --- */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.doc-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.doc-icon {
    width: 40px;
    height: 40px;
    background: #EEF2FF;
    border-radius: 8px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.doc-date {
    font-size: 0.8rem;
    color: #94A3B8;
}

.doc-title {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
    font-size: 1.1rem;
    line-height: 1.4;
}

.doc-meta {
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Badges */
.badge-sub { background: #F1F5F9; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; color: #475569; }
.badge-success { background: #DCFCE7; color: #16A34A; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.badge-error { background: #FEE2E2; color: #DC2626; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.doc-info {
    font-size: 0.75rem;
    color: #94A3B8;
    margin: 10px 0;
    line-height: 1.5;
}

.doc-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
}

/* Messaggio vuoto */
.empty-state {
    text-align: center;
    padding: 50px;
    color: #64748B;
    background: white;
    border-radius: 16px;
    border: 1px dashed #CBD5E1;
}

/* --- MODALE --- */
.doc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.doc-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.doc-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.doc-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.doc-close-btn {
    background: #F1F5F9;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    color: #64748B;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-close-btn:hover { background: #E2E8F0; color: var(--dark); }

.doc-modal-body {
    padding: 25px 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-meta-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #E2E8F0;
}

.modal-text-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #334155;
    font-size: 1rem;
}

.doc-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #E2E8F0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- GRIGLIA CARD PRINCIPALI --- */
.stats-overview {
    display: grid;
    /* Grid responsive: adatta automaticamente le colonne */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card-dash {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card-dash:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.1);
}

/* Icone colorate */
.stat-icon-dash {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.stat-icon-dash.blue { background: #EEF2FF; color: var(--primary); }
.stat-icon-dash.green { background: #DCFCE7; color: #10B981; }
.stat-icon-dash.orange { background: #FEF3C7; color: #F59E0B; }

/* Testo Card */
.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    line-height: 1;
}

/* Adatta dimensione font se il numero è lungo */
.stat-info h3.text-long { font-size: 1.5rem; }

.stat-info p {
    margin: 5px 0 0 0;
    color: #64748B;
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- SEZIONE GRAFICO (BARRE) --- */
.chart-card {
    background: white;
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

.chart-card h3 {
    margin-bottom: 25px;
    color: var(--dark);
    font-size: 1.3rem;
}

.chart-row {
    margin-bottom: 20px;
}

.chart-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.chart-bar-bg {
    width: 100%;
    background: #F1F5F9;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #818CF8 100%);
    border-radius: 6px;
    transition: width 1s ease-out; /* Animazione caricamento */
    width: 0; /* Parte da 0 per animazione */
}

/* --- EMPTY STATE --- */
.empty-stats {
    text-align: center;
    padding: 40px;
    color: #94A3B8;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 600px) {
    .stats-overview {
        grid-template-columns: 1fr; /* Una colonna card */
        gap: 15px;
    }

    .stat-card-dash {
        padding: 20px;
    }

    .stat-icon-dash {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stat-info h3 {
        font-size: 1.8rem;
    }

    .chart-card {
        padding: 20px;
    }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .docs-grid {
        grid-template-columns: 1fr; /* Una colonna su mobile */
    }
    
    .doc-modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .doc-modal-header, .doc-modal-body, .doc-modal-footer {
        padding: 15px;
    }
    
    .btn-sm {
        padding: 10px; /* Bottoni più grandi per il touch */
    }
}

/* =========================================
   MEDIA QUERIES (RESPONSIVE OTTIMIZZATO)
   ========================================= */

/* Tablet e Mobile (sotto 992px) */
/* Tablet e Mobile (sotto 992px) */
@media (max-width: 992px) {
    body {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    /* Navbar fissa in alto */
    .sidebar { 
        width: 100%; 
        padding: 15px 20px; 
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        height: auto;
        max-height: 70px;
        overflow: visible; /* FIX: Deve essere visible per far vedere il menu che esce */
        z-index: 1001; 
        background: rgba(255, 255, 255, 0.98);
    }

    .sidebar-header {
        margin-bottom: 0;
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        /* FIX: Queste 3 righe portano il bottone SOPRA il menu aperto */
        position: relative; 
        z-index: 1002; 
        background: transparent; 
    }

    /* Mostra il pulsante Hamburger */
    .mobile-menu-toggle {
        display: block;
        cursor: pointer; /* Assicuriamoci che sia cliccabile */
    }

    /* Menu mobile come overlay */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: white;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 20px;
        transform: translateX(-100%);
        transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
        opacity: 0;
        /* FIX: Z-index inferiore all'header (1002) ma alto abbastanza da coprire il resto */
        z-index: 999; 
        padding: 80px 20px 20px 20px; /* Spazio in alto per non coprire il logo se fosse trasparente */
    }

    .nav-menu.active {
        transform: translateX(0);
        opacity: 1;
    }

    .menu-item {
        padding: 15px 25px;
        border-radius: 8px;
        width: 80%;
        text-align: center;
        font-size: 1.1rem;
    }

    .main-content {
        padding: 20px;
    }
}

/* Mobile Piccolo (sotto 576px) */
@media (max-width: 576px) {
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dash-header div:last-child {
        align-self: flex-end; /* Utente a destra */
    }

    .welcome-text h2 { font-size: 1.5rem; }

    .control-panel {
        padding: 20px;
    }

    .input-grid {
        grid-template-columns: 1fr; /* Una colonna forzata */
    }

    .btn {
        width: 100%; /* Bottoni a larghezza piena */
        display: block;
        text-align: center;
    }

    /* Adatta i modali */
    .doc-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    .doc-modal-body { padding: 20px; }
}

/* === STILI SKYPILOT AI - AIR TRAFFIC CONTROL === */

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.05), transparent);
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.stat-info h4 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    line-height: 1;
}

.stat-info p {
    font-size: 0.85rem;
    color: #64748B;
    margin: 8px 0 0 0;
    font-weight: 500;
}

/* Flights Section */
.flights-section {
    margin-bottom: 40px;
}

.flights-section h3 {
    padding: 15px 0;
    border-bottom: 2px solid rgba(14, 165, 233, 0.1);
}

.flights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.flight-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.flight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.flight-card:hover::before {
    transform: scaleY(1);
}

.flight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.15);
    border-color: var(--primary);
}

.flight-card.selected {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.2);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.02), rgba(6, 182, 212, 0.02));
}

.flight-card.selected::before {
    transform: scaleY(1);
}

.flight-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #E2E8F0;
}

.flight-status {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flight-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.flight-detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #475569;
    font-size: 0.95rem;
}

.flight-detail-item i {
    width: 20px;
    color: var(--primary);
}

.weather-badge {
    background: #F1F5F9;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-generate-ai {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-generate-ai::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-generate-ai:hover::before {
    left: 100%;
}

.btn-generate-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-generate-ai:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Announcements Section */
.announcements-section, .weather-section {
    margin-bottom: 40px;
}

.announcements-section h3, .weather-section h3 {
    padding: 15px 0;
    border-bottom: 2px solid rgba(14, 165, 233, 0.1);
}

.announcements-container, .weather-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 250px;
    margin-top: 20px;
    border: 1px solid rgba(14, 165, 233, 0.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state i {
    opacity: 0.5;
}

.announcement-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 50px 20px;
}

.announcement-loading p {
    color: var(--primary);
    font-weight: 500;
}

.announcement-card, .weather-analysis-card {
    animation: fadeIn 0.5s ease;
}

.announcement-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 2px solid #E2E8F0;
    margin-bottom: 25px;
}

.announcement-header i {
    font-size: 1.8rem;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(6, 182, 212, 0.1));
    padding: 15px;
    border-radius: 12px;
}

.announcement-header h4 {
    color: var(--dark);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
}

.announcement-content {
    line-height: 1.9;
    color: #334155;
    font-size: 1.05rem;
}

.announcement-content p {
    margin-bottom: 20px;
}

.announcement-content strong {
    color: var(--primary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(6, 182, 212, 0.05));
    border-left: 3px solid var(--primary);
}

.announcement-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #F1F5F9;
}

/* Weather Analysis */
.weather-risk-header {
    padding: 25px;
    border-radius: 12px 12px 0 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.weather-risk-header i {
    font-size: 2rem;
}

.weather-risk-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.weather-analysis-content {
    padding: 30px;
    background: white;
}

.weather-analysis-content h5 {
    color: var(--dark);
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.weather-text {
    background: linear-gradient(135deg, #F8FAFC, #F1F5F9);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    color: #475569;
    line-height: 1.7;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    margin: 15px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive per flights grid */
@media (max-width: 1024px) {
    .flights-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .flights-grid {
        grid-template-columns: 1fr;
    }
    
    .flight-card {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .announcement-actions {
        flex-direction: column;
    }
}

/* === STILI ANALISI RISCHI AI === */

/* Header con bottone aggiorna */
.risk-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.risk-header-controls h3 {
    margin: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.risk-update-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-update-time {
    font-size: 0.85rem;
    color: #64748B;
}

.btn-update-risks {
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-update-risks:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Container principale analisi */
.risk-analysis-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading state analisi */
.risk-loading {
    text-align: center;
    padding: 20px;
}

.risk-loading p {
    color: #64748B;
    margin-top: 10px;
}

/* Grid delle card rischio */
.risk-cards-grid {
    display: grid;
    gap: 15px;
}

/* Singola card rischio */
.risk-item-card {
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.risk-item-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Header della card rischio */
.risk-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.risk-flight-info strong {
    color: var(--dark);
    font-size: 1rem;
}

.risk-flight-destination {
    color: #64748B;
    font-size: 0.85rem;
    margin-left: 10px;
}

.risk-score-badge-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.risk-level-label {
    font-weight: 600;
}

.risk-score-badge {
    padding: 4px 10px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Progress bar rischio */
.risk-progress-bar {
    background: white;
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 8px;
}

.risk-progress-fill {
    height: 100%;
    transition: width 0.5s ease-out;
}

/* Dettaglio meteo */
.risk-weather-detail {
    font-size: 0.85rem;
    color: #64748B;
    padding: 8px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: start;
    gap: 8px;
}

.risk-weather-detail i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* Stili tabella voli */
#flightsTable td:nth-child(4) {
    white-space: nowrap;
}

/* Responsive tabella voli */
@media (max-width: 1200px) {
    #flightsTable {
        font-size: 0.9rem;
    }
    
    #flightsTable th,
    #flightsTable td {
        padding: 12px 8px !important;
    }
}

@media (max-width: 992px) {
    .flights-section > div {
        overflow-x: auto;
    }
    
    #flightsTable {
        min-width: 900px;
    }
    
    #flightsTable th,
    #flightsTable td {
        padding: 10px 6px !important;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    /* Nascondi la tabella su mobile e mostra card */
    #flightsTable {
        display: none;
    }
    
    #flightsTableBody {
        display: block;
    }
    
    #flightsTableBody tr {
        display: block;
        background: white;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border-left: 4px solid var(--primary);
    }
    
    #flightsTableBody td {
        display: block;
        padding: 8px 0 !important;
        border: none !important;
        text-align: left !important;
    }
    
    #flightsTableBody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--dark);
        display: block;
        margin-bottom: 5px;
        font-size: 0.85rem;
    }
    
    #flightsTableBody td:nth-child(8) {
        margin-top: 10px;
    }
    
    #flightsTableBody td:nth-child(8) button {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive analisi rischi */
@media (max-width: 768px) {
    .risk-header-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .risk-update-section {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-update-risks {
        flex: 1;
        justify-content: center;
    }
}