/* ============================================================
   Noor — Learn Islam · Design System
   Classic Islamic: deep green, gold, cream, geometric accents
   ============================================================ */

:root {
    --green-900: #0b3d31;
    --green-800: #0f4d3e;
    --green-700: #14594a;
    --green-600: #1d6e5c;
    --green-100: #e3efe9;
    --gold: #c9a227;
    --gold-light: #e6c860;
    --gold-pale: #f6ecd2;
    --cream: #faf7ef;
    --paper: #fffdf8;
    --ink: #22302b;
    --ink-soft: #55655e;
    --line: #e4ddc9;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(11, 61, 49, .10);
    --font-body: 'Manrope', 'Segoe UI', sans-serif;
    --font-serif: 'Amiri', 'Georgia', serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main { flex: 1; display: flex; flex-direction: column; }
body > main > * { flex-shrink: 0; }

body[dir="rtl"] { direction: rtl; }

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3 { font-family: var(--font-serif); color: var(--green-900); line-height: 1.25; }

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--gold); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--green-900);
    color: #fff;
    border-bottom: 3px solid var(--gold);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 68px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--gold-light); }
.brand:hover { color: var(--gold-light); }
.brand-mark { display: inline-flex; }

.brand-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-sub {
    font-family: var(--font-body);
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold-light);
}

.main-nav { display: flex; gap: 4px; margin-inline-start: auto; }

.main-nav a {
    color: #d7e5df;
    font-weight: 600;
    font-size: .92rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background .2s, color .2s;
    white-space: nowrap;
}

.main-nav a:hover { background: rgba(255,255,255,.08); color: var(--gold-light); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.lang-switch select {
    background: var(--green-800);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px;
    padding: 7px 30px 7px 10px;
    font-family: var(--font-body);
    font-size: .85rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* Light arrow, because this one sits on the dark header. */
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23e6c860' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 13px;
}

[dir=rtl] .lang-switch select { padding: 7px 10px 7px 30px; background-position: left 9px center; }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    font-size: 1.2rem;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(1200px 500px at 50% -100px, rgba(201,162,39,.18), transparent 65%),
        var(--green-900);
    color: #eef5f1;
    padding: 72px 0 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 0 L34 22 L56 28 L34 34 L28 56 L22 34 L0 28 L22 22 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 56px 56px;
    pointer-events: none;
}

.hero h1 {
    color: #fff;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    margin: 0 0 14px;
    position: relative;
}

.hero h1 em { color: var(--gold-light); font-style: normal; }

.hero p.lead {
    max-width: 640px;
    margin: 0 auto 26px;
    font-size: 1.08rem;
    color: #cfe0d8;
    position: relative;
}

.btn {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .95rem;
    transition: transform .15s, box-shadow .15s;
    position: relative;
}

.btn:hover { transform: translateY(-2px); }

.btn-gold { background: var(--gold); color: var(--green-900); box-shadow: 0 6px 18px rgba(201,162,39,.4); }
.btn-gold:hover { color: var(--green-900); background: var(--gold-light); }

.btn-ghost { border: 1.5px solid rgba(255,255,255,.5); color: #fff; margin-inline-start: 12px; }
.btn-ghost:hover { color: var(--gold-light); border-color: var(--gold-light); }

.hero-scroll-hint {
    display: block;
    margin-top: 44px;
    color: var(--gold-light);
    font-size: .85rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    position: relative;
    animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(6px);} }

/* ---------- Tree of Preservation ---------- */
.tree-section {
    padding: 70px 0 30px;
    text-align: center;
}

.section-kicker {
    display: inline-block;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
}

.tree-section h2, .section-title { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 10px; }

.section-sub { max-width: 620px; margin: 0 auto 34px; color: var(--ink-soft); }

.tree-wrap {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 10px 6px;
}

.tree-svg { width: 100%; height: auto; display: block; }

/* drawn-line animation */
.tree-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.tree-visible .tree-draw { animation: draw 2.6s ease forwards; }
.tree-visible .tree-draw.d2 { animation-delay: .7s; }
.tree-visible .tree-draw.d3 { animation-delay: 1.4s; }
.tree-visible .tree-fade { animation: fadeUp 1s ease forwards; opacity: 0; }
.tree-visible .tree-fade.f2 { animation-delay: 1.2s; }
.tree-visible .tree-fade.f3 { animation-delay: 1.8s; }
.tree-visible .tree-fade.f4 { animation-delay: 2.4s; }

.tree-fade { opacity: 0; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

.tree-node { cursor: pointer; }
.tree-node circle.halo { transition: opacity .25s; opacity: 0; }
.tree-node:hover circle.halo, .tree-node.active circle.halo { opacity: .35; }

.tree-node circle.dot { transition: fill .2s; }
.tree-node:hover circle.dot, .tree-node.active circle.dot { fill: var(--gold); }

.leaf-float { animation: leafFloat 5s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.leaf-float.l2 { animation-delay: 1.2s; }
.leaf-float.l3 { animation-delay: 2.4s; }

@keyframes leafFloat { 0%,100% { transform: rotate(0deg);} 50% { transform: rotate(2.5deg);} }

.tree-info {
    max-width: 700px;
    margin: 18px auto 0;
    background: var(--gold-pale);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 26px;
    text-align: start;
    min-height: 96px;
    transition: opacity .3s;
}

.tree-info h3 { margin: 0 0 6px; font-size: 1.2rem; }
.tree-info p { margin: 0; color: var(--ink-soft); font-size: .97rem; }

/* ---------- Feature cards ---------- */
.features { padding: 60px 0 80px; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    margin-top: 36px;
}

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: start;
    box-shadow: var(--shadow);
    transition: transform .2s, border-color .2s;
    display: block;
    color: var(--ink);
}

.card:hover { transform: translateY(-5px); border-color: var(--gold); color: var(--ink); }

.card-icon {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--green-100);
    color: var(--green-700);
    margin-bottom: 14px;
    font-size: 1.3rem;
}

.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
    background: var(--green-900);
    color: #fff;
    padding: 48px 0 40px;
    border-bottom: 3px solid var(--gold);
}

.page-hero h1 { color: #fff; margin: 0 0 8px; font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.page-hero p { margin: 0; color: #cfe0d8; max-width: 640px; }

.page-body { padding: 46px 0 80px; }

/* ---------- Quran reader ---------- */
.reader {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 26px;
    align-items: start;
}

.surah-list {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.surah-list a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: .92rem;
    color: var(--ink);
}

.surah-list a:last-child { border-bottom: none; }
.surah-list a:hover, .surah-list a.active { background: var(--green-100); color: var(--green-800); }
.surah-list .num { color: var(--gold); font-weight: 700; margin-inline-end: 8px; }
.surah-list .ar { font-family: var(--font-serif); font-size: 1.05rem; }

.ayah-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 34px;
    margin-bottom: 20px;
}

.ayah-arabic {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    direction: rtl;
    text-align: right;
    color: var(--green-900);
    line-height: 2.1;
    margin: 0 0 16px;
}

.ayah-translation { color: var(--ink); font-size: 1.02rem; margin: 0 0 12px; }

.ayah-meta {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    color: var(--ink-soft); font-size: .82rem;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}

.badge {
    background: var(--gold-pale);
    color: #8a6d12;
    border-radius: 999px;
    padding: 3px 12px;
    font-weight: 700;
    font-size: .75rem;
}

.badge.green { background: var(--green-100); color: var(--green-700); }

/* "you stopped here" marker */
.stopped-here-marker {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--gold);
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 8px 0;
    gap: 12px;
}
.stopped-here-marker::before, .stopped-here-marker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gold);
    opacity: .5;
}

/* one block per scholar's translation on reader pages */
.reader-translation {
    border-inline-start: 3px solid var(--green-100);
    padding-inline-start: 14px;
    margin-bottom: 14px;
}

.reader-translation:last-of-type { margin-bottom: 6px; }

.discussion-note {
    background: var(--green-100);
    border-inline-start: 4px solid var(--green-600);
    border-radius: 0 10px 10px 0;
    padding: 12px 16px;
    font-size: .88rem;
    color: var(--ink-soft);
    margin-top: 10px;
}

.discussion-note strong { color: var(--green-800); }

/* ---------- Reading surface: driven by each person's settings ----------
   Sizes, spacing and width arrive as custom properties, the palette as a
   data attribute, so one set of rules covers every combination. */
.reading-surface {
    --reading-text: 1.05rem;
    --reading-arabic: 1.8rem;
    --reading-leading: 1.85;
    --reading-width: 780px;
    --reading-bg: var(--paper);
    --reading-ink: var(--ink);
    --reading-soft: var(--ink-soft);
    --reading-accent: var(--green-900);
    --reading-line: var(--line);
    --reading-quiet: var(--cream);

    max-width: var(--reading-width);
    margin: 0 auto;
    padding: 30px 34px;
    border: 1px solid var(--reading-line);
    border-radius: var(--radius);
    background: var(--reading-bg);
    color: var(--reading-ink);
}

/* Everything inside the surface takes its colour from the surface, never from
   the page palette — otherwise a dark theme leaves light text on a light card. */
.reading-surface .reader-section-title { color: var(--reading-accent); }
.reading-surface .reader-isnad,
.reading-surface .reader-video-time,
.reading-surface .reader-video-note { color: var(--reading-soft); }

.reading-surface .reader-translation-card {
    background: transparent;
    border-color: var(--reading-line);
    border-inline-start-color: var(--gold);
    color: var(--reading-ink);
}

.reading-surface .reader-video-list li {
    background: var(--reading-quiet);
    color: var(--reading-ink);
}

.reading-surface .reader-nav { border-top-color: var(--reading-line); }

/* Verse cards in the Quran reader follow the surface, like everything else. */
.reading-surface .ayah-card {
    background: var(--reading-quiet);
    border-color: var(--reading-line);
    color: var(--reading-ink);
}

.reading-surface .ayah-arabic {
    font-family: var(--font-serif);
    font-size: var(--reading-arabic);
    line-height: calc(var(--reading-leading) + .25);
    color: var(--reading-accent);
}

.reading-surface .ayah-meta { border-top-color: var(--reading-line); color: var(--reading-soft); }
.reading-surface .reading-text.muted { color: var(--reading-soft); font-style: italic; }

.reading-surface .tree-info {
    background: var(--reading-quiet);
    border-color: var(--reading-line);
    color: var(--reading-ink);
}

.reading-surface .tree-info h3 { color: var(--reading-accent); }
.reading-surface .tree-info p { color: var(--reading-soft); }

.reading-surface .badge {
    background: var(--reading-quiet);
    color: var(--reading-accent);
    border: 1px solid var(--reading-line);
}

.reading-surface[data-reading-theme=white] { --reading-bg: #fff; --reading-quiet: #f6f5f1; }

.reading-surface[data-reading-theme=sepia] {
    --reading-bg: #f4ecd8; --reading-ink: #3b3122; --reading-soft: #6b5c44;
    --reading-accent: #4a3b23; --reading-line: #ddd0b3; --reading-quiet: #ebe0c6;
}

.reading-surface[data-reading-theme=night] {
    --reading-bg: #1b2621; --reading-ink: #dfe7e3; --reading-soft: #9fb0a9;
    --reading-accent: #e6c860; --reading-line: #2f403a; --reading-quiet: #223029;
}

.reading-surface .reading-text,
.reading-surface .reading-translation-text { font-size: var(--reading-text); line-height: var(--reading-leading); margin: 0 0 10px; }

.reading-surface .reading-arabic {
    font-family: var(--font-serif);
    font-size: var(--reading-arabic);
    line-height: calc(var(--reading-leading) + .25);
    direction: rtl; text-align: right;
    color: var(--reading-accent);
    background: var(--reading-quiet);
    border: 1px solid var(--reading-line);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 14px;
}

.reading-surface .reading-chapter {
    display: block;
    font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--gold);
    margin-bottom: 4px;
}

.reading-surface .reading-ref { font-weight: 700; color: var(--reading-accent); margin-bottom: 12px; }
.reading-surface .reading-isnad { font-size: .86rem; color: var(--reading-soft); margin: 0 0 12px; }
.reading-surface .reading-attribution { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.reading-surface .discussion-note {
    background: var(--reading-quiet);
    color: var(--reading-soft);
    border-inline-start-color: var(--gold);
}

.reading-surface .discussion-note strong { color: var(--reading-accent); }
.reading-surface .reading-attribution .badge.green { background: var(--reading-quiet); color: var(--reading-accent); }

/* The night theme needs a lighter accent than the greens used elsewhere. */
.reading-surface[data-reading-theme=night] .reader-section-title,
.reading-surface[data-reading-theme=night] .discussion-note strong { color: var(--gold-light); }

/* Notes gathered at the end rather than sitting between the narrations. */
.reading-surface[data-notes=atend] .discussion-note { display: none; }
.reading-notes-endmatter { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--reading-line); }

/* ---------- The reading settings page ---------- */
.reading-settings { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.reading-settings-controls { min-width: 0; }

.setting-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 11px 0;
    font-size: .92rem;
}

.setting-row + .setting-row { border-top: 1px dashed var(--line); }
.setting-row > span { display: flex; flex-direction: column; gap: 2px; font-weight: 600; color: var(--green-900); }
.setting-row small { font-weight: 500; font-size: .78rem; color: var(--ink-soft); }

/* Checkbox drawn as a switch — the state reads at a glance in a long list. */
.setting-switch {
    appearance: none; -webkit-appearance: none;
    width: 40px; height: 22px; flex: 0 0 auto;
    border-radius: 999px; background: #d8d3c4; border: none;
    position: relative; cursor: pointer;
    transition: background .15s;
}

.setting-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%; background: #fff;
    transition: transform .15s;
}

.setting-switch:checked { background: var(--green-800); }
.setting-switch:checked::after { transform: translateX(18px); }
.setting-switch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.segmented label { padding: 6px 11px; font-size: .78rem; background: #fff; color: var(--ink-soft); cursor: pointer; border-inline-end: 1px solid var(--line); }
.segmented label:last-child { border-inline-end: none; }
.segmented label.on { background: var(--green-800); color: #fff; font-weight: 700; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.theme-swatches { display: flex; gap: 8px; }
.theme-swatch { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; display: block; }
.theme-swatch.on { outline: 2px solid var(--gold); outline-offset: 2px; }
.theme-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch.theme-paper { background: #fffdf8; }
.theme-swatch.theme-white { background: #fff; }
.theme-swatch.theme-sepia { background: #f4ecd8; }
.theme-swatch.theme-night { background: #1b2621; }

.reading-preview-wrap { position: sticky; top: 20px; }
.reading-preview-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin-bottom: 8px; }
.reading-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-width: none; }
.reading-preview .reading-arabic { padding: 12px 14px; }

@media (max-width: 980px) {
    .reading-settings { grid-template-columns: 1fr; }
    .reading-preview-wrap { position: static; }
}

/* ---------- Quick panel and download dialog on a reading page ---------- */
.reading-toolbar { display: flex; justify-content: flex-end; gap: 8px; position: relative; margin-bottom: 12px; }

.reading-popover {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
    width: min(340px, calc(100vw - 40px));
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    text-align: start;
}

.reading-popover[hidden] { display: none; }
.reading-popover .setting-row { padding: 8px 0; font-size: .86rem; }
.reading-popover-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .76rem; color: var(--ink-soft); }
.reading-scope { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; font-size: .88rem; cursor: pointer; }
.reading-scope small { display: block; font-size: .76rem; color: var(--ink-soft); }

/* ---------- Hadith: the shelf of collections ---------- */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

.collection-card {
    display: flex; flex-direction: column; gap: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    color: inherit;
    transition: border-color .15s, transform .15s;
}

.collection-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.collection-card-arabic { font-family: var(--font-serif); font-size: 1.6rem; color: var(--green-900); direction: rtl; }
.collection-card-name { font-weight: 700; color: var(--green-800); }
.collection-card-meta { font-size: .82rem; color: var(--ink-soft); }

/* ---------- Choosing whose translation to read ---------- */
.edition-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }

.edition-card {
    display: flex; flex-direction: column; gap: 5px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    color: inherit;
    transition: border-color .15s, transform .15s;
}

.edition-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.edition-card-translator { font-weight: 700; font-size: 1.05rem; color: var(--green-900); }
.edition-card-language { font-size: .85rem; color: var(--gold); font-weight: 600; }
.edition-card-meta { font-size: .8rem; color: var(--ink-soft); }

.edition-progress {
    display: block; height: 5px; margin: 8px 0 4px;
    background: var(--green-100); border-radius: 999px; overflow: hidden;
}

.edition-progress-bar { display: block; height: 100%; background: var(--gold); border-radius: 999px; }

.reader-translator-line { font-size: .92rem; }

/* ---------- Hadith: chapters of a collection ---------- */
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.chapter-row {
    display: flex; align-items: center; gap: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 18px;
    color: inherit;
    transition: border-color .15s, background .15s;
}

.chapter-row:hover { border-color: var(--gold); background: var(--cream); }

.chapter-row-number {
    flex: 0 0 auto; min-width: 34px;
    font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700;
    color: var(--gold);
}

.chapter-row-name { flex: 1; font-weight: 600; color: var(--green-900); min-width: 0; }
.chapter-row-arabic-note { display: block; font-size: .76rem; font-weight: 500; color: var(--ink-soft); }
.chapter-row-count { flex: 0 0 auto; font-size: .82rem; color: var(--ink-soft); }

/* ---------- Hadith: the blocks a learner scans ---------- */
.hadith-block-list { display: flex; flex-direction: column; gap: 12px; }

/* When the list is itself a reading surface the blocks follow its palette. */
.reading-surface .hadith-block {
    background: var(--reading-quiet);
    border-color: var(--reading-line);
    color: var(--reading-ink);
}

.reading-surface .hadith-block-ref { color: var(--reading-accent); }
.reading-surface .hadith-block-text { font-size: var(--reading-text); line-height: var(--reading-leading); color: var(--reading-ink); }
.reading-surface .hadith-block-more { color: var(--reading-soft); }
.reading-surface .stopped-here-marker { color: var(--reading-soft); }

.hadith-block {
    display: flex; flex-direction: column; gap: 7px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.hadith-block:hover { border-color: var(--gold); box-shadow: var(--shadow); }

.hadith-block-chapter {
    font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--gold);
}

.hadith-block-ref {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-weight: 700; color: var(--green-900);
}

.hadith-block-text {
    line-height: 1.75;
    color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.hadith-block-text.muted { color: var(--ink-soft); font-style: italic; }
.hadith-block-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hadith-block-more { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }

/* ---------- Hadith: reading one narration ---------- */
.reader-back { display: inline-block; margin-bottom: 10px; font-weight: 600; font-size: .88rem; }
.reader-page { max-width: 780px; }

.reader-arabic {
    font-family: var(--font-serif);
    font-size: 1.55rem; line-height: 2.2;
    direction: rtl; text-align: right;
    color: var(--green-900);
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
}

.reader-isnad { font-size: .88rem; color: var(--ink-soft); margin-top: 14px; }
.reader-section-title { font-size: 1.15rem; color: var(--green-900); margin: 30px 0 12px; }

.reader-translation-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--green-600);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 20px 24px;
    margin-bottom: 14px;
}

.reader-translation-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.reader-translation-text { font-size: 1.05rem; line-height: 1.85; margin: 0; }

.reader-video-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reader-video-list li { background: var(--cream); border-radius: 10px; padding: 12px 16px; }
.reader-video-time, .reader-video-note { display: block; font-size: .82rem; color: var(--ink-soft); }

.reader-nav {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line);
}

/* ---------- Hadith ---------- */
.hadith-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }

.hadith-card { position: relative; overflow: hidden; }

.hadith-animation {
    height: 170px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #103c30 0%, #14594a 70%);
    overflow: hidden;
    position: relative;
}

.hadith-animation svg { width: 100%; height: 100%; display: block; }

.hadith-text { font-family: var(--font-serif); font-size: 1.06rem; color: var(--green-900); margin: 0 0 10px; }

.hadith-source { font-size: .8rem; color: var(--ink-soft); }

/* rider animation */
.rider { animation: ride 14s linear infinite; }
@keyframes ride { from { transform: translateX(-60px);} to { transform: translateX(420px);} }

.star-tw { animation: twinkle 3s ease-in-out infinite; }
.star-tw.s2 { animation-delay: 1s; }
.star-tw.s3 { animation-delay: 2s; }
@keyframes twinkle { 0%,100% { opacity: .3;} 50% { opacity: 1;} }

/* ---------- Videos ---------- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

@media (max-width: 1000px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .video-grid { grid-template-columns: 1fr; } }

.video-card { min-width: 0; }

.video-thumb-wrap { position: relative; margin-bottom: 10px; }

.video-thumb {
    aspect-ratio: 16/9;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--green-800), var(--green-600));
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
}

.play-btn {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    display: flex; align-items: center; justify-content: center;
    color: var(--green-800);
    font-size: 1rem;
    transition: transform .2s, background .2s;
}

.video-card:hover .play-btn { transform: scale(1.12); background: var(--gold); }

.video-thumb-category {
    position: absolute; bottom: 8px; inset-inline-start: 8px;
    background: rgba(11,61,49,.85);
    color: var(--gold-light);
    font-size: .7rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
    pointer-events: none;
}

.video-star-form { position: absolute; top: 8px; inset-inline-end: 8px; margin: 0; }

.video-star {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(11,61,49,.7);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    transition: background .2s, color .2s, transform .15s;
}

.video-star:hover { background: rgba(11,61,49,.9); transform: scale(1.1); }
.video-star.saved { background: var(--gold); color: var(--green-900); }

.video-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 700;
    font-size: .95rem;
    color: var(--green-900);
    line-height: 1.35;
    margin-bottom: 4px;
}

.video-card-title:hover { color: var(--gold); }

.video-card-author { font-size: .8rem; color: var(--ink-soft); margin-bottom: 6px; }

.video-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.video-section-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    margin: 0 0 16px;
}

.video-section-head h2 { margin: 0; }
.video-section-head a { font-size: .88rem; font-weight: 700; white-space: nowrap; }

.video-len {
    position: absolute; bottom: 10px; inset-inline-end: 10px;
    background: rgba(0,0,0,.6); color: #fff;
    font-size: .72rem; font-weight: 700;
    padding: 2px 8px; border-radius: 6px;
}

/* ---------- Arabic course ---------- */
.course-path { max-width: 760px; margin: 0 auto; }

.course-step {
    display: flex; gap: 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 26px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.step-num {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--green-800);
    color: var(--gold-light);
    font-family: var(--font-serif);
    font-weight: 700; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}

.course-step h3 { margin: 0 0 6px; font-size: 1.12rem; }
.course-step p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--green-900);
    color: #b9cec6;
    border-top: 3px solid var(--gold);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    padding: 44px 24px;
    flex-wrap: wrap;
}

.footer-brand { color: var(--gold-light); font-size: 1.3rem; margin-bottom: 6px; }
.footer-inner p { max-width: 380px; font-size: .9rem; margin: 0; }

.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: #d7e5df; font-size: .92rem; }
.footer-links a:hover { color: var(--gold-light); }

/* pager (shared with admin styles) */
.pager { display: flex; gap: 6px; margin-top: 24px; flex-wrap: wrap; justify-content: center; }

.pager-link, .pager-current {
    min-width: 34px; text-align: center;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: .85rem;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--green-800);
}

.pager-link:hover { border-color: var(--gold); color: var(--gold); }
.pager-current { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.pager-gap { align-self: center; color: var(--ink-soft); }

.table-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.table-toolbar input[type=text] {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: .9rem;
    min-width: 240px;
    background: #fff;
}

/* ---------- Auth forms (login / register) ---------- */
.auth-form {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 32px;
    max-width: 440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form label { font-weight: 700; font-size: .85rem; color: var(--green-900); margin-top: 12px; }

.auth-form input:not([type=checkbox]),
.auth-form textarea,
.auth-form select {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
    width: 100%;
    box-sizing: border-box;
}

/* Dropdowns on public forms lose the native arrow so they match every
   other control regardless of the operating system. */
.auth-form select,
.noor-form select {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 34px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230f4d3e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

[dir=rtl] .auth-form select,
[dir=rtl] .noor-form select { background-position: left 12px center; }

/* A single standalone field on a public page — the surah filter, for instance. */
.noor-input {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .92rem;
    background: #fff;
    color: var(--ink);
}

.noor-input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.auth-form select:focus, .noor-form select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.auth-form textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.auth-form textarea.textarea-tall { min-height: 130px; }

.auth-form input:focus,
.auth-form textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* Longer forms (scholar sign-up) lay their fields out in a responsive grid.
   Each field keeps its label directly above its own control. */
.auth-form-wide { max-width: 760px; }

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 18px;
    margin-top: 10px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { margin-top: 0; }
.field .selection-hint { margin: 2px 0 0; }
.field-wide { grid-column: 1 / -1; }

.form-section-title {
    margin: 28px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 1.05rem;
    color: var(--green-900);
}

.auth-form button[type=submit] {
    margin-top: 18px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
}

.auth-form .check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; margin-top: 12px; }

.auth-alt { text-align: center; font-size: .88rem; color: var(--ink-soft); margin: 14px 0 0; }

.form-errors { color: #a33a2a; font-size: .88rem; }
.form-errors ul { margin: 0; padding-inline-start: 18px; }
.field-validation-error { color: #a33a2a; font-size: .8rem; }

/* A validation message belonging to one field, shown directly beneath it.
   Collapsed while empty so it takes no space until something is wrong. */
.field-error { color: #a33a2a; font-size: .8rem; margin-top: 4px; }
.field-error:empty { display: none; }

.header-link {
    color: #d7e5df;
    font-weight: 600;
    font-size: .88rem;
    padding: 7px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.header-link:hover { color: var(--gold-light); }
.as-button { background: none; border: none; cursor: pointer; font-family: var(--font-body); }
.inline-form { display: inline; }

.nav-badge {
    display: inline-block;
    background: var(--gold);
    color: var(--green-900);
    font-size: .68rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 1px 7px;
    margin-inline-start: 5px;
    vertical-align: middle;
}

/* ---------- Small buttons, flash messages, tag chips (shared) ---------- */
.btn-small {
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .84rem;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    /* links and buttons render identically: same height, same baseline */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    vertical-align: middle;
}

.btn-approve { background: var(--green-700); color: #fff; }
.btn-approve:hover { background: var(--green-600); color: #fff; }
.btn-submit { background: var(--gold); color: var(--green-900); }
.btn-submit:hover { background: var(--gold-light); color: var(--green-900); }
.btn-reject { background: #fbe9e7; color: #a33a2a; }
.btn-reject:hover { background: #f6d7d2; color: #a33a2a; }
.btn-neutral { background: var(--green-100); color: var(--green-800); }
.btn-neutral:hover { background: #d3e5dc; color: var(--green-800); }

.flash { padding: 12px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; font-size: .92rem; }
.flash-ok { background: var(--green-100); color: var(--green-800); border: 1px solid #bcd8cc; }
.flash-err { background: #fbe9e7; color: #a33a2a; border: 1px solid #eec7c0; }

.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-chip {
    background: var(--green-100);
    color: var(--green-800);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: .82rem;
    font-weight: 700;
}

/* initials avatar */
.noor-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    font-family: var(--font-body);
    line-height: 1;
    flex: 0 0 auto;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); /* keeps it visible on dark headers */
}

/* sign-up tabs (ordinary user / scholar) */
.signup-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    background: var(--green-100);
    padding: 5px;
    border-radius: 999px;
}

.signup-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .9rem;
    color: var(--green-800);
    transition: background .18s, color .18s;
}

.signup-tab:hover { color: var(--gold); }
.signup-tab.active { background: var(--green-800); color: #fff; }
.signup-tab.active:hover { color: #fff; }

/* ---------- Forms on public pages (profile, settings) ---------- */
.noor-form {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 460px;
}

.noor-form label {
    font-weight: 700;
    font-size: .85rem;
    color: var(--green-900);
    margin-top: 12px;
}

.noor-form input[type=text],
.noor-form input[type=email],
.noor-form input[type=password],
.noor-form input[type=number],
.noor-form select,
.noor-form textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
}

.noor-form input:focus,
.noor-form select:focus,
.noor-form textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.noor-form textarea { min-height: 90px; resize: vertical; }

.noor-form button[type=submit] {
    margin-top: 18px;
    align-self: flex-start;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
}

.noor-form .check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 12px; }

/* profile layout */
.profile-layout { display: grid; grid-template-columns: 220px 1fr; gap: 30px; align-items: start; }
.profile-nav { display: flex; flex-direction: column; gap: 4px; }
.profile-nav a {
    padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: .93rem; color: var(--ink);
}
.profile-nav a:hover { background: var(--green-100); }
.profile-nav a.active { background: var(--green-800); color: #fff; }
.profile-card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 26px 28px; margin-bottom: 22px;
}
.profile-card h2 { margin: 0 0 4px; font-size: 1.3rem; }
.profile-card .card-sub { color: var(--ink-soft); font-size: .9rem; margin: 0 0 18px; }
@media (max-width: 820px) { .profile-layout { grid-template-columns: 1fr; } }

/* ---------- Global search ---------- */
.global-search { position: relative; }

.global-search form { display: flex; gap: 8px; }

.global-search input[type=text] {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
}

.global-search input[type=text]:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 6px); left: 0; right: 0;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 60;
    max-height: 380px;
    overflow-y: auto;
    text-align: start;
}

.global-search-heading {
    padding: 10px 16px 4px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.global-search-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: start;
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.global-search-item:last-child { border-bottom: none; }
.global-search-item:hover { background: var(--green-100); color: var(--ink); }
.global-search-item-title { font-weight: 700; font-size: .92rem; color: var(--green-900); }
.global-search-item-snippet { font-size: .82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-all { color: var(--gold); font-weight: 800; font-size: .88rem; }

/* search results page hits */
.search-hits { display: flex; flex-direction: column; gap: 12px; }

.search-hit {
    display: block;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px;
    color: var(--ink);
    transition: border-color .15s, transform .15s;
}

.search-hit:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.search-hit-title { font-weight: 700; color: var(--green-900); margin-bottom: 4px; }
.search-hit-arabic { font-family: var(--font-serif); font-size: 1.15rem; direction: rtl; text-align: right; color: var(--green-900); margin-bottom: 4px; }
.search-hit-snippet { font-size: .88rem; color: var(--ink-soft); }

/* ---------- Noor loader: three canopy leaves lighting in sequence ---------- */
.noor-loader {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.noor-loader .leaf {
    width: 11px;
    height: 11px;
    background: var(--green-600);
    border-radius: 75% 4px 75% 4px; /* leaf shape */
    transform: rotate(45deg);
    animation: leafGlow 1.2s ease-in-out infinite;
}

.noor-loader .leaf:nth-child(2) { animation-delay: .2s; }
.noor-loader .leaf:nth-child(3) { animation-delay: .4s; }

@keyframes leafGlow {
    0%, 100% { opacity: .35; background: var(--green-600); transform: rotate(45deg) scale(.85); }
    50% { opacity: 1; background: var(--gold); transform: rotate(45deg) scale(1.15); }
}

.noor-loader.large .leaf { width: 18px; height: 18px; }

/* overlay shown over a table while a new page/sort/search is loading */
.noor-table-overlay {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(250, 247, 239, .72);
    z-index: 30;
    border-radius: var(--radius);
}

/* lazy-list sentinel */
.lazy-sentinel { text-align: center; padding: 18px 0; min-height: 30px; }

/* ---------- File inputs ---------- */
input[type=file] {
    font-family: var(--font-body);
    font-size: .88rem;
    color: var(--ink-soft);
}

input[type=file]::file-selector-button {
    background: var(--green-800);
    color: var(--gold-light);
    border: none;
    border-radius: 999px;
    padding: 9px 20px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    margin-inline-end: 12px;
    transition: background .15s;
}

input[type=file]::file-selector-button:hover { background: var(--green-700); }

/* ---------- noor-select (searchable, lazy-loading dropdown) ---------- */
.noor-select { position: relative; margin-bottom: 8px; }

.noor-select input[type=text] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .92rem;
    background: #fff;
}

.noor-select-list {
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 40;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow);
    max-height: 220px;
    overflow-y: auto;
    margin: 0; padding: 4px;
    list-style: none;
    display: none;
}

.noor-select.open .noor-select-list { display: block; }

/* Pinned to the viewport instead of the box, so a picker inside a table cell
   is not cropped by the table's overflow. JS supplies the coordinates and the
   height; everything else is inherited from the rule above. */
.noor-select-list.floating {
    position: fixed;
    right: auto;
    z-index: 1000;
}

.noor-select-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .9rem;
}

.noor-select-list li:hover { background: var(--green-100); }
.noor-select-list li.noor-select-empty { color: var(--ink-soft); cursor: default; }
.noor-select-list li.noor-select-empty:hover { background: none; }

/* Already chosen (multi-select): ticked, and clicking again takes it off. */
.noor-select-list li.chosen {
    background: var(--gold-pale);
    color: var(--green-900);
    font-weight: 700;
}

.noor-select-list li.chosen::after { content: "✓"; color: var(--gold); font-weight: 800; }
.noor-select-list li.chosen:hover { background: var(--gold-light); }
.noor-select-list li.chosen:hover::after { content: "✕"; color: var(--green-900); }

.noor-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

.noor-chip, .anchor-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--green-100);
    color: var(--green-800);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .82rem;
    font-weight: 700;
}

.anchor-chip { background: var(--gold-pale); color: #8a6d12; font-style: italic; font-weight: 600; max-width: 100%; }
.anchor-chip .chip-quote { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

.noor-chip button, .anchor-chip button {
    background: none; border: none; cursor: pointer;
    color: inherit; font-weight: 800; font-size: .85rem;
    padding: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 68px; left: 0; right: 0;
        background: var(--green-900);
        flex-direction: column;
        padding: 10px 20px 18px;
        border-bottom: 3px solid var(--gold);
    }
    .main-nav.open { display: flex; }
    .nav-toggle { display: block; }
    .reader { grid-template-columns: 1fr; }
    .surah-list { order: 2; }
}

/* ---------- Video chapters ---------- */
.watch-with-chapters { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; margin-bottom: 24px; }
.watch-player { min-width: 0; }

/* Chapter marks now live on the player's own scrubber — see player.css.
   What remains here is the list beside it. */
.chapter-list {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-height: 420px; overflow-y: auto;
    min-width: 0;
}

.chapter-list h3 {
    margin: 0; padding: 12px 16px;
    font-size: .82rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--paper);
}

.chapter-list ol { list-style: none; margin: 0; padding: 0; }

.chapter-row {
    display: flex; gap: 10px; align-items: baseline;
    width: 100%; text-align: start;
    padding: 9px 16px;
    background: none; border: none; border-bottom: 1px solid var(--line);
    font-family: var(--font-body); font-size: .88rem;
    color: var(--ink); cursor: pointer;
}

.chapter-row:hover { background: var(--cream); }
.chapter-row.on { background: var(--gold-pale); }
.chapter-time { flex: 0 0 auto; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; font-size: .82rem; }
.chapter-title { flex: 1; min-width: 0; color: var(--green-900); }
.chapter-title small { display: block; color: var(--ink-soft); font-size: .76rem; margin-top: 2px; }

@media (max-width: 860px) {
    .watch-with-chapters { grid-template-columns: 1fr; }
    .chapter-list { max-height: 260px; }
}
