/* Cours NSI — style « bleu & violet » : même palette que les diaporamas et proche de style_tp.css
   (fond blanc, bleu 2563EB, violet 7C3AED, marine 1E3A8A, définitions bleu clair, remarques ambre).
   Mêmes noms de classes et de variables que cours.css (.page-content, header, h5/h2/h3, .definition, .theoreme, .table_cours). */

:root {
    --font-display: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-body:    'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-code:    'Consolas', 'Source Code Pro', 'Monaco', 'Courier New', monospace;
    --bg:           #f1f5f9;
    --ink:          #0f172a;
    --body:         #1e293b;
    --muted:        #64748b;
    --line:         #cbd5e1;
    --accent:       #2563eb;
    --accent-strong:#1d4ed8;
    --violet:       #7c3aed;
    --navy:         #1e3a8a;
    --def-bg:       #e0f2fe;
    --rem-bg:       #fef3c7;
    --rem-line:     #d97706;
    --rem-fg:       #78350f;
    --code-line:    #94a3b8;
    /* variables utilisées par les sorties Python des cours existants */
    --chip:         #ffffff;
    --chip-fg:      #1e40af;
    --card:         #ffffff;
    --card-shadow:  0 2px 10px rgba(15, 23, 42, .08);
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--body);
    background-color: var(--bg);
}

/* En-tête : clair, barre bleue */
header {
    background-color: #eff6ff;
    border-left: 8px solid var(--accent);
    border-radius: 0 10px 10px 0;
    padding: 26px 30px;
    margin-bottom: 40px;
}
h1 {
    margin: 0;
    color: var(--navy);
    font-family: var(--font-display);
    font-size: 1.9em;
    font-weight: 700;
    text-align: left;
}

/* Page : carte blanche */
.page-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 60px;
    background-color: var(--card);
    box-shadow: var(--card-shadow);
    min-height: calc(100vh - 200px);
}

/* I.  : violet, le plus gros */
h5 {
    color: var(--violet);
    font-family: var(--font-display);
    font-size: 2em;
    font-weight: 700;
    margin-top: 55px;
    margin-bottom: 25px;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--violet);
}
h5 a { text-decoration: none; color: var(--violet); }
h5 a:hover { text-decoration: underline; }

/* 1.  : marine, barre bleue à gauche */
h2 {
    color: var(--navy);
    font-family: var(--font-display);
    font-size: 1.55em;
    font-weight: 700;
    margin-top: 38px;
    margin-bottom: 20px;
    padding-left: 14px;
    border-left: 6px solid var(--accent);
}

/* a.  : bleu, plus petit */
h3 {
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 1.25em;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 14px;
}

p, .classe_p {
    margin-bottom: 15px;
    text-align: justify;
    line-height: 1.8;
}
ul, ol { margin: 20px 0; padding-left: 30px; }
li { margin-bottom: 12px; line-height: 1.8; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Définitions : bleu clair */
.definition {
    border-left: 5px solid var(--accent);
    background-color: var(--def-bg);
    padding: 20px 25px;
    margin: 25px 0;
    border-radius: 0 10px 10px 0;
    color: var(--ink);
}
.definition strong { color: var(--navy); }

/* Théorèmes / à retenir : ambre, comme les remarques des diapos */
.theoreme {
    border-left: 5px solid var(--rem-line);
    background-color: var(--rem-bg);
    padding: 20px 25px;
    margin: 25px 0;
    border-radius: 0 10px 10px 0;
    color: var(--rem-fg);
}
.theoreme strong { color: var(--rem-fg); }

/* Schémas SVG */
.svg-container {
    text-align: center;
    margin: 30px auto;
    padding: 20px;
    background-color: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.node      { fill: white; stroke: var(--accent); stroke-width: 2px; }
.node-text { fill: var(--navy); font-family: var(--font-display); font-weight: bold; }
.edge      { stroke: var(--accent); stroke-width: 2px; }
.edge-weighted { stroke: var(--muted); stroke-width: 2px; }

/* Code : fenêtre d'éditeur Python (fond clair, barre de titre, coloration) */
pre {
    position: relative;
    background-color: #f8fafc;
    background-image: linear-gradient(to bottom, #e2e8f0 0, #e2e8f0 34px, #cbd5e1 34px, #cbd5e1 35px, transparent 35px);
    color: #111827;
    padding: 50px 24px 18px 24px;
    border: 1.5px solid var(--code-line);
    border-radius: 10px;
    overflow-x: auto;
    margin: 25px 0;
    font-family: var(--font-code);
    font-size: 1.02em;
    line-height: 1.6;
}
/* trois pastilles + titre de la fenêtre */
pre::before {
    content: "";
    position: absolute;
    top: 11px; left: 16px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #f87171;
    box-shadow: 20px 0 0 #fbbf24, 40px 0 0 #4ade80;
}
pre::after {
    content: "Éditeur";
    position: absolute;
    top: 0; left: 80px;
    line-height: 34px;
    font-family: var(--font-body);
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--muted);
}
/* Sortie : console, fenêtre bleu clair, texte bleu (classe .console ajoutée par coloration.js,
   ou bloc de sortie marqué par le style en ligne des anciens cours) */
pre.console, pre[style*="--chip"] {
    background-color: #ffffff !important;
    background-image: linear-gradient(to bottom, #dbeafe 0, #dbeafe 34px, #93c5fd 34px, #93c5fd 35px, transparent 35px) !important;
    color: var(--chip-fg) !important;
}
pre.console::before, pre[style*="--chip"]::before { background: #93c5fd; box-shadow: 20px 0 0 #93c5fd, 40px 0 0 #93c5fd; }
pre.console::after, pre[style*="--chip"]::after { content: "Console"; color: var(--navy); }
/* console collée juste sous l'éditeur */
pre + pre.console, pre + pre[style*="--chip"] {
    margin-top: -1.5px !important;
    border-top: 0;
    border-radius: 0 0 10px 10px;
}
pre:has(+ pre.console), pre:has(+ pre[style*="--chip"]) {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
/* coloration syntaxique (coloration.js), thème clair */
.py-kw  { color: #7c3aed; font-weight: 700; }
.py-bi  { color: #2563eb; }
.py-str { color: #b45309; }
.py-num { color: #0369a1; }
.py-com { color: #64748b; font-style: italic; }
.py-prompt { color: #64748b; font-weight: 700; user-select: none; }

/* Code dans le texte : violet */
code {
    background-color: #f3f0ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.95em;
    color: var(--violet);
}
pre code { background-color: transparent; padding: 0; color: inherit; font-size: inherit; }

/* Tableaux : en-tête bleu clair */
.table_cours {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
}
.table_cours th {
    background-color: #dbeafe;
    color: var(--navy);
    padding: 14px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #93c5fd;
}
.table_cours td {
    padding: 12px;
    border: 1px solid var(--line);
    text-align: center;
    background-color: white;
    color: var(--body);
}
.table_cours tbody tr:hover td { background-color: #eff6ff; }

/* Compléments (cours de BDD et de structures de données) */
h4 {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.1em;
    font-weight: 700;
    margin-top: 25px;
    margin-bottom: 10px;
}
ol ol { list-style-type: lower-alpha; margin: 8px 0; }
details {
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    background-color: #f8fafc;
    border-radius: 0 10px 10px 0;
    padding: 12px 22px;
    margin: 15px 0 25px;
}
details summary { cursor: pointer; font-weight: 700; color: var(--accent-strong); }
details[open] summary { margin-bottom: 12px; }
details pre { margin: 12px 0; }
details > :last-child { margin-bottom: 0; }
.table_cours caption {
    caption-side: top;
    text-align: left;
    font-weight: 700;
    color: var(--ink);
    padding-bottom: 8px;
}
.table_cours.narrow { width: auto; min-width: 45%; margin-left: auto; margin-right: auto; }
.table_cours.sql td { text-align: left; }
.table_cours td em.null { color: var(--muted); }
.table_cours td code { white-space: normal; }
.intro img, figure img { margin-left: auto; margin-right: auto; }

/* Images */
img {
    max-width: 600px;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
}

strong, b { color: var(--ink); font-weight: 700; }
em { color: var(--body); }

/* Utilitaires */
.text-center { text-align: center; }
.img-center { margin-left: auto; margin-right: auto; }
.img_small { display: block; margin-left: auto; margin-right: auto; max-width: 200px; }

@media (max-width: 768px) {
    .page-content { padding: 20px; }
    h1 { font-size: 1.5em; }
    h5 { font-size: 1.5em; }
    h2 { font-size: 1.3em; }
    h3 { font-size: 1.1em; }
}
