/* ============================================================
   BDN VISION — Documentation Guide
   Design: Dark glass-morphism, accent corail #FF844B
   Typographie: Syne (titres) + Inter (corps)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
    --bg-deep:      #1a1c2a;
    --bg-surface:   #22243a;
    --bg-card:      rgba(34, 36, 58, 0.85);
    --bg-card-hover:rgba(42, 44, 70, 0.95);
    --accent:       #FF844B;
    --accent-light: rgba(255, 132, 75, 0.15);
    --accent-glow:  rgba(255, 132, 75, 0.35);
    --blue:         #38BDF8;
    --blue-light:   rgba(56, 189, 248, 0.12);
    --white:        #ffffff;
    --text-primary: rgba(255,255,255,0.92);
    --text-muted:   rgba(255,255,255,0.45);
    --text-soft:    rgba(255,255,255,0.65);
    --border:       rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.14);
    --sidebar-w:    260px;
    --summary-w:    220px;
    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    20px;
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-deep);
    /* overlay sombre 92% pour que bg2.png soit à peine visible */
    background-image:
        linear-gradient(rgba(26,28,42,0.92), rgba(26,28,42,0.92)),
        url("images/bg2.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,132,75,0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── WRAPPER ───────────────────────────────────────────────── */
.wrapper-section {
    min-height: 100vh;
    padding-bottom: 160px;
}

.layout-wrap {
    display: flex;
    min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────
   LEFT SIDEBAR
───────────────────────────────────────────────────────────── */
.left-sidebar {
    width: var(--sidebar-w);
    padding: 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(26,28,42,0.98) 0%, rgba(22,24,38,0.98) 100%);
    border-right: 1px solid var(--border);
    z-index: 900;
    display: flex;
    flex-direction: column;
}

/* Logo zone */
.left-sidebar .logo-zone {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.left-sidebar .logo-zone img { width: 130px; }

/* Nav zone */
.left-sidebar .nav-zone {
    padding: 16px 0 40px;
    flex: 1;
    overflow-y: auto;
}

/* Groupe sidebar */
.sidebar-group { border-bottom: 1px solid var(--border); }

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    color: var(--text-soft);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    user-select: none;
}

.sidebar-link:hover { color: var(--white); background: rgba(255,255,255,0.03); }

.sidebar-link .arrow-icon {
    width: 14px;
    opacity: 0.5;
    transition: transform 0.25s ease, opacity 0.2s;
}
.sidebar-link:hover .arrow-icon { opacity: 1; }
.arrow-icon.rotate { transform: rotate(90deg); }

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    background: rgba(0,0,0,0.15);
}
.submenu.open { max-height: 2000px; opacity: 1; }

.submenu a {
    display: block;
    padding: 7px 22px 7px 32px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s, padding-left 0.2s;
    border-left: 2px solid transparent;
    margin-left: 0;
}
.submenu a:hover {
    color: var(--text-primary);
    padding-left: 38px;
    border-left-color: rgba(255,132,75,0.4);
}
.submenu a.active {
    color: var(--blue);
    border-left-color: var(--blue);
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE TOPBAR (hidden on desktop)
───────────────────────────────────────────────────────────── */
.mobile-topbar {
    display: none; /* caché desktop */
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    z-index: 1100;
    background: rgba(26,28,42,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.mobile-burger {
    flex-shrink: 0;
    width: 40px; height: 40px;
    background: var(--accent-light);
    border: 1px solid rgba(255,132,75,0.3);
    color: var(--accent);
    border-radius: 10px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.mobile-burger:hover { background: rgba(255,132,75,0.25); }

.mobile-logo-link { flex-shrink: 0; }
.mobile-logo { height: 28px; width: auto; }

.mobile-page-title {
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* ─────────────────────────────────────────────────────────────
   SIDEBAR OVERLAY
───────────────────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   SIDEBAR CLOSE BUTTON (mobile, inside sidebar)
───────────────────────────────────────────────────────────── */
.sidebar-close-btn {
    display: none; /* visible seulement mobile */
    background: none;
    border: none;
    color: var(--text-soft);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}
.sidebar-close-btn:hover { color: var(--white); }

/* ─────────────────────────────────────────────────────────────
   SIDEBAR ARROW (bi-chevron-right)
───────────────────────────────────────────────────────────── */
.sidebar-arrow {
    font-size: 12px;
    opacity: 0.5;
    transition: transform 0.25s ease, opacity 0.2s;
    flex-shrink: 0;
}
.sidebar-link:hover .sidebar-arrow { opacity: 1; }
.sidebar-arrow.rotated { transform: rotate(90deg); opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   HEADING BAR (titre de la page, fixed en haut)
───────────────────────────────────────────────────────────── */
.heading-title {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    z-index: 800;
    padding: 16px 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(to bottom, rgba(26,28,42,0.97) 60%, transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.documentation {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--white);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.line-after {
    height: 1px;
    flex-grow: 1;
    background: linear-gradient(to right, rgba(255,132,75,0.4), transparent);
    border-radius: 2px;
}

/* ─────────────────────────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex-grow: 1;
    min-width: 0;
}

/* ─────────────────────────────────────────────────────────────
   SUMMARIZE — menu "Sur cette page" (droite)
───────────────────────────────────────────────────────────── */
.summarize {
    position: fixed;
    right: 32px;
    top: 88px;
    width: var(--summary-w);
    z-index: 700;
}

.summarize .title {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--accent-light);
}

.sum-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.sum-line-track {
    width: 2px;
    min-width: 2px;
    margin-top: 7px;
    height: 14px;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.3s;
    flex-shrink: 0;
}
.sum-item.active .sum-line-track { background: var(--accent); }

.sum-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    display: block;
    transition: color 0.2s;
}
.sum-link:hover { color: var(--text-primary); }
.sum-link.active { color: var(--white); font-weight: 500; }

/* Legacy .line support */
.line { display: none; }

/* ─────────────────────────────────────────────────────────────
   SCROLL CONTENT & SECTIONS
───────────────────────────────────────────────────────────── */
.scroll-content {
    padding-top: 90px;
    padding-left: 40px;
    padding-right: calc(var(--summary-w) + 60px);
    padding-bottom: 60px;
}

.fade-top {
    position: sticky;
    top: 0;
    height: 60px;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--bg-deep) 0%, transparent 100%);
    z-index: 600;
    margin-bottom: -60px;
}

/* CARD DE SECTION */
.dynamic-section {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
}

.dynamic-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 0;
}

.dynamic-section:hover {
    border-color: var(--border-hover);
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.dynamic-section:hover::before { opacity: 1; }

/* TITRE DE SECTION — la correction définitive */
.dynamic-section-title {
    font-family: 'Syne', sans-serif !important;
    font-weight: 700 !important;
    font-size: 17px !important;
    color: var(--white) !important;
    background: none !important;
    background-color: transparent !important;
    display: block !important;
    width: 100% !important;
    border-radius: 0 !important;
    padding: 0 0 14px 0 !important;
    margin-bottom: 20px !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: none !important;
    letter-spacing: -0.01em !important;
    line-height: 1.3 !important;
}

/* Point décoratif accent avant le titre */
.dynamic-section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin-right: 10px;
    margin-bottom: 2px;
    vertical-align: middle;
}

/* CONTENU */
.content {
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-primary);
}

.content p { margin-bottom: 12px; }
.content strong { color: var(--white); font-weight: 600; }
.content em { color: var(--text-soft); }

.content h2, .content h3 {
    font-family: 'Syne', sans-serif;
    color: var(--white);
    margin-top: 24px;
    margin-bottom: 10px;
    font-weight: 600;
}
.content h2 { font-size: 16px; }
.content h3 { font-size: 15px; }

.content ul, .content ol {
    padding-left: 20px;
    margin-bottom: 12px;
}
.content li { margin-bottom: 6px; }

/* Liens dans le contenu */
.content a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(56,189,248,0.25);
    transition: border-color 0.2s;
}
.content a:hover { border-color: var(--blue); }

/* Images */
.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 16px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Alertes Bootstrap custom */
.content .alert {
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    border-left-width: 3px !important;
}

/* Inline code */
.content code:not([class]) {
    background: rgba(255,132,75,0.1);
    color: var(--accent);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    border: 1px solid rgba(255,132,75,0.2);
}

/* bg-light code (existant dans le contenu) */
code.bg-light {
    background: rgba(255,132,75,0.08) !important;
    color: #ff6b35 !important;
    border: 1px solid rgba(255,132,75,0.2) !important;
}

/* ─────────────────────────────────────────────────────────────
   ARTICLES ANNEXES — section spéciale
───────────────────────────────────────────────────────────── */
.dynamic-section:has(.list-unstyled) {
    background: linear-gradient(135deg, rgba(56,189,248,0.04) 0%, var(--bg-card) 60%);
    border-color: rgba(56,189,248,0.12);
    padding: 20px 24px;
}

.content .list-unstyled { padding-left: 0; margin: 0; }

.content .list-unstyled li { margin-bottom: 2px; }

.content .list-unstyled li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    border-bottom: none;
    transition: background 0.18s, transform 0.18s;
    color: inherit;
    line-height: 1.4;
}
.content .list-unstyled li a:hover {
    background: rgba(56,189,248,0.07);
    transform: translateX(3px);
}
.content .list-unstyled li a strong {
    color: var(--blue);
    font-weight: 500;
    font-size: 13.5px;
}
.content .list-unstyled li a .text-white {
    color: var(--text-muted) !important;
    font-size: 12.5px;
}
.content .list-unstyled li a i {
    color: var(--accent) !important;
    font-size: 16px;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   CODE BLOCKS
───────────────────────────────────────────────────────────── */
.code-block-container {
    margin: 16px 0 !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
    background: #0d0f1a !important;
    box-shadow: none !important;
}

.code-block-container > div:first-child {
    background: rgba(255,255,255,0.04) !important;
    padding: 8px 14px !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-block-container .small {
    color: var(--text-soft) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.code-block-container .copy-btn,
.code-block-container button {
    background: rgba(255,132,75,0.15) !important;
    color: var(--accent) !important;
    border: 1px solid rgba(255,132,75,0.25) !important;
    padding: 3px 12px !important;
    border-radius: 5px !important;
    font-size: 11px !important;
    font-weight: 500;
    cursor: pointer !important;
    transition: background 0.2s;
}
.code-block-container .copy-btn:hover,
.code-block-container button:hover {
    background: rgba(255,132,75,0.25) !important;
}

.code-block-container pre {
    background: #0d0f1a !important;
    margin: 0 !important;
    padding: 16px !important;
    overflow-x: auto !important;
    border-radius: 0 !important;
}

.code-block-container code {
    color: #e2e8f0 !important;
    background: transparent !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
    white-space: pre !important;
    display: block !important;
}

/* ─────────────────────────────────────────────────────────────
   SCROLL ANIMATION
───────────────────────────────────────────────────────────── */
.scroll-content > div:not(.fade-top) {
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0;
    transform: translateY(18px);
}
.scroll-content > div.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — max 1200px : summarize masqué
───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .summarize {
        display: none !important;
    }
    .scroll-content {
        padding-right: 32px;
    }
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — max 992px : layout mobile complet
───────────────────────────────────────────────────────────── */
@media (max-width: 992px) {

    /* ── Topbar mobile ── */
    .mobile-topbar {
        display: flex !important;
    }

    /* ── Sidebar : hors écran, z-index au-dessus de l'overlay ── */
    .left-sidebar {
        left: calc(-1 * var(--sidebar-w));
        top: 0;
        height: 100vh;
        z-index: 1200;
        transition: left 0.32s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }
    .left-sidebar.open {
        left: 0;
        box-shadow: 8px 0 48px rgba(0,0,0,0.7);
    }

    /* Bouton fermer visible dans logo-zone */
    .sidebar-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* ── Heading desktop masqué ── */
    .heading-title {
        display: none !important;
    }

    /* ── Main content : pas de marge sidebar ── */
    .main-content {
        margin-left: 0 !important;
    }

    /* ── Scroll content : juste sous la topbar (56px) ── */
    .scroll-content {
        padding-top: 72px !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
        padding-bottom: 50px !important;
    }

    /* fade-top : inutile sur mobile */
    .fade-top {
        display: none !important;
    }

    /* Sections */
    .dynamic-section {
        padding: 18px 16px !important;
        border-radius: 12px !important;
        margin-bottom: 10px !important;
    }

    /* Submenu : hauteur libre */
    .submenu.open {
        max-height: 5000px !important;
        opacity: 1 !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — max 768px : petits mobiles
───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .mobile-page-title { font-size: 13px; }

    .scroll-content {
        padding-top: 66px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-bottom: 40px !important;
    }

    .dynamic-section {
        padding: 15px 13px !important;
        border-radius: 10px !important;
        margin-bottom: 8px !important;
    }

    .dynamic-section-title {
        font-size: 15px !important;
        padding-bottom: 9px !important;
        margin-bottom: 12px !important;
    }

    .content {
        font-size: 14px !important;
        line-height: 1.72 !important;
    }

    .code-block-container pre {
        overflow-x: auto !important;
    }

    .content .list-unstyled li a {
        padding: 5px 8px !important;
        gap: 6px !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   NAVIGATION PAGE : Précédent / Suivant
───────────────────────────────────────────────────────────── */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    max-width: 800px;
    margin: 40px auto 20px;
    padding: 0;
}

.page-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.page-nav-btn:hover {
    border-color: var(--accent);
    background: rgba(255,132,75,0.08);
    color: var(--accent);
    transform: translateX(0);
}
.page-nav-btn:hover .page-nav-icon {
    color: var(--accent);
}

.page-nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.page-nav-icon {
    font-size: 14px;
    color: var(--text-soft);
    transition: color 0.2s;
}

/* Cache le label et le titre — affiche juste "Précédent" / "Suivant" */
.page-nav-label,
.page-nav-title {
    display: none;
}

/* Affiche juste le texte simple */
.page-nav-btn.prev::after {
    content: 'Précédent';
}
.page-nav-btn.next::after {
    content: 'Suivant';
}

@media (max-width: 768px) {
    .page-nav { margin: 20px 0 10px; }
    .page-nav-btn { padding: 11px 13px; border-radius: 10px; }
    .page-nav-title { font-size: 12.5px; max-width: 120px; }
}