/* Variables Globales Docker (Glassmorphism & Couleurs) */
:root {
    --docker-blue: #2496ED;
    --docker-dark: #1D63ED;
    --bg-primary: #0a0e17; /* Très sombre, fond général */
    --bg-secondary: #0f1624;
    --bg-card: rgba(21, 29, 46, 0.65); /* Glassmorphism background */
    --bg-card-hover: rgba(26, 37, 64, 0.85); /* Hover Glass */
    
    --text-primary: #e8edf5;
    --text-secondary: #b4c0d4;
    --text-muted: #64748b;
    
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    
    /* Boutons et Bordures Glass */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(36, 150, 237, 0.4);
    
    --glow-blue: rgba(36, 150, 237, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Grid Subtle */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(36, 150, 237, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(36, 150, 237, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ---------------- HEADER & NAV ---------------- */
header {
    position: sticky;
    top: 0;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    height: 64px;
    display: flex;
    justify-content: center;
}

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

.top-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.top-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.top-nav a:hover,
.top-nav a.active {
    background: var(--bg-card);
    color: var(--docker-blue);
}

.nav-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 8px;
}

/* Hamburger Menu (Mobile) */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s linear;
    transform-origin: 1px;
}

.burger-menu.open span:nth-child(1) { transform: rotate(45deg); }
.burger-menu.open span:nth-child(2) { opacity: 0; }
.burger-menu.open span:nth-child(3) { transform: rotate(-45deg); }

/* ---------------- LAYOUT GLOBALE ---------------- */
.main-layout {
    display: flex;
    flex: 1;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------------- SIDEBAR ---------------- */
aside#sidebar-container {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 64px; /* Hauteur header */
    height: calc(100vh - 64px);
}

.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sidebar-header {
    padding: 0 24px 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    background: transparent;
}

.sidebar-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--glow-blue);
    color: var(--docker-blue);
    border-right: 3px solid var(--docker-blue);
}

.sidebar-link .num {
    background: rgba(36, 150, 237, 0.1);
    color: var(--docker-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 12px;
}

.sidebar-footer {
    padding: 16px 24px 0;
    font-size: 0.8rem;
}

/* ---------------- MAIN CONTENT ---------------- */
main {
    flex: 1;
    padding-bottom: 80px;
    min-width: 0; /* Prevenir débordement horizontal */
}

.module-content {
    padding-top: 50px;
}

/* ---------------- HERO / ACCUEIL ---------------- */
.hero {
    padding: 80px 0 60px;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--docker-blue) 60%, var(--accent-cyan) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 32px;
    line-height: 1.8;
}

.meta-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.9rem;
    color: var(--text-primary);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ---------------- GLASS BOXES & MODULE STYLES ---------------- */
.intro-box, .glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
}

.sec-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}
.sec-num {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--docker-blue), var(--accent-cyan));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 8px 16px var(--glow-blue);
}
.sec-title {
    font-size: 2.2rem;
    font-weight: 700;
}
.sec-sub {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ---------------- TOC GRID (ACCUEIL) ---------------- */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 30px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-item:hover {
    border-color: var(--docker-blue);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--glow-blue);
}

.toc-num {
    width: 36px;
    height: 36px;
    background: rgba(36, 150, 237, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--docker-blue);
}

/* ---------------- BOUTON COPIER & BARRE DE PROGRESSION ---------------- */
.progress-wrap {
    width: 100%;
    height: 4px;
    background: transparent;
    position: fixed;
    top: 64px; /* Sous le header */
    left: 0;
    z-index: 99;
}

.progress-container {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--docker-blue), var(--accent-cyan));
    box-shadow: 0 0 10px var(--glow-blue);
    transition: width 0.5s ease;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    background: var(--docker-blue);
    color: white;
    border-color: var(--docker-dark);
}

.copy-btn.copied {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

pre {
    position: relative;
    border-radius: 12px !important;
}

/* ---------------- BOUTONS DE NAVIGATION ---------------- */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.btn-prev, .btn-next {
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-next {
    background: var(--docker-blue);
    border-color: var(--docker-dark);
    color: white;
}

.btn-next:hover {
    background: #4ab1fc;
    transform: translateX(4px);
}
.btn-prev:hover {
    background: var(--bg-card-hover);
    transform: translateX(-4px);
}

/* ---------------- RESPONSIVE MOBILE ---------------- */
@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
    }
    
    aside#sidebar-container {
        position: fixed;
        left: -100%;
        top: 64px;
        width: 100%;
        height: calc(100vh - 64px);
        z-index: 90;
        transition: left 0.3s ease;
    }
    
    aside#sidebar-container.open {
        left: 0;
    }
    
    .sidebar-inner {
        background: rgba(10, 14, 23, 0.95);
        border-right: none;
    }

    .top-nav {
        display: none;
    }

    .burger-menu {
        display: flex;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
}
