/* ==========================================================================
   VERSIONE ALTERNATIVA 2 — "BLU AUTOREVOLEZZA & FIDUCIA" (DAYGAME MILANO)
   Psicologia: Blu Navy #1E3A8A (Calma, Fiducia) / Ambra Calda #D97706 (Azione)
   Geometria: Bordi netti e angolari 2px (come index.html) / Layout Fluido Largo
   Testi Autentici: Senza codici o etichette artificiali (No DOC_REF, No CAM_01)
   ========================================================================== */

:root {
    /* --- PALETTE PSICOLOGICA BLU & AMBRA --- */
    --bg-page: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-header: #1e3a8a;
    --card-bg: #ffffff;
    --card-elevated: #f1f5f9;
    
    --text-main: #0f172a;
    --text-dim: #334155;
    --text-muted: #64748b;
    
    /* Primario: Blu Notte & Blu Reale (Fiducia & Autorevolezza) */
    --primary: #1e40af;
    --primary-glow: rgba(30, 64, 175, 0.12);
    --primary-dark: #172554;
    --primary-hover: #172554;
    --primary-light-bg: #eff6ff;
    
    /* Accento Azione: Ambra Calda / Terracotta (Spinta ad agire, Focus) */
    --accent-amber: #d97706;
    --accent-amber-glow: rgba(217, 119, 6, 0.15);
    --accent-amber-light: #fef3c7;
    
    /* Successo e Rassicurazione */
    --success: #10b981;
    --success-light: #ecfdf5;
    
    /* Bordi netti e lineari & Superfici */
    --bg-surface: #f1f5f9;
    --border: #1e293b;
    --border-subtle: #cbd5e1;
    --border-bright: #94a3b8;
    --border-focus: #1e40af;
    
    --quote-bg: #f8fafc;
    --quote-border: #1e40af;
    --quote-text: #1e293b;
    
    --video-bg: #0f172a;
    --video-text: #ffffff;
    
    --top-bar-bg: #1e3a8a;
    --top-bar-border: #0f172a;
    --mobile-bar-bg: #ffffff;
    --sheet-bg: #ffffff;
    --sub-item-active-bg: #eff6ff;
    --input-bg: #ffffff;
    --shadow-card: none;

    /* Variabili di compatibilità tabelle & accenti aggiuntivi */
    --bg-card: var(--card-bg);
    --bg-card-secondary: var(--card-elevated);
    --border-color: var(--border-subtle);
    --accent-blue: var(--primary);
    --accent-cyan: #0284c7;
    --accent-purple: #7c3aed;

    /* Scalatura Font */
    --font-scale: 1;
    --font-base: 16px;
    --font-lead: 18px;
    --font-h1: 28px;
    --font-h2: 21px;

    /* Font Family */
    --font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Space Mono', 'Fira Code', Consolas, monospace;
}

/* --- TEMA SCURO (DARK MODE) --- */
[data-theme="dark"] {
    --bg-page: #0b0f19;
    --sidebar-bg: #111827;
    --sidebar-header: #0f172a;
    --card-bg: #111827;
    --card-elevated: #1f2937;
    --bg-surface: #1e293b;
    
    --text-main: #f8fafc;
    --text-dim: #cbd5e1;
    --text-muted: #94a3b8;
    
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.2);
    --primary-dark: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light-bg: #1e293b;
    
    --accent-amber: #f59e0b;
    --accent-amber-light: #292524;
    
    --border: #334155;
    --border-subtle: #1e293b;
    --border-bright: #475569;
    --border-focus: #60a5fa;
    
    --quote-bg: #161e2e;
    --quote-border: #3b82f6;
    --quote-text: #f8fafc;
    
    --video-bg: #030712;
    --video-text: #f8fafc;
    
    --top-bar-bg: #030712;
    --top-bar-border: #334155;
    --mobile-bar-bg: #111827;
    --sheet-bg: #111827;
    --sub-item-active-bg: #1e293b;
    --input-bg: #111827;
    --input-border: #334155;

    /* Variabili di compatibilità tabelle & accenti aggiuntivi Dark */
    --bg-card: var(--card-bg);
    --bg-card-secondary: var(--card-elevated);
    --border-color: var(--border);
    --accent-blue: var(--primary);
    --accent-cyan: #38bdf8;
    --accent-purple: #a78bfa;
}

/* --- SCALATURA FONT DINAMICA --- */
html[data-font-size="small"] {
    --font-scale: 0.9;
    --font-base: 14.5px;
    --font-lead: 16px;
    --font-h1: 25px;
    --font-h2: 19px;
}

html[data-font-size="normal"] {
    --font-scale: 1;
    --font-base: 16px;
    --font-lead: 18px;
    --font-h1: 28px;
    --font-h2: 21px;
}

html[data-font-size="large"] {
    --font-scale: 1.15;
    --font-base: 18.5px;
    --font-lead: 20.5px;
    --font-h1: 32px;
    --font-h2: 24px;
}

/* --- RESET & REGOLE GENERALI (ANGOLI NETTI / BORDI LINEARI) --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-radius: 2px; /* Raggio unico 2px netto e coerente ovunque */
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. DESKTOP SIDEBAR
   ========================================================================== */
.desktop-sidebar {
    width: 360px;
    background-color: var(--sidebar-bg);
    border-right: 1.5px solid var(--border);
    color: var(--text-dim);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 20px 18px;
    background: var(--sidebar-header);
    border-bottom: 1.5px solid var(--border);
    color: #ffffff;
}

.brand-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.brand-title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-subtitle {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    font-weight: 500;
}

/* Selettore Modalità di Lettura */
.sidebar-view-switcher {
    background: var(--card-elevated);
    border-bottom: 1.5px solid var(--border);
    padding: 6px;
    display: flex;
    gap: 6px;
}

.btn-view-mode {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 9px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

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

.btn-view-mode.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.sidebar-nav-list {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

/* Gruppo Segnalibri */
.favorites-sidebar-group {
    background: var(--accent-amber-light);
    border: 1.5px solid var(--accent-amber);
    padding: 10px 12px;
    margin-bottom: 10px;
    display: none;
}

.favorites-sidebar-group.has-items {
    display: block;
}

.favorites-group-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--accent-amber);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px dashed var(--accent-amber);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorites-list-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Moduli di navigazione */
.nav-module-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 14px;
    color: var(--text-dim);
    font-size: 15.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    gap: 8px;
}

.nav-module-item:hover {
    background: var(--card-elevated);
    border-color: var(--border-subtle);
    color: var(--text-main);
}

.nav-module-item.active {
    background: var(--primary-light-bg) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    border: 1.5px solid var(--primary) !important;
    border-left: 4px solid var(--primary) !important;
}

.item-left-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
}

.btn-star-inline {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    display: flex;
    align-items: center;
    font-size: 15px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 1px;
}

.btn-star-inline:hover,
.btn-star-inline.starred {
    color: var(--accent-amber);
}

/* Card Accordion per Moduli Sidebar (2, 3, 4, 5, 6, 7, 8, 9) */
.module-accordion-card,
.module-five-card,
.module-group-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    overflow: hidden;
    margin: 6px 0;
    transition: border-color 0.15s ease;
}

.module-accordion-card:hover,
.module-five-card:hover,
.module-group-card:hover {
    border-color: var(--border-bright);
}

.module-accordion-header,
.module-five-header,
.module-group-header {
    padding: 10px 14px;
    background: var(--card-elevated);
    color: var(--text-main);
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.module-accordion-header:hover,
.module-five-header:hover,
.module-group-header:hover {
    background: var(--bg-surface);
    color: var(--primary);
}

.header-left-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.header-left-title span:first-child {
    white-space: normal;
    line-height: 1.3;
    word-break: normal;
}

.accordion-chevron,
.phase-chevron {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-left: 6px;
}

.module-accordion-card.open .accordion-chevron,
.module-five-card.open .accordion-chevron,
.module-group-card.open .accordion-chevron,
.phase-block.open .phase-chevron {
    transform: rotate(180deg);
}

.accordion-sub-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--card-bg);
}

.module-accordion-card.open .accordion-sub-list,
.module-five-card.open .accordion-sub-list,
.module-group-card.open .accordion-sub-list {
    max-height: 3500px;
}

.badge-total-lessons {
    background: var(--primary);
    color: #ffffff;
    font-size: 11.5px;
    padding: 2px 7px;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 3px;
    flex-shrink: 0;
}

.phase-block {
    border-top: 1px solid var(--border-subtle);
}

.phase-header {
    padding: 9px 14px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.phase-header:hover {
    background: var(--card-elevated);
}

.phase-sub-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
    background: var(--card-bg);
}

.phase-block.open .phase-sub-list {
    max-height: 850px;
}

.sub-lesson-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 14px 8px 18px;
    font-size: 14.5px;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.12s ease;
    gap: 8px;
}

.sub-lesson-item:hover {
    background: var(--card-elevated);
    color: var(--primary);
}

.sub-lesson-item.active {
    background: var(--primary-light-bg) !important;
    color: var(--primary) !important;
    font-weight: 700;
    border-left: 3px solid var(--primary);
}

.sub-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.sub-lesson-item.active .sub-num {
    color: var(--primary);
}

/* ==========================================================================
   2. MAIN CONTENT AREA (LARGA, FLUIDA & ADATTABILE)
   ========================================================================== */
.main-wrapper {
    margin-left: 360px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 360px);
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stato Sidebar Nascosta (Focus / Full Width Mode) */
body.sidebar-collapsed .desktop-sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
    width: 100%;
}

/* Bottone Toggle Sidebar nella Top Bar */
.btn-toggle-sidebar {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    padding: 5px 11px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    user-select: none;
}

.btn-toggle-sidebar:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.btn-toggle-sidebar .toggle-icon {
    font-size: 14px;
    display: inline-block;
    transition: transform 0.2s ease;
}

/* Linguetta Fluttuante Laterale quando la sidebar è nascosta */
.btn-floating-sidebar-tab {
    position: fixed;
    top: 65px;
    left: 0;
    z-index: 95;
    background: var(--primary);
    color: #ffffff;
    border: 1.5px solid var(--border);
    border-left: none;
    padding: 8px 12px 8px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, background 0.15s ease;
    font-family: inherit;
    user-select: none;
}

.btn-floating-sidebar-tab:hover {
    background: var(--primary-hover);
    transform: translateX(4px);
}

body.sidebar-collapsed .btn-floating-sidebar-tab {
    display: flex;
}

/* Top bar sticky */
.top-demo-bar {
    background: var(--top-bar-bg);
    color: #ffffff;
    border-bottom: 1.5px solid var(--border);
    padding: 10px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    font-weight: 600;
}

.top-course-title {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-size-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px;
}

.btn-font-size {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s ease;
}

.btn-font-size:hover { color: #ffffff; }
.btn-font-size.active {
    background: #ffffff;
    color: var(--primary);
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Container Principale: FLUIDO & LARGO */
.content-container {
    max-width: 1550px;
    width: 100%;
    margin: 0 auto;
    padding: 36px 40px 80px;
}

/* Banner Intestazione Modalità Continua */
.continuous-header-bar {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-left: 6px solid var(--primary);
    padding: 24px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.continuous-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.continuous-header-bar h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-main);
    margin-bottom: 6px;
}

.continuous-header-bar p {
    font-size: 14.5px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.btn-print-manual {
    background: var(--primary);
    color: #ffffff;
    border: 1.5px solid var(--border);
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-print-manual:hover {
    background: var(--primary-dark);
}

/* ==========================================================================
   3. SCHEDE DEL CORSO (PULITE, ELEGANTI & SENZA TESTI SUPERFLUI)
   ========================================================================== */
.course-section-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    margin-bottom: 34px;
    scroll-margin-top: 75px;
    overflow: hidden;
}

body.mode-continuous .course-section-card { display: block; }
body.mode-continuous .continuous-header-bar { display: flex; }
body.mode-continuous .step-footer-nav { display: none; }

body.mode-step .course-section-card { display: none; }
body.mode-step .course-section-card.active { display: block; }
body.mode-step .continuous-header-bar { display: none; }
body.mode-step .step-footer-nav { display: flex; }

/* Testata di Capitolo Blu Navy (Opzione A) */
.card-top-header {
    background: var(--sidebar-header);
    color: #ffffff;
    padding: 20px 28px;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.card-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.card-badge-tag {
    display: inline-block;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.card-top-header h1, .card-top-header .card-main-title {
    font-size: var(--font-h1);
    font-weight: 800;
    color: #ffffff !important;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin: 0 !important;
}

.card-body-content {
    padding: 28px 32px 32px;
}

/* Pulsante preferiti nella testata blu */
.card-top-header .btn-fav-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    padding: 7px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.card-top-header .btn-fav-card:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: #ffffff;
    color: #ffffff;
}

.card-top-header .btn-fav-card.starred {
    background: var(--accent-amber);
    border-color: var(--accent-amber);
    color: #ffffff;
}

.course-section-card h1 {
    font-size: var(--font-h1);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 16px;
}

.course-section-card .lead {
    font-size: var(--font-lead);
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 22px;
}

.course-section-card h2 {
    font-size: var(--font-h2);
    font-weight: 700;
    color: var(--text-main);
    margin: 28px 0 14px 0;
    letter-spacing: -0.01em;
}

.course-section-card p {
    font-size: var(--font-base);
    color: var(--text-dim);
    margin-bottom: 16px;
    line-height: 1.65;
}

.course-section-card ul, .course-section-card ol {
    margin: 14px 0 20px 24px;
    color: var(--text-dim);
    font-size: var(--font-base);
    line-height: 1.65;
}

.course-section-card li {
    margin-bottom: 8px;
}

.check-list-custom {
    list-style: none !important;
    margin: 14px 0 20px 0 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-list-custom li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--card-elevated);
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    margin-bottom: 0;
}

.check-bullet-icon {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    flex-shrink: 0;
}

.flag-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    display: inline-block;
    margin: 0 6px;
}

.recap-box {
    background: var(--primary-light-bg);
    border: 1.5px solid var(--border);
    border-left: 6px solid var(--primary);
    padding: 20px 24px;
    margin: 28px 0;
}

.recap-box h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
}

/* Box Video / Embed YouTube Responsive */
.video-box {
    background: #0f172a;
    color: #ffffff;
    border: 1.5px solid var(--border);
    padding: 24px 28px;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.play-icon {
    font-size: 26px;
    color: var(--accent-amber);
    background: rgba(217, 119, 6, 0.15);
    border: 1.5px solid var(--accent-amber);
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    margin-bottom: 4px;
}

.video-box strong {
    font-size: 16px;
    color: #ffffff;
    font-weight: 700;
}

.video-wrapper {
    margin: 24px 0;
}

.video-caption-top {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-caption-bottom {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Rapporto 16:9 */
    height: 0;
    overflow: hidden;
    background: #000000;
    border: 1.5px solid var(--border);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* YouTube Facade (Click-to-Play Nativo) */
.video-container.yt-facade {
    cursor: pointer;
    background: #000000;
    user-select: none;
}
.video-container.yt-facade.is-playing {
    cursor: default;
}
.yt-facade-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease, filter 0.25s ease;
}
.video-container.yt-facade:hover .yt-facade-thumb {
    transform: scale(1.02);
    filter: brightness(1.06);
}
.yt-facade-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0, 0, 0.2, 1);
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    z-index: 2;
    pointer-events: none;
}
.video-container.yt-facade:hover .yt-facade-play {
    transform: translate(-50%, -50%) scale(1.12);
}
.yt-facade-play svg path.bg {
    fill: #212121;
    fill-opacity: 0.82;
    transition: fill 0.2s ease, fill-opacity 0.2s ease;
}
.video-container.yt-facade:hover .yt-facade-play svg path.bg {
    fill: #ff0000;
    fill-opacity: 1;
}
.yt-facade-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.78);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    z-index: 2;
    pointer-events: none;
}

/* Highlight box rassicurante */
.highlight-box {
    background: var(--primary-light-bg);
    border: 1.5px solid var(--border);
    border-left: 5px solid var(--primary);
    padding: 18px 22px;
    margin: 22px 0;
    color: var(--text-main);
    font-size: var(--font-base);
    line-height: 1.6;
}

.highlight-box strong {
    color: var(--primary);
}

/* Quote box */
.quote-box {
    background: var(--quote-bg);
    border: 1.5px solid var(--border);
    border-left: 5px solid var(--quote-border);
    padding: 18px 22px;
    margin: 20px 0;
    font-size: var(--font-base);
    color: var(--quote-text);
    line-height: 1.6;
}

/* Griglia Step & Livelli */
.steps-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 18px 0;
}

.step-row {
    background: var(--card-elevated);
    border: 1.5px solid var(--border);
    padding: 14px 18px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    font-size: var(--font-base);
    color: var(--text-main);
}

.step-index {
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    margin-top: 2px;
    border: 1px solid var(--border);
}

/* Tabella a Matrice Comparativa (Modulo 1) */
.custom-matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px;
    font-size: 14px;
}
.custom-matrix-table th {
    background: var(--card-elevated);
    color: var(--text-main);
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}
.custom-matrix-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
    color: var(--text-main);
}
.custom-matrix-table tr:hover td {
    background: var(--primary-glow);
}
.sim-box {
    background: var(--card-elevated);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 14px;
}
.pill-missing {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 700;
    margin-left: 4px;
}

/* Footer Navigazione Step */
.step-footer-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 36px;
    padding-top: 22px;
    border-top: 1.5px solid var(--border);
}

.btn-footer {
    padding: 10px 22px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1.5px solid var(--border);
}

.btn-footer.prev {
    background: var(--card-elevated);
    color: var(--text-main);
}

.btn-footer.prev:hover:not(:disabled) {
    background: var(--border-subtle);
}

.btn-footer.next {
    background: var(--primary);
    color: #ffffff;
}

.btn-footer.next:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-footer:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Floating Back To Top */
.btn-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: #ffffff;
    border: 1.5px solid #ffffff;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.btn-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.btn-back-to-top:hover {
    background: var(--primary-dark);
}

/* ==========================================================================
   4. MOBILE NAVIGATION & BOTTOM SHEET
   ========================================================================== */
.mobile-bottom-bar { display: none; }
.mobile-bottom-sheet { display: none; }
.sheet-backdrop { display: none; }

@media (max-width: 900px) {
    .desktop-sidebar,
    .btn-toggle-sidebar,
    .btn-floating-sidebar-tab { display: none !important; }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
        padding-bottom: 90px;
    }

    .top-demo-bar {
        padding: 10px 16px;
    }

    .content-container {
        padding: 18px 16px 70px;
    }

    .course-section-card {
        margin-bottom: 22px;
    }

    .card-top-header {
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .card-body-content {
        padding: 20px 16px 24px;
    }

    .card-top-header .btn-fav-card {
        align-self: flex-start;
    }

    .step-footer-nav { display: none; }

    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        background: var(--mobile-bar-bg);
        border-top: 1.5px solid var(--border);
        align-items: center;
        justify-content: space-between;
        padding: 0 14px;
        z-index: 1000;
    }

    .btn-mobile-arrow {
        background: var(--card-elevated);
        border: 1.5px solid var(--border);
        color: var(--text-main);
        padding: 8px 14px;
        font-weight: 700;
        font-size: 12px;
        cursor: pointer;
        transition: opacity 0.15s ease, background 0.15s ease;
    }

    .btn-mobile-arrow:disabled,
    .btn-mobile-arrow.disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
    }

    .btn-mobile-trigger {
        background: var(--primary);
        color: #ffffff;
        border: 1.5px solid var(--border);
        padding: 10px 18px;
        font-weight: 700;
        font-size: 13px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .sheet-backdrop {
        display: block;
        position: fixed;
        top: 0; left: 0;
        width: 100vw; height: 100vh;
        background: rgba(15, 23, 42, 0.6);
        z-index: 1100;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    .sheet-backdrop.active { opacity: 1; visibility: visible; }

    .mobile-bottom-sheet {
        display: flex;
        position: fixed;
        bottom: 0; left: 0;
        width: 100%;
        max-height: 85vh;
        background: var(--sheet-bg);
        border-top: 2px solid var(--border);
        flex-direction: column;
        z-index: 1200;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mobile-bottom-sheet.open { transform: translateY(0); }

    .sheet-drag-handle {
        width: 36px;
        height: 4px;
        background: var(--border-subtle);
        border-radius: 4px;
        margin: 10px auto 4px;
    }

    .sheet-header-bar {
        padding: 12px 18px;
        border-bottom: 1.5px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sheet-header-bar h3 {
        font-size: 14px;
        font-weight: 800;
        color: var(--primary);
    }

    .btn-close-sheet {
        background: var(--card-elevated);
        border: 1.5px solid var(--border);
        color: var(--text-main);
        font-size: 12px;
        font-weight: 700;
        padding: 4px 10px;
        cursor: pointer;
    }

    .sheet-search-wrap {
        padding: 10px 18px;
        background: var(--card-elevated);
        border-bottom: 1.5px solid var(--border);
    }

    .sheet-search-input {
        width: 100%;
        background: var(--input-bg);
        border: 1.5px solid var(--input-border);
        padding: 8px 12px;
        font-size: 13px;
        color: var(--text-main);
        outline: none;
    }

    .sheet-content-scroll {
        padding: 12px 18px 40px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .sheet-item-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 10px 14px;
        background: var(--card-bg);
        border: 1px solid var(--border-subtle);
        font-size: 13px;
        font-weight: 600;
        color: var(--text-main);
        cursor: pointer;
        line-height: 1.35;
        white-space: normal;
        word-break: normal;
        gap: 8px;
    }

    .sheet-item-row.active {
        background: var(--primary-light-bg);
        border-color: var(--primary);
        color: var(--primary);
        font-weight: 700;
    }
}

/* Stili Interattivi Quiz & FAQ Accordion */
.faq-quiz-item {
    background: var(--card-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-quiz-item[open] {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.quiz-question-title {
    padding: 14px 18px;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text-main);
    cursor: pointer;
    background: var(--card-bg);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.quiz-question-title::-webkit-details-marker {
    display: none;
}

.quiz-question-title::after {
    content: "▼";
    font-size: 0.85rem;
    color: var(--primary);
    transition: transform 0.2s ease;
}

.faq-quiz-item[open] .quiz-question-title::after {
    transform: rotate(180deg);
}

.quiz-answer-body {
    padding: 16px 18px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-dim);
    font-size: var(--font-base);
    line-height: 1.65;
}

.quiz-answer-body strong {
    color: var(--text-main);
}

/* ==========================================================================
   STILI DEDICATI INTEGRAZIONI AVANZATE (INFIELDS, DELIVERY & BLUEPRINT)
   ========================================================================== */

/* Callout di Revisione per l'Autore */
.author-revision-box {
    background: #fffbeb;
    border: 2px dashed #d97706;
    border-left: 6px solid #d97706;
    padding: 18px 22px;
    margin: 24px 0;
    color: #92400e;
    font-size: var(--font-base);
    line-height: 1.6;
}
[data-theme="dark"] .author-revision-box {
    background: #2a1b0c;
    border-color: #f59e0b;
    color: #fde68a;
}
.author-revision-box .revision-title {
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Scheda Profilo Target (Infields) */
.target-profile-card {
    background: var(--card-elevated);
    border: 1.5px solid var(--border);
    padding: 18px 20px;
    margin: 20px 0;
}
.target-profile-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.target-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px 18px;
    font-size: 14px;
}
.profile-item {
    color: var(--text-dim);
}
.profile-item strong {
    color: var(--text-main);
}

/* Box Dialogo Trascrizione Infield */
.dialogue-box {
    background: var(--card-bg);
    border: 1.5px solid var(--border-subtle);
    border-left: 4px solid var(--accent-amber);
    padding: 18px 20px;
    margin: 22px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dialogue-line {
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
@media (min-width: 640px) {
    .dialogue-line {
        flex-direction: row;
        align-items: baseline;
        gap: 10px;
    }
}
.speaker-tag {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 2px;
    white-space: nowrap;
    flex-shrink: 0;
}
.speaker-instructor {
    background: var(--primary-light-bg);
    color: var(--primary);
    border: 1px solid var(--primary);
}
.speaker-target {
    background: var(--accent-amber-light);
    color: var(--accent-amber);
    border: 1px solid var(--accent-amber);
}
.dialogue-text {
    color: var(--text-dim);
}
.dialogue-text em {
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Pillole Tag & Tecniche */
.tag-pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 16px 0;
}
.tag-pill {
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    background: var(--primary-light-bg);
    color: var(--primary);
    border: 1px solid var(--border-subtle);
    letter-spacing: 0.02em;
}

/* Box Drill / Esercizio Pratico */
.drill-box {
    background: var(--card-elevated);
    border: 1.5px solid var(--border);
    border-left: 5px solid var(--accent-amber);
    padding: 20px 22px;
    margin: 24px 0;
}
.drill-box h4 {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-amber);
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stili di stampa */
@media print {
    .desktop-sidebar, .top-demo-bar, .mobile-bottom-bar, .mobile-bottom-sheet, .sheet-backdrop, .btn-back-to-top, .btn-fav-card, .btn-star-inline, .step-footer-nav, .sidebar-view-switcher, .btn-print-manual, .btn-floating-sidebar-tab, .btn-toggle-sidebar {
        display: none !important;
    }
    body { background: #ffffff !important; color: #000000 !important; font-size: 11pt !important; display: block !important; }
    .main-wrapper { margin-left: 0 !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; }
    .content-container { padding: 0 !important; max-width: 100% !important; }
    .course-section-card { display: block !important; box-shadow: none !important; border: 1.5px solid #000000 !important; padding: 20px !important; margin-bottom: 24px !important; page-break-inside: avoid; }
}
