/* Variables Globales Docker (Glassmorphism & Couleurs) */
:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --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(16, 185, 129, 0.4);
    
    --glow-primary: rgba(16, 185, 129, 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(16, 185, 129, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 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(--primary);
}

.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-primary);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-link .num {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    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(--primary) 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(--primary), 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-primary);
}
.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(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--glow-primary);
}

.toc-num {
    width: 36px;
    height: 36px;
    background: rgba(16, 185, 129, 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(--primary);
}

/* ---------------- 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(--primary), var(--accent-cyan));
    box-shadow: 0 0 10px var(--glow-primary);
    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(--primary);
    color: white;
    border-color: var(--primary-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;
    padding-top: 45px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    background: rgba(10, 14, 23, 0.8) !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

pre::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

/* ---------------- 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(--primary);
    border-color: var(--primary-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;
    }
}


/* ---------------- DEVOPS SPECIFIC CLASSES & COMPONENTS ---------------- */

/* --- ENCADREMENTS PEDAGOGIQUES (Glassmorphism & Neon accents) --- */

.analogy-box, .knowledge-box, .troubleshooting-box, .recall-box {
    margin: 25px 0;
    padding: 20px 24px;
    border-radius: 0 12px 12px 0;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.analogy-box:hover, .knowledge-box:hover, .troubleshooting-box:hover, .recall-box:hover {
    transform: translateX(4px);
}

/* Background Patterns overlay for boxes */
.analogy-box::before, .knowledge-box::before, .troubleshooting-box::before, .recall-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.01) 10px, rgba(255,255,255,0.01) 20px);
    pointer-events: none;
}

/* Analogy Box (Green) */
.analogy-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.03));
    border-left: 4px solid var(--primary);
}
.analogy-box:hover { box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15); }
.analogy-box h4 { color: var(--primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }

/* Knowledge Box (Purple) */
.knowledge-box {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(126, 34, 206, 0.03));
    border-left: 4px solid var(--accent-purple);
}
.knowledge-box:hover { box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15); }
.knowledge-box h4 { color: var(--accent-purple); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }

/* Troubleshooting Box (Red) */
.troubleshooting-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(185, 28, 28, 0.03));
    border-left: 4px solid var(--accent-red);
}
.troubleshooting-box:hover { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15); }
.troubleshooting-box h4 { color: var(--accent-red); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }

/* Recall Box / Rappel (Orange) */
.recall-box {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.03));
    border-left: 4px solid var(--accent-orange);
}
.recall-box:hover { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15); }
.recall-box h4 { color: var(--accent-orange); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }


/* --- INTRODUCTORY QUOTE FOR CHAPTERS --- */
.chapter-intro {
    position: relative;
    padding: 24px 30px 24px 60px;
    margin-bottom: 40px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-style: italic;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.chapter-intro::before {
    content: '“';
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 60px;
    color: rgba(16, 185, 129, 0.3);
    font-family: serif;
    line-height: 1;
}

/* --- LISTES (UL / OL) PREMIUM --- */
.module-intro ul, .module-content > ul:not(.dense-list) {
    list-style: none;
    padding-left: 10px;
    margin: 20px 0;
}
.module-intro ul li, .module-content > ul:not(.dense-list) li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.module-intro ul li::before, .module-content > ul:not(.dense-list) li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%2310b981" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M9 5l7 7-7 7"></path></svg>') no-repeat center;
    background-size: contain;
}

.module-intro ol, .module-content > ol {
    margin: 20px 0 20px 20px;
    padding-left: 15px;
    color: var(--text-secondary);
}
.module-intro ol li, .module-content > ol li {
    margin-bottom: 12px;
    padding-left: 10px;
}
.module-intro ol li::marker, .module-content > ol li::marker {
    color: var(--primary);
    font-weight: 600;
}


/* --- CARTES & GRID (Reference, Tools) --- */
.grid3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.grid2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.ref-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.ref-card h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.ref-card ul, .ref-card ol {
    padding-left: 20px;
    color: var(--text-secondary);
}

.ref-card li { margin-bottom: 6px; }

.tool-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent-cyan);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-8px);
    background: var(--bg-card-hover);
    box-shadow: 0 12px 30px rgba(0, 212, 255, 0.15);
}

.tool-card .tool-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1);
}

.tool-card h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.tool-card p { color: var(--text-secondary); font-size: 0.95rem; }


/* --- TABLEAUX (Commandes, Comparatifs) --- */

.cmd-table, .comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 25px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.cmd-table th, .comparison-table th {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.cmd-table td, .comparison-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
    vertical-align: top;
    transition: background 0.2s;
}

.cmd-table tr:last-child td, .comparison-table tr:last-child td {
    border-bottom: none;
}

.cmd-table tr, .comparison-table tr {
    transition: all 0.2s ease;
}

.cmd-table tr:nth-child(even), .comparison-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.cmd-table tr:hover td, .comparison-table tr:hover td {
    background: rgba(16, 185, 129, 0.05);
    color: var(--text-primary);
}

.cmd-table code, .comparison-table code {
    background: rgba(0,0,0,0.3);
    color: var(--accent-cyan);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Fallback for comparison-table when used as grid (in old code) */
div.comparison-table {
    display: grid;
    gap: 15px;
    padding: 20px;
}

/* --- ADDED FOR CYBER OPS / HIGH-END FINISH --- */

/* macOS Style Code Blocks */
pre {
    position: relative;
    border-radius: 12px !important;
    padding-top: 45px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    background: rgba(10, 14, 23, 0.9) !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

pre::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

/* Graphic Lists */
.module-intro ul, .module-content > ul:not(.dense-list) {
    list-style: none;
    padding-left: 10px;
    margin: 20px 0;
}
.module-intro ul li, .module-content > ul:not(.dense-list) li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.module-intro ul li::before, .module-content > ul:not(.dense-list) li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%2310b981" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M9 5l7 7-7 7"></path></svg>') no-repeat center;
    background-size: contain;
}

/* Chapter Intro */
.chapter-intro {
    position: relative;
    padding: 24px 30px 24px 60px;
    margin-bottom: 40px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-style: italic;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.chapter-intro::before {
    content: '“';
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 60px;
    color: rgba(16, 185, 129, 0.3);
    font-family: serif;
    line-height: 1;
}
