/* =========================================
           1. RESET & VARIABLES
           ========================================= */
        :root {
            /* Palette Colori Core */
            --primary: #06B6D4;
            /* Ciano */
            --primary-dark: #0891B2;
            --secondary: #3B82F6;
            /* Blu Royal */

            --accent-purple: #9b59b6;
            --accent-red: #ff4757;
            --accent-orange: #ffa500;
            --accent-green: #00C853;

            --gradient-primary: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);

            /* Dimensioni & Spazi */
            --container-width: 1200px;
            --header-height: 70px;
            --radius-sm: 8px;
            --radius-md: 16px;
            --radius-pill: 50px;

            /* Fonts */
            --font-main: 'Outfit', sans-serif;
            --font-mono: 'JetBrains Mono', monospace;
        }

        /* --- THEME: LIGHT --- */
        [data-theme="light"] {
            --bg-body: #F0F4F8;
            --bg-surface: #FFFFFF;
            --bg-card: #FFFFFF;
            --bg-card-hover: #F8FAFC;
            --bg-accent: #E0F2F1;

            --text-main: #1E293B;
            /* Testo scuro per sfondo chiaro */
            --text-sub: #64748B;
            /* Grigio medio per sfondo chiaro */

            --border: rgba(148, 163, 184, 0.2);
            --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.08);
        }

        /* --- THEME: DARK --- */
        [data-theme="dark"] {
            --bg-body: #0F172A;
            --bg-surface: #1E293B;
            --bg-card: #1E293B;
            --bg-card-hover: #334155;
            --bg-accent: rgba(6, 182, 212, 0.1);

            --text-main: #F8FAFC;
            /* Testo chiaro per sfondo scuro */
            --text-sub: #CBD5E1;
            /* Grigio chiaro per sfondo scuro */

            --border: rgba(255, 255, 255, 0.1);
            --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.3);
        }

        /* 
           FIX CRITICO: Componenti "Always Dark"
           Questi selettori forzano le variabili di testo al bianco 
           anche se siamo in Light Mode. 
        */
        .main-header,
        .section-hero,
        .status-bar,
        .always-dark,
        .mobile-menu {
            --text-main: #F8FAFC;
            --text-sub: #94A3B8;
            --border: rgba(255, 255, 255, 0.1);
            --bg-card: rgba(255, 255, 255, 0.03);
            /* Card trasparenti su sfondi scuri */
            color: var(--text-main);
        }

        /* Reset Base */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        html {
            scroll-behavior: smooth;
        }

        body {
            font-family: var(--font-main);
            background-color: var(--bg-body);
            color: var(--text-main);
            line-height: 1.6;
            transition: background 0.3s, color 0.3s;
            padding-bottom: 80px;
            /* Spazio per status bar */
            overflow-x: hidden;
        }

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

        ul {
            list-style: none;
        }

        img,
        svg {
            display: block;
            max-width: 100%;
        }

        /* Typography */
        h1,
        h2,
        h3,
        h4 {
            font-weight: 700;
            line-height: 1.2;
            margin-bottom: 1rem;
            color: var(--text-main);
        }

        h1 {
            font-size: clamp(2.5rem, 5vw, 3.5rem);
            letter-spacing: -0.02em;
        }

        h2 {
            font-size: clamp(2rem, 4vw, 2.8rem);
        }

        h3 {
            font-size: 1.5rem;
        }

        p {
            margin-bottom: 1.5rem;
            color: var(--text-sub);
        }

        .text-primary {
            color: var(--primary);
        }

        .text-accent {
            background: var(--gradient-primary);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .text-center {
            text-align: center;
        }

        /* =========================================
           2. LAYOUT & GRIDS
           ========================================= */
        .container {
            width: 90%;
            max-width: var(--container-width);
            margin: 0 auto;
            padding: 0 15px;
        }

        .section {
            padding: 80px 0;
        }

        .section-alt {
            background-color: var(--bg-surface);
        }

        /* Grid System Mobile First */
        .grid-2,
        .grid-3,
        .grid-4 {
            display: grid;
            gap: 30px;
            width: 100%;
            grid-template-columns: 1fr;
            /* Default Mobile */
        }

        /* Grid 4: 2 colonne su mobile (piccole card) */
        .grid-4 {
            grid-template-columns: 1fr 1fr;
        }

        @media (max-width: 480px) {
            .grid-4 {
                grid-template-columns: 1fr;
            }
        }

        /* Tablet & Desktop */
        @media (min-width: 768px) {
            .grid-2 {
                grid-template-columns: 1fr 1fr;
            }

            .grid-3 {
                grid-template-columns: repeat(3, 1fr);
            }

            .grid-4 {
                grid-template-columns: repeat(4, 1fr);
            }
        }

        .centered-header {
            max-width: 800px;
            margin: 0 auto 50px auto;
            text-align: center;
        }

        /* =========================================
           3. COMPONENTS
           ========================================= */

        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 14px 28px;
            font-weight: 600;
            border-radius: var(--radius-pill);
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 1rem;
            gap: 8px;
            border: 2px solid transparent;
        }

        .btn-primary {
            background: var(--gradient-primary);
            color: #fff;
            box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
        }

        .btn-secondary {
            background: transparent;
            border-color: var(--border);
            color: var(--text-main);
        }

        .btn-secondary:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .btn-ghost {
            background: rgba(255, 255, 255, 0.05);
            color: #fff;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid transparent;
        }

        .btn-ghost:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        /* Badge */
        .badge {
            display: inline-block;
            padding: 6px 12px;
            border-radius: var(--radius-pill);
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 1px;
            text-transform: uppercase;
            border: 1px solid currentColor;
            margin-bottom: 15px;
        }

        /* Cards */
        .card {
            background-color: var(--bg-card);
            padding: 30px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            transition: transform 0.3s, box-shadow 0.3s;
            height: 100%;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-hover);
            border-color: var(--primary);
        }

        /* FIX ICONE CENTRATE */
        .card-icon {
            font-size: 2rem;
            margin: 0 auto 20px auto;
            /* Centrato orizzontalmente */
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: var(--radius-sm);
            background: var(--bg-accent);
        }

        /* Tech/Terminal Look */
        .terminal-box {
            background: #0a0a0a;
            color: #d4d4d4;
            padding: 20px;
            border-radius: var(--radius-sm);
            font-family: var(--font-mono);
            font-size: 0.9rem;
            border: 1px solid #333;
            margin: 15px 0;
            overflow-x: auto;
        }

        .terminal-box .cmd {
            color: var(--accent-green);
        }

        .terminal-box .val {
            color: var(--primary);
        }

        /* Accordion */
        details.waa-accordion {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            margin-bottom: 15px;
            overflow: hidden;
        }

        details.waa-accordion[open] {
            border-color: var(--primary);
        }

        summary.waa-summary {
            padding: 20px;
            cursor: pointer;
            font-weight: 600;
            color: var(--text-main);
            list-style: none;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        summary.waa-summary::-webkit-details-marker {
            display: none;
        }

        summary.waa-summary::after {
            content: '+';
            font-size: 1.5rem;
            color: var(--text-sub);
        }

        details[open] summary.waa-summary::after {
            content: '-';
            color: var(--primary);
        }

        .accordion-content {
            padding: 0 20px 20px 20px;
            color: var(--text-sub);
            border-top: 1px solid var(--border);
            padding-top: 20px;
        }

        /* Table */
        .table-wrapper {
            overflow-x: auto;
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
        }

        table.waa-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px;
        }

        th,
        td {
            padding: 18px;
            text-align: left;
            border-bottom: 1px solid var(--border);
            color: var(--text-main);
        }

        th {
            background: var(--bg-surface);
            font-weight: 700;
        }

        tr:last-child td {
            border-bottom: none;
        }

        /* =========================================
           4. SPECIAL SECTIONS
           ========================================= */

        /* Header */
        .main-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            height: var(--header-height);
            background: rgba(15, 23, 42, 0.9);
            /* Sempre scuro */
            backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            /* Variabili testo gestite da blocco "Always Dark" sopra */
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .nav-links {
            display: none;
            gap: 20px;
        }

        .nav-links a {
            color: var(--text-sub);
            font-weight: 500;
        }

        .nav-links a:hover {
            color: #fff;
        }

        /* Sidebar Left (Desktop) */
        .sidebar-left {
            position: fixed;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 900;
            display: none;
            flex-direction: column;
            gap: 10px;
        }

        .sidebar-item {
            background: rgba(15, 23, 42, 0.8);
            padding: 10px;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #94A3B8;
            display: block;
            transition: 0.2s;
        }

        .sidebar-item:hover {
            color: var(--primary);
            transform: scale(1.1);
        }

        /* Hero (Always Dark) */
        .section-hero {
            padding-top: 140px;
            padding-bottom: 80px;
            min-height: 80vh;
            display: flex;
            align-items: center;
            text-align: center;
            background: #020617;
            /* Sempre scuro */
            position: relative;
            overflow: hidden;
            /* Variabili testo gestite da blocco "Always Dark" sopra */
        }

        .hero-bg {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.15) 0%, transparent 60%);
            z-index: 0;
        }

        .hero-content {
            position: relative;
            z-index: 1;
            max-width: 900px;
            margin: 0 auto;
        }

        /* Always Dark Section Helper */
        .always-dark {
            background: #020617 !important;
            /* Variabili testo gestite da blocco "Always Dark" sopra */
        }

        /* Status Bar (Sticky Bottom) */
        .status-bar {
            position: fixed;
            bottom: 0;
            width: 100%;
            height: 60px;
            background: rgba(15, 23, 42, 0.95);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            z-index: 999;
            display: flex;
            justify-content: center;
            align-items: center;
            /* Variabili testo gestite da blocco "Always Dark" sopra */
        }

        .status-content {
            display: flex;
            gap: 30px;
            overflow-x: auto;
            padding: 0 20px;
            white-space: nowrap;
        }

        .status-pill {
            font-family: var(--font-mono);
            font-size: 0.8rem;
            padding: 4px 10px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            color: #fff;
        }

        /* Footer */
        footer {
            margin-top: 60px;
            border-top: 1px solid var(--border);
            padding: 60px 0 40px;
        }

        /* Status bar: pulsante Audit (si aggiunge ai pill esistenti) */
        .status-cta {
            background: var(--primary);
            color: #04202a;
            font-weight: 700;
            text-decoration: none;
            white-space: nowrap;
            transition: filter 0.2s, transform 0.2s;
        }

        .status-cta:hover {
            filter: brightness(1.1);
            transform: translateY(-1px);
        }

       
        /* Mobile Menu */
        .mobile-menu {
            position: fixed;
            inset: 0;
            background: #0F172A;
            z-index: 998;
            transform: translateX(100%);
            transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 30px;
        }

        .mobile-menu.active {
            transform: translateX(0);
        }

        .mobile-menu a {
            font-size: 1.5rem;
            font-weight: 700;
            color: #fff;
        }

        .menu-toggle {
            display: flex;
            flex-direction: column;
            gap: 5px;
            background: none;
            border: none;
            z-index: 1001;
            cursor: pointer;
        }

        .menu-toggle span {
            width: 25px;
            height: 2px;
            background: #fff;
            transition: 0.3s;
        }

        /* Media Queries Specifiche */
        @media (min-width: 992px) {
            .nav-links {
                display: flex;
            }

            .menu-toggle {
                display: none;
            }

            .sidebar-left {
                display: flex;
            }
        }

/* =========================================
CONSOLE & TOC STYLES (Update)
========================================= */

        /* Layout Principale */
        .console-grid {
            display: grid;
            gap: 30px;
            grid-template-columns: 1fr;
            /* Mobile: 1 colonna */
        }

.nav-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
}

@media (max-width: 768px) {
.nav-grid {
grid-template-columns: repeat(2, 1fr);
}
}

@media (max-width: 270px) {
.nav-grid {
grid-template-columns: 1fr;
}
}


        /* Stile bottoni navigazione */
        .btn-ghost-nav {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 20px;
            /* Padding leggermente aumentato per 4 card */
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            transition: 0.2s;
            height: 100%;
        }

        .btn-ghost-nav:hover {
            border-color: var(--primary);
            transform: translateY(-3px);
            box-shadow: var(--shadow-hover);
        }

        .btn-ghost-nav .emoji {
            font-size: 2rem;
            margin-bottom: 10px;
            display: block;
        }

        .btn-ghost-nav small {
            display: block;
            font-size: 0.8rem;
            color: var(--text-sub);
            margin-top: 5px;
            line-height: 1.3;
        }

        .btn-ghost-nav strong {
            color: var(--text-main);
            font-size: 1rem;
        }

        .active-nav {
            border-color: var(--primary);
            box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
        }

        /* --- LOGICA ACCORDION TOC (Mobile First) --- */
        .toc-wrapper {
            position: relative;
        }

        .toc-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            padding-bottom: 5px;
        }

        /* Contenuto nascosto su mobile */
        .toc-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease-out;
        }

        /* Stile Lista Indice */
        .toc-list {
            list-style: none;
            padding: 0;
            margin-top: 10px;
            border-top: 1px solid var(--border);
            padding-top: 10px;
        }

        .toc-list li {
            margin-bottom: 6px;
        }

        .toc-list a {
            font-size: 0.9rem;
            color: var(--text-sub);
            display: block;
            padding: 4px 0;
            transition: 0.2s;
        }

        .toc-list a:hover {
            color: var(--primary);
            padding-left: 5px;
        }

        /* Freccia Mobile */
        .toc-arrow {
            transition: transform 0.3s;
            font-size: 0.8rem;
        }

        /* Apertura Mobile (via Checkbox) */
        #toc-engine:checked+.toc-box .toc-content {
            max-height: 600px;
            /* Aumentato per contenere l'indice lungo */
        }

        #toc-engine:checked+.toc-box .toc-arrow {
            transform: rotate(180deg);
        }

        /* --- DESKTOP OVERRIDES (992px+) --- */
        @media (min-width: 992px) {
            .console-grid {
                grid-template-columns: 2.5fr 1fr;
                /* Layout 2/3 - 1/3 */
            }

            /* Indice sempre visibile */
            .toc-content {
                max-height: none !important;
                overflow: visible;
            }

            /* Disabilita interazione header su desktop */
            .toc-header {
                pointer-events: none;
            }

            .toc-arrow {
                display: none;
            }

            /* STICKY EFFECT: L'indice ti segue */
            .toc-box {
                position: sticky;
                top: 90px;
                /* Offset dall'header */
            }
        }
/* =========================================
   LANGUAGE SWITCHER (header bandierina)
   ========================================= */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
    line-height: 1;
}

.lang-switch:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.lang-switch span {
    letter-spacing: 0.5px;
}

/* Su mobile nascondo il testo, resta solo la bandierina */
@media (max-width: 480px) {
    .lang-switch {
        padding: 8px 10px;
    }
    .lang-switch span {
        display: none;
    }
}

/* =========================================
   REVIEWS SECTION
   ========================================= */

.reviews-section .centered-header {
  margin-bottom: 50px;
}

/* --- MEDIA AGGREGATA --- */
.aggregate-rating {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 1rem;
  line-height: 1.2;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.08);
}

.aggregate-rating .rating-stars {
  color: var(--accent-orange);
  font-size: 1.25rem;
  letter-spacing: 2px;
  line-height: 1;
}

.aggregate-rating .rating-value strong {
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 700;
}

.aggregate-rating .rating-count strong {
  color: var(--text-main);
  font-weight: 700;
}

.aggregate-rating .rating-sep {
  color: var(--text-sub);
  opacity: 0.5;
}

/* --- LISTA RECENSIONI --- */
.reviews-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 992px) {
  .reviews-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
}

/* --- CARD RECENSIONE (accordion coerente con .waa-accordion) --- */
details.review {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

details.review:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

details.review[open] {
  border-color: var(--primary);
}

/* --- SUMMARY --- */
details.review > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 20px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--text-main);
  transition: 0.2s;
}

details.review > summary::-webkit-details-marker {
  display: none;
}

details.review > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -4px;
  border-radius: var(--radius-md);
}

/* Freccia (rotazione su apertura) */
details.review > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-right: 2px solid var(--text-sub);
  border-bottom: 2px solid var(--text-sub);
  transform: rotate(45deg);
  transition: transform 0.3s, border-color 0.3s;
  flex-shrink: 0;
}

details.review[open] > summary::after {
  transform: rotate(-135deg);
  border-color: var(--primary);
}

/* --- ELEMENTI DEL SUMMARY --- */
.review-author {
  color: var(--text-main);
  font-weight: 700;
}

.review-stars {
  color: var(--accent-orange);
  font-size: 0.95rem;
  letter-spacing: 2px;
  line-height: 1;
}

.review-date {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
}

/* --- TESTO RECENSIONE --- */
details.review > p {
  margin: 0 20px 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- MOBILE --- */
@media (max-width: 480px) {
  .aggregate-rating {
    padding: 12px 18px;
    gap: 4px 8px;
    font-size: 0.9rem;
  }

  .aggregate-rating .rating-stars {
    width: 100%;
    margin-bottom: 2px;
  }

  .aggregate-rating .rating-sep {
    display: none;
  }

  details.review > summary {
    padding: 16px;
  }

  details.review > p {
    margin: 0 16px 16px;
  }

  .review-date {
    width: 100%;
    margin-left: 0;
  }
}



/* =========================================
   COOKIE BANNER (GDPR) — FIXED
   ========================================= */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000; /* sopra header (1000), status bar (999), mobile menu (998) */
    background: #1E293B;
    color: #F8FAFC;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
    padding: 20px 0;
    transform: translateY(120%);
    transition: transform 0.35s ease;
    pointer-events: none; /* non blocca click finché non è visibile */
}

.cookie-banner.visible {
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-banner-inner {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}

.cookie-banner-inner p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #CBD5E1;
}

.cookie-banner-inner p a {
    color: var(--primary);
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-self: flex-end;
    width: 100%;
    justify-content: flex-end;
}

.cookie-actions .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Desktop: testo a sinistra, bottoni a destra sulla stessa riga */
@media (min-width: 768px) {
    .cookie-banner-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 30px;
    }
    .cookie-banner-inner p {
        flex: 1;
    }
    .cookie-actions {
        width: auto;
        flex-shrink: 0;
        align-self: center;
    }
}