/* ==========================================================================
   Variables Globales & Typographie
   ========================================================================== */
:root {
    --font-title: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-body: 'Corbel', 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
    
    --color-primary: #00A896;      /* Turquoise principal */
    --color-secondary: #028090;    /* Turquoise foncé */
    --color-dark: #2F3E46;         /* Anthracite */
    --color-light: #F8F9FA;
    --color-white: #FFFFFF;
    --color-border: #E9ECEF;
    --color-juris: #E0F2F1;
    --color-enjeux: #FFF3CD;
}

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

body {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-dark);
    background-color: var(--color-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1, h2, h3, h4, .title-salient {
    font-family: var(--font-title);
    color: var(--color-primary);
    font-weight: 600;
}

/* ==========================================================================
   Header & Barre d'outils
   ========================================================================== */
.top-bar {
    background-color: var(--color-dark);
    color: var(--color-white);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.header-left { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
}

.header-titles h1 { 
    color: var(--color-primary); 
    font-size: 1.4rem; 
}

.header-titles .subtitle { 
    font-size: 0.85rem; 
    color: #ADB5BD; 
    font-style: italic; 
}

.controls { 
    display: flex; 
    gap: 0.8rem; 
}

.btn-control {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font-title);
    font-size: 0.95rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-control:hover { 
    background-color: var(--color-secondary); 
}

.btn-pdf { 
    background-color: #D97706; 
}

.btn-pdf:hover { 
    background-color: #B45309; 
}

/* ==========================================================================
   Layout Principal & Navigation
   ========================================================================== */
.main-container { 
    display: flex; 
    flex: 1; 
    height: calc(100vh - 65px); 
}

.sidebar {
    width: 290px;
    background-color: var(--color-white);
    border-right: 1px solid var(--color-border);
    padding: 1.2rem 1rem;
    overflow-y: auto;
}

.nav-section-title {
    font-family: var(--font-title);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-secondary);
    margin: 1.2rem 0 0.4rem 0;
    font-weight: bold;
}

.nav-highlight {
    color: #D97706;
    margin-top: 1.8rem;
}

.sidebar ul { 
    list-style: none; 
}

.nav-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-dark);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: var(--color-light);
    color: var(--color-primary);
}

.nav-btn.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    font-weight: bold;
}

/* ==========================================================================
   Zone de Contenu & Sections
   ========================================================================== */
.content-area {
    flex: 1;
    padding: 2.5rem 4rem;
    overflow-y: auto;
    background-color: var(--color-white);
}

.page-section { 
    display: none; 
    max-width: 950px; 
    margin: 0 auto; 
}

.page-section.active { 
    display: block; 
}

.page-section h2 {
    font-size: 2rem;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
}

/* Badges, Cartes & Encarts */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 3px;
    margin-bottom: 0.8rem;
}

.badge-concept { background-color: #E2E2E2; color: #333; }
.badge-juris { background-color: var(--color-primary); color: var(--color-white); }
.badge-enjeux { background-color: #D97706; color: var(--color-white); }

.intro-text { 
    font-size: 1.2rem; 
    margin-bottom: 1.2rem; 
}

.concept-box {
    background-color: #F0FDF4;
    border-left: 4px solid var(--color-primary);
    padding: 1.2rem;
    margin: 1.2rem 0;
    border-radius: 0 4px 4px 0;
}

.juris-card {
    background-color: var(--color-juris);
    border: 1px solid #B2DFDB;
    border-radius: 6px;
    padding: 1.4rem;
    margin: 1.5rem 0;
}

.juris-header h3 {
    color: var(--color-secondary);
    margin-bottom: 0.6rem;
    font-size: 1.3rem;
}

/* Grilles & Cartes */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.2rem 0; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin: 1.2rem 0; }

.card {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 1.2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Conteneurs Vidéos */
.video-card {
    background-color: #FAFAFA;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.2rem;
    margin: 1.5rem 0;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 4px;
    margin-top: 0.8rem;
    overflow: hidden;
}

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

/* ==========================================================================
   Gestion des Images & Modale Lightbox
   ========================================================================== */
.image-container {
    margin: 1.5rem 0;
    text-align: center;
    background-color: #FAFAFA;
    padding: 0.8rem;
    border: 1px dashed #CCC;
    border-radius: 4px;
}

.image-container img { 
    max-width: 100%; 
    height: auto; 
    border-radius: 4px; 
}

.caption { 
    display: block; 
    font-size: 0.85rem; 
    color: #6C757D; 
    margin-top: 0.4rem; 
    font-style: italic; 
}

.image-container.clickable-img {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-container.clickable-img:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

body.mode-images-off .image-container { 
    display: none !important; 
}

/* Style de la Fenêtre Modale (Lightbox) */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 40px;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.image-modal .modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 6px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
}

.image-modal .modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #FFFFFF;
    padding: 15px 0;
    font-family: var(--font-body);
    font-size: 1rem;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #F1F1F1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--color-primary);
}

/* ==========================================================================
   Frise Chronologique Interactive
   ========================================================================== */
.timeline-scene-filters {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin: 1.5rem 0 1rem 0;
    flex-wrap: wrap;
}

.scene-btn {
    background-color: var(--color-light);
    color: var(--color-dark);
    border: 1px solid var(--color-border);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scene-btn:hover { background-color: #E2E8F0; }

.scene-btn.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.timeline-legend-grid {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.legend-badge {
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    color: white;
}

.cat-pionniers { background-color: #00A896 !important; }
.cat-marche { background-color: #D97706 !important; }
.cat-lieux { background-color: #028090 !important; }
.cat-institutions { background-color: #4B5563 !important; }

.timeline-double {
    position: relative;
    padding-left: 35px;
    border-left: 3px solid var(--color-border);
    margin: 1.5rem 0;
}

.tl-item {
    position: relative;
    margin-bottom: 1.8rem;
    transition: all 0.3s ease;
}

.tl-item.hidden { display: none !important; }

.tl-marker {
    position: absolute;
    left: -44px;
    top: 15px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 3px solid var(--color-white);
    box-shadow: 0 0 0 2px var(--color-border);
}

.tl-card {
    background-color: #FAFAFA;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tl-card:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.tl-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.tl-year {
    font-family: var(--font-title);
    font-weight: bold;
    color: var(--color-secondary);
    font-size: 1.1rem;
}

.tl-flag {
    font-family: var(--font-title);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.15rem 0.5rem;
    background-color: #E5E7EB;
    color: #374151;
    border-radius: 3px;
}

/* ==========================================================================
   Filtres & Fallback pour Vidéos Bloquées
   ========================================================================== */
.video-filters {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin: 1.5rem 0 2rem 0;
    flex-wrap: wrap;
}

.video-filter-btn {
    background-color: var(--color-light);
    color: var(--color-dark);
    border: 1px solid var(--color-border);
    padding: 0.5rem 1.1rem;
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-filter-btn:hover {
    background-color: #E2E8F0;
}

.video-filter-btn.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.video-module-group.hidden {
    display: none !important;
}

.video-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #2F3E46 0%, #1A252C 100%);
    color: #FFFFFF;
    text-align: center;
    padding: 1.5rem;
    border-radius: 4px;
}

.video-fallback p {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    color: #E2E8F0;
}

.btn-yt-external {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #FF0000;
    color: #FFFFFF;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-yt-external:hover {
    background-color: #CC0000;
    transform: translateY(-1px);
}

/* ==========================================================================
   Menu Mobile & Support Impression
   ========================================================================== */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.burger-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active { display: block; }

@media screen and (max-width: 900px) {
    .burger-btn { display: flex; }
    .top-bar { padding: 0.8rem 1rem; }
    .header-titles h1 { font-size: 1.1rem; }
    .header-titles .subtitle { display: none; }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        width: 280px;
        padding-top: 4rem;
        background-color: var(--color-white);
    }

    .sidebar.open { transform: translateX(0); }
    .content-area { padding: 1.5rem 1rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    .timeline-double { padding-left: 20px; }
    .tl-marker { left: -29px; }
}

@media print {
    .sidebar, .controls, .video-card, .burger-btn, .sidebar-overlay, .timeline-scene-filters, .image-modal, .video-filters {
        display: none !important;
    }

    body {
        background-color: white !important;
        color: black !important;
        height: auto !important;
        overflow: visible !important;
    }

    .main-container { display: block !important; height: auto !important; }
    .content-area { padding: 0 !important; overflow: visible !important; }
    .page-section { display: block !important; max-width: 100% !important; margin-bottom: 25px !important; }
    .tl-item.hidden, .video-module-group.hidden { display: block !important; }
    .tl-card { border: 1px solid #DDD !important; background: white !important; }
}