/* =========================
   COURS
   ========================= */

/* ── Index ── */

.cours-index-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}

.cours-index-container > h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.cours-index-lead {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

/* ── Section par niveau ── */

.cours-niveau-section {
    margin-bottom: 2.5rem;
}

.cours-niveau-section > h2 {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid;
}

.cours-niveau-section--debutant > h2      { color: #22c55e; border-color: #22c55e33; }
.cours-niveau-section--intermediaire > h2 { color: #f59e0b; border-color: #f59e0b33; }
.cours-niveau-section--avance > h2        { color: #a855f7; border-color: #a855f733; }
.cours-niveau-section--specifique > h2    { color: #3b82f6; border-color: #3b82f633; }

/* ── Grille cartes ── */

.cours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.cours-card {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-main);
    transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.cours-card:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--bg-surface) 85%, var(--accent));
    transform: translateY(-2px);
}

.cours-card h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
}

/* ── Badges niveau ── */

.cours-niveau-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.cours-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 4px; font-size: 0.78rem; }
.cours-badge--debutant     { background: #1e3a5f; color: #93c5fd; }
.cours-badge--intermediaire { background: #1e3a2f; color: #6ee7b7; }
.cours-badge--avance       { background: #3b1f5e; color: #c4b5fd; }
.cours-badge--specifique   { background: #3b2a1a; color: #fcd34d; }

/* ── Tag thème ── */

.cours-tag {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ── Détail cours ── */

.cours-chapitre pre,
.cours-chapitre code {
    font-size: 0.9rem;
}

/* ── Tables ── */

.cours-chapitre .doc-block-content table {
    font-size: 1rem;
    width: auto;
    min-width: 55%;
    margin: 1.5rem auto;
}

.cours-chapitre .doc-block-content th,
.cours-chapitre .doc-block-content td {
    padding: 0.75rem 1.25rem;
}

@media (max-width: 640px) {
    .cours-chapitre .doc-block-content table {
        width: 100%;
        min-width: unset;
        margin: 1.5rem auto;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.cours-chapitre h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.cours-chapitre h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.cours-chapitre {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.cours-chapitre:last-child {
    border-bottom: none;
}

/* ── Navigation chapitres ── */

.cours-nav-chapitres {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}

.cours-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: border-color 0.15s;
    max-width: 45%;
}

.cours-nav-btn:hover {
    border-color: var(--accent);
}

.cours-nav-next {
    margin-left: auto;
    text-align: right;
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .cours-grid { grid-template-columns: 1fr; }
    .cours-nav-chapitres { flex-direction: column; }
    .cours-nav-btn { max-width: 100%; }
}
