/* =====================================================
   COURS PYTHON DATA - STYLESHEET
   Créé par Geoffroy Streit - 2026
   Thème Data Science (Bleu Sci-Fi & Orange)
   ===================================================== */

:root {
    --primary: #3b82f6;
    /* Bleu vibrant */
    --secondary: #f97316;
    /* Orange Peps */
    --accent: #60a5fa;
    /* Bleu clair */
    --bg: #0f172a;
    /* Bleu nuit très sombre */
    --bg2: #1e293b;
    /* Bleu nuit plus clair */
    --card: #1e293b;
    --card-bg-hover: rgba(30, 41, 59, 0.5);
    --text: #f1f5f9;
    --text-bright: #f1f5f9;
    --muted: #94a3b8;
    --dim: #64748b;
    --border: #334155;

    --green: #10b981;
    --purple: #a855f7;
    --pink: #ec4899;
    --yellow: #eab308;
    --red: #ef4444;

    --sidebar-width: 250px;
}

/* === MODIF LAYOUT FOR SIDEBAR === */
@media (min-width: 1400px) {
    body {
        padding-left: var(--sidebar-width);
    }
}

/* === SIDE NAV === */
.side-nav {
    position: fixed;
    top: 80px;
    left: 20px;
    width: var(--sidebar-width);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: none;
    /* Desktop only via JS/MQ */
    z-index: 90;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@media (min-width: 1400px) {
    .side-nav {
        display: block;
        left: calc((100vw - 1200px) / 2 - var(--sidebar-width) - 40px);
    }
}

.side-nav-header h3 {
    margin-top: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.side-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-link {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.side-link span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0.7;
}

.side-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.side-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-weight: 500;
    border-left: 3px solid var(--primary);
}

/* === BADGE NEW === */
.badge-new {
    background: var(--secondary);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* === BACK TO TOP === */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    background: var(--accent);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === HEADER === */
header {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 16px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 4px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

nav a:hover {
    background: var(--card);
    color: var(--text);
}

/* === HAMBURGER MENU === */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    z-index: 101;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* === HERO === */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.hero p {
    color: var(--muted);
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
}

/* === TOC === */
.toc {
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.toc-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    background: rgba(59, 130, 246, 0.1);
}

.toc-num {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* === SECTIONS === */
section {
    padding: 60px 0;
    border-bottom: 1px solid var(--border);
}

.sec-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 35px;
}

.sec-num {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.3rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Color variations for sections */
section:nth-child(odd) .sec-num {
    background: linear-gradient(135deg, var(--secondary), #ea580c);
}

section:nth-child(3n) .sec-num {
    background: linear-gradient(135deg, var(--purple), #7c3aed);
}

.sec-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.sec-sub {
    color: var(--dim);
    font-size: 1rem;
}

h3 {
    font-size: 1.2rem;
    margin: 30px 0 15px;
    color: var(--accent);
}

h4 {
    font-size: 1rem;
    color: var(--text);
    margin: 0 0 8px;
}

p,
li {
    color: var(--muted);
    margin-bottom: 10px;
}

ul {
    list-style: none;
    padding-left: 0;
}

li {
    padding-left: 24px;
    position: relative;
}

li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--primary);
    font-weight: bold;
}

/* === CODE BLOCKS === */
.code {
    background: #0b1120;
    /* Very dark blue */
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.code-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #111827;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--dim);
    font-weight: 500;
}

/* Mac-style dots */
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.r {
    background: #ef4444;
}

.dot.y {
    background: #eab308;
}

.dot.g {
    background: #22c55e;
}

pre {
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    overflow-x: auto;
}

/* Syntax Highlighting - Data Science Theme */
.kw {
    color: var(--purple);
    font-weight: bold;
}

/* import, def */
.fn {
    color: var(--primary);
}

/* functions */
.str {
    color: var(--green);
}

/* strings */
.num {
    color: var(--secondary);
}

/* numbers */
.c {
    color: var(--dim);
    font-style: italic;
}

/* comments */
.var {
    color: var(--text);
}

/* variables */
.prop {
    color: var(--accent);
}

/* properties/methods */
.cls {
    color: var(--yellow);
}

/* classes/types */

/* === DEMOS / VIZ === */
.viz-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    text-align: center;
}

.viz-placeholder {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 8px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dim);
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    overflow: hidden;
}

/* === GRIDS === */
.grid2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.grid3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

/* === TIP BOX === */
.tip {
    background: rgba(59, 130, 246, 0.08);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
    margin: 16px 0;
}

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

/* === TABLES === */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 12px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(30, 41, 59, 0.8);
    color: var(--accent);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

td code {
    color: var(--secondary);
    background: rgba(249, 115, 22, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* === COLLAPSIBLE DETAILS === */
details {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

details summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(30, 41, 59, 0.5);
    transition: background 0.2s;
    user-select: none;
}

details summary:hover {
    background: rgba(59, 130, 246, 0.1);
}

details summary::before {
    content: '▶';
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details>div {
    padding: 20px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.3);
}

details p {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

/* === TOOL CARD === */
.tool-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s;
}

.tool-card:hover {
    border-color: var(--secondary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: block;
}

/* === FOOTER === */
footer {
    padding: 50px 0;
    text-align: center;
    color: var(--dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--bg2);
}

footer strong {
    color: var(--muted);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hamburger {
        display: flex;
    }

    nav {
        position: fixed;
        top: 64px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 64px);
        background: var(--card);
        flex-direction: column;
        padding: 20px;
        transition: right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        border-left: 1px solid var(--border);
        overflow-y: auto;
        z-index: 100;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    }

    nav.active {
        right: 0;
    }

    nav a {
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .sec-header {
        flex-direction: column;
        gap: 10px;
    }

    .toc-grid {
        grid-template-columns: 1fr 1fr;
    }
}