/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-w:    290px;

  /* Colors */
  --brown-dark:   #2C1810;
  --brown-deep:   #1A0F0A;
  --cream:        #F7F3ED;
  --cream-card:   #FDF9F3;
  --sidebar-bg:   #EDE7DC;
  --gold:         #C9A96E;
  --gold-dark:    #8B6914;
  --gold-light:   rgba(201,169,110,0.45);
  --gold-border:  #D4C9B8;
  --text:         #1A0F0A;
  --text-muted:   #8B7355;
  --green:        #4E7C5F;
  --green-lt:     #E8F0EB;

  /* Aliases */
  --bg:           var(--cream);
  --bg-card:      #FFFFFF;
  --border:       var(--gold-border);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ════════════════════════════════════════════════════════════════════════════════
   SHARED NAV BAR
════════════════════════════════════════════════════════════════════════════════ */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--brown-dark);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* 2px gold accent line below topbar */
.site-nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

.nav-brand {
  font-family: "Amiri", serif;
  font-size: 1.35rem;
  color: var(--gold);
  direction: rtl;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}

.nav-links { display: flex; gap: 0.25rem; }

.nav-link {
  padding: 0.3rem 0.9rem;
  border-radius: 4px;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--gold-border);
  transition: color 0.12s;
  font-family: "Inter", sans-serif;
}
.nav-link:hover { color: var(--gold); }
.nav-link.active {
  color: var(--gold);
  font-weight: 600;
  border-bottom: 2px solid var(--gold);
  border-radius: 0;
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  height: calc(100dvh - 52px);
  overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 0.5px solid var(--gold);
  overflow: hidden;
}

#sidebar-header {
  padding: 1rem;
  border-bottom: 0.5px solid var(--gold-border);
  background: var(--sidebar-bg);
}

#sidebar-header h2 {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 0.6rem;
  font-family: "Inter", sans-serif;
}

#search {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: var(--cream);
  color: var(--text);
  outline: none;
  font-family: "Inter", sans-serif;
  transition: border-color 0.15s, background 0.15s;
}
#search:focus {
  border-color: var(--gold);
  background: var(--bg-card);
}

#surah-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-border) transparent;
}

#surah-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  border-bottom: 0.5px solid rgba(212,201,184,0.4);
  transition: background 0.12s;
  border-left: 3px solid transparent;
}
#surah-list li:hover { background: rgba(201,169,110,0.08); }
#surah-list li.active {
  background: rgba(201,169,110,0.15);
  border-left-color: var(--gold);
}

#surah-list .no-result {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem;
  border: none;
}
#surah-list .no-result:hover { background: transparent; }

/* ─── Juz separators in sidebar ─────────────────────────────────────────────── */
.juz-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
  padding: 0 12px;
}
.juz-line {
  flex: 1;
  height: 0.5px;
  background: var(--gold);
}
.juz-label {
  font-size: 10px;
  color: var(--gold);
  font-family: "Inter", sans-serif;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.juz-verse {
  color: var(--text-muted);
  font-size: 9px;
}

/* ─── Hizb separators in sidebar ────────────────────────────────────────────── */
.hizb-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 2px;
  padding: 0 12px;
}
.hizb-line {
  flex: 1;
  height: 0.5px;
  background: var(--gold-light);
}
.hizb-label {
  font-size: 9px;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ─── Surah header Juz·Hizb line ────────────────────────────────────────────── */
.sh-juz-hizb {
  font-size: 11px;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  margin-top: 4px;
  text-align: center;
}

/* ─── Juz verse markers (Vue Étude) ─────────────────────────────────────────── */
.juz-verse-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
}
.jvm-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}
.jvm-text {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}
.jvm-ar {
  font-family: "Amiri", serif;
  font-size: 16px;
  color: var(--gold);
}
.jvm-sep {
  color: var(--gold-light);
}
.jvm-name {
  font-size: 11px;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}

/* ─── Hizb verse markers (Vue Étude) ────────────────────────────────────────── */
.hizb-verse-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
}
.hvm-line {
  flex: 1;
  height: 0.5px;
  background: linear-gradient(to right, transparent, var(--gold-light), transparent);
}
.hvm-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.s-num {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 1.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "Inter", sans-serif;
}

.s-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.s-arabic {
  font-family: "Amiri", serif;
  font-size: 1.05rem;
  direction: rtl;
  text-align: right;
  line-height: 1.4;
  color: var(--text);
}

.s-fr {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Inter", sans-serif;
}

.s-translit {
  font-size: 10px;
  color: var(--gold-dark);
  font-style: italic;
  font-family: "Inter", sans-serif;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Reader ───────────────────────────────────────────────────────────────── */
#reader {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-border) transparent;
}

#reader-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Surah Header ─────────────────────────────────────────────────────────── */
#surah-header {
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}

.sh-ornament {
  font-family: "Amiri", serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.5em;
  display: block;
  margin-bottom: 0.75rem;
}

.sh-arabic {
  font-family: "Amiri", serif;
  font-size: 2.25rem;
  direction: rtl;
  line-height: 1.3;
  color: var(--brown-dark);
  margin-bottom: 0.5rem;
}

.sh-ornament-bottom {
  font-family: "Amiri", serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.5em;
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.6rem;
}

.sh-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3rem 0.5rem;
  font-family: "Inter", sans-serif;
}

.sh-translit { font-style: italic; }

.sh-sep { color: var(--gold-border); }

.sh-type {
  background: var(--green-lt);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-family: "Inter", sans-serif;
}

.sh-global-toggles {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--gold-border);
}

.toggle-btn-global {
  font-size: 0.81rem;
  padding: 0.35rem 1.1rem;
}

/* ─── Verse Blocks ─────────────────────────────────────────────────────────── */
#verses-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.verse-block {
  position: relative;
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  padding: 2.4rem 1.4rem 1.1rem;
  transition: border-color 0.15s;
}
.verse-block:hover { border-color: var(--gold); }

/* Verse number — pinned top-right, shows "51 ٥١" (Western left, Arabic circle right) */
.verse-num {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.vn-west {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
}

.verse-num-circle {
  font-family: "Amiri", serif;
  font-size: 0.9rem;
  color: var(--gold-dark);
  font-weight: 700;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.verse-arabic {
  font-family: "Amiri", serif;
  font-size: 1.375rem;
  direction: rtl;
  text-align: right;
  line-height: 2.0;
  margin-bottom: 0.65rem;
  color: var(--brown-deep);
}

/* Toggle buttons — pinned top-left, discrete */
.verse-toggles {
  position: absolute;
  top: 0.6rem;
  left: 0.9rem;
  display: flex;
  gap: 0.3rem;
}

/* Base toggle button (search page, global toggles) */
.toggle-btn {
  padding: 0.25rem 0.8rem;
  font-size: 0.78rem;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: transparent;
  color: var(--gold-dark);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: "Inter", sans-serif;
}
.toggle-btn:hover {
  background: rgba(201,169,110,0.1);
}
.toggle-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

/* Per-verse toggles — discrete, small, top-left of card */
#verses-container .verse-toggles .toggle-btn {
  padding: 2px 8px;
  font-size: 11px;
  border: 0.5px solid var(--gold-border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
#verses-container .verse-toggles .toggle-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: transparent;
}
#verses-container .verse-toggles .toggle-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

/* Tabler icons before verse-level toggle buttons */
#verses-container .toggle-btn[data-type="phonetic"]::before {
  font-family: "tabler-icons";
  content: "\ebbe";
  font-size: 12px;
  line-height: 1;
}
#verses-container .toggle-btn[data-type="translation"]::before {
  font-family: "tabler-icons";
  content: "\ea09";
  font-size: 12px;
  line-height: 1;
}

.verse-extra {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  line-height: 1.8;
}

.phonetic-box {
  border-left: 3px solid var(--gold-border);
  background: var(--cream);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: "Inter", sans-serif;
}

.translation-box {
  border-left: 3px solid var(--gold);
  background: var(--cream-card);
  font-size: 0.88rem;
  color: var(--text);
  font-style: italic;
  font-family: "Inter", sans-serif;
}

/* ─── Navigation ───────────────────────────────────────────────────────────── */
#navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--sidebar-bg);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
}

.nav-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.88rem;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
  background: transparent;
  color: var(--gold-dark);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  transition: background 0.12s, color 0.12s;
}
.nav-btn:hover:not(:disabled) {
  background: var(--gold);
  color: #fff;
}
.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-current {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 4rem;
  text-align: center;
  font-family: "Inter", sans-serif;
}

/* ─── Mobile sidebar toggle ────────────────────────────────────────────────── */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: var(--brown-dark);
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: background 0.12s;
}
#sidebar-toggle:hover { background: #3d2015; }

/* ─── Overlay (mobile) ─────────────────────────────────────────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,24,16,0.4);
  z-index: 99;
}
#overlay.show { display: block; }

/* ─── Mobile surah select (replaces sidebar on mobile) ─────────────────────── */
#mobile-surah-select {
  display: none;
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--sidebar-bg);
  border: none;
  border-bottom: 0.5px solid var(--gold-border);
  font-family: "Amiri", serif;
  font-size: 1rem;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238B6914' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  padding-left: 2.5rem;
  outline: none;
  cursor: pointer;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html, body { overflow: auto; }

  #sidebar { display: none; }
  #sidebar-toggle { display: none; }
  #overlay { display: none !important; }
  #mobile-surah-select { display: block; }

  #app {
    display: block;
    height: auto;
    overflow: visible;
    flex-direction: column;
  }

  #reader {
    min-height: 100vh;
    overflow: visible;
  }

  #reader-inner {
    padding: 1rem 0.75rem 3rem;
  }

  .sh-arabic { font-size: 1.75rem; }
  .verse-arabic { font-size: 1.25rem; line-height: 2; }

  #navigation {
    gap: 0.75rem;
    padding: 0.75rem;
    flex-wrap: wrap;
  }
  .nav-btn { flex: 1; text-align: center; }
}

/* ════════════════════════════════════════════════════════════════════════════════
   SEARCH PAGE
════════════════════════════════════════════════════════════════════════════════ */
#page-search {
  background: var(--bg);
  min-height: 100vh;
  overflow: auto;
}

#search-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* ─── Search Header ──────────────────────────────────────────────────────────── */
#search-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.search-title-ar {
  font-family: "Amiri", serif;
  font-size: 2rem;
  direction: rtl;
  color: var(--brown-dark);
  margin-bottom: 0.4rem;
}

.search-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-family: "Inter", sans-serif;
}

/* ─── Search Bar ─────────────────────────────────────────────────────────────── */
#search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--gold-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(44,24,16,0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 640px;
  margin: 0 auto;
}
#search-bar:focus-within {
  border-color: var(--gold);
  box-shadow: 0 2px 12px rgba(201,169,110,0.2);
}

#search-input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-family: "Amiri", serif;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

#search-clear {
  padding: 0.5rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.12s, color 0.12s;
}
#search-clear:hover { background: rgba(201,169,110,0.1); color: var(--gold-dark); }

#search-btn {
  padding: 0.7rem 1.25rem;
  margin: 0.3rem;
  background: var(--gold);
  color: var(--brown-dark);
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
#search-btn:hover { background: var(--gold-dark); color: #fff; }

#search-hint {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}

.hint-ar { font-family: "Amiri", serif; font-size: 0.9rem; color: var(--gold-dark); }
.hint-fr { font-style: italic; color: var(--text-muted); }

/* ─── Welcome / Empty State ──────────────────────────────────────────────────── */
#search-welcome {
  text-align: center;
  padding: 3rem 1rem;
}

.welcome-icon {
  font-family: "Amiri", serif;
  font-size: 2.4rem;
  color: var(--gold);
  direction: rtl;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.welcome-text {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-family: "Inter", sans-serif;
}

.examples-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.examples-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: "Inter", sans-serif;
}

.examples-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.chip {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--gold-border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: "Inter", sans-serif;
  color: var(--text-muted);
}
.chip:hover {
  background: rgba(201,169,110,0.12);
  border-color: var(--gold);
  color: var(--gold-dark);
}
.chip-ar { font-family: "Amiri", serif; font-size: 1.05rem; direction: rtl; }

/* ─── Mode switcher (Mot entier / Par racine) ─────────────────────────────── */
#search-options {
  display: flex;
  justify-content: center;
  margin-top: 0.6rem;
}

#mode-switcher {
  display: inline-flex;
  border: 1.5px solid var(--gold);
  border-radius: 20px;
  overflow: hidden;
}

.mode-pill {
  padding: 0.32rem 0.95rem;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--gold);
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}

.mode-pill:first-child {
  border-right: 1.5px solid var(--gold);
}

.mode-pill-active {
  background: var(--gold);
  color: #fff;
}

.mode-pill:not(.mode-pill-active):hover {
  background: rgba(201, 169, 110, 0.12);
}

/* ─── Search History ─────────────────────────────────────────────────────────── */
#history-section {
  margin-bottom: 2rem;
  text-align: left;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.history-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
}

.history-clear {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: "Inter", sans-serif;
  transition: color 0.12s;
}
.history-clear:hover { color: #c0392b; }

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hist-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.12s, background 0.12s;
  color: var(--gold-dark);
}
.hist-chip:hover {
  border-color: var(--gold);
  background: rgba(201,169,110,0.08);
}

.hist-run {
  padding: 0.3rem 0.65rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  color: var(--gold-dark);
  transition: color 0.12s;
}
.hist-chip.chip-ar .hist-run { font-family: "Amiri", serif; font-size: 1rem; direction: rtl; }
.hist-run:hover { color: var(--gold-dark); }

.hist-del {
  padding: 0.2rem 0.45rem 0.2rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--gold-border);
  line-height: 1;
  transition: color 0.12s;
}
.hist-del:hover { color: #c0392b; }

/* ─── Results Summary ────────────────────────────────────────────────────────── */
.results-count {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gold-border);
  font-family: "Inter", sans-serif;
}
.results-count strong { color: var(--text); font-size: 1.1rem; }

.results-norm-note {
  font-size: 11px;
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
  opacity: 0.65;
  margin-top: -0.75rem;
  margin-bottom: 0.9rem;
}

.q-tag {
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text);
}
.q-ar {
  font-family: "Amiri", serif;
  font-size: 1.2rem;
  background: rgba(201,169,110,0.12);
  color: var(--gold-dark);
  direction: rtl;
}
.q-fr {
  font-style: italic;
  background: rgba(201,169,110,0.08);
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
}

.lang-badge {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 0.1rem 0.6rem;
  font-family: "Inter", sans-serif;
}

/* ─── No Results ─────────────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}
.no-results-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.4; }
.no-results strong { color: var(--text); }
.no-results-hint { font-size: 0.85rem; margin-top: 0.5rem; }

/* ─── Forms Accordion ───────────────────────────────────────────────────────── */
#forms-accordion { margin-bottom: 1rem; }

.forms-accordion-wrap {
  background: var(--cream-card);
  border: 0.5px solid var(--gold-border);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  overflow: hidden;
  font-family: "Inter", sans-serif;
}

.forms-accordion-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.forms-accordion-btn:hover { background: rgba(201,169,110,0.07); }

.forms-toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.15s;
  display: inline-block;
}

.forms-accordion-body {
  padding: 0 1rem 0.75rem;
  border-top: 0.5px solid var(--gold-border);
}

.forms-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.25rem 0;
  border-bottom: 0.5px solid var(--gold-border);
}

.forms-row:last-of-type { border-bottom: none; }

.forms-word {
  font-family: "Amiri", serif;
  font-size: 1.05rem;
  direction: rtl;
  color: var(--text);
}

.forms-count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.forms-more {
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0;
  font-style: italic;
}

.forms-total {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gold-border);
}

.forms-source {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.15rem;
}

/* ─── Roots Block ────────────────────────────────────────────────────────────── */
.roots-section {
  background: var(--cream-card);
  border: 0.5px solid var(--gold-border);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.roots-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.roots-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
  font-variant: small-caps;
}

.roots-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}

.roots-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.root-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.9rem 1.4rem;
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  min-width: 80px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.root-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(201,169,110,0.15);
}

.root-arabic {
  font-family: "Amiri", serif;
  font-size: 2rem;
  color: var(--brown-dark);
  direction: rtl;
  line-height: 1.3;
}

.root-label {
  font-size: 0.65rem;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
  font-family: "Inter", sans-serif;
  font-variant: small-caps;
}

.root-source {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-family: "Inter", sans-serif;
}

/* ─── Results List (grouped by surah) ───────────────────────────────────────── */
#results-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.surah-group {
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--gold-border);
  gap: 1rem;
  flex-wrap: wrap;
}

.group-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
  font-family: "Inter", sans-serif;
}

.group-names {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.group-arabic {
  font-family: "Amiri", serif;
  font-size: 1.2rem;
  direction: rtl;
  color: var(--brown-dark);
  line-height: 1.3;
  text-align: right;
}

.group-fr {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}

.group-link {
  font-size: 0.8rem;
  color: var(--gold-dark);
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--gold);
  border-radius: 20px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  font-family: "Inter", sans-serif;
}
.group-link:hover {
  background: var(--gold);
  color: var(--brown-dark);
}

.group-verses {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.group-verses .verse-block {
  border: 0.5px solid rgba(212,201,184,0.6);
  border-radius: 6px;
}

/* ─── "Lire →" button in search verse cards ─────────────────────────────────── */
.verse-lire-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.btn-lire {
  font-size: 0.73rem;
  padding: 0.18rem 0.65rem;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: transparent;
  color: var(--gold-dark);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  transition: background 0.12s, color 0.12s;
}
.btn-lire:hover {
  background: var(--gold);
  color: var(--brown-dark);
}

/* ─── Highlight ──────────────────────────────────────────────────────────────── */
mark {
  background: rgba(201,169,110,0.2);
  color: var(--gold-dark);
  border-radius: 3px;
  padding: 0 2px;
}

/* Verse highlight animation — gold left border + tinted bg that fades after 3.5 s */
@keyframes verse-hl-fade {
  0%, 72% {
    box-shadow: inset 4px 0 0 rgba(201, 169, 110, 1);
    background: rgba(201, 169, 110, 0.09);
  }
  100% {
    box-shadow: inset 4px 0 0 rgba(201, 169, 110, 0);
    background: var(--bg-card);
  }
}

.verse-block.verse-highlight {
  animation: verse-hl-fade 3.5s ease forwards;
}

/* ─── Responsive (search page) ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  #page-search { overflow: auto; }
  #search-page { padding: 1.5rem 0.75rem 3rem; }
  .search-title-ar { font-size: 1.5rem; }
  #search-bar { border-radius: 8px; }
  .roots-section { flex-direction: column; }
  .root-arabic { font-size: 1.6rem; }
  .group-header { flex-direction: column; align-items: flex-start; }
  .group-names { align-items: flex-start; }
  .lang-badge { display: none; }
}

/* ─── View switching utility ────────────────────────────────────────────────── */
/* Needed because Chrome UA does not use !important for [hidden], so a plain
   `element.hidden = true` is overridden by any flex/grid display rule on an
   ID or class selector. This class wins regardless of specificity. */
.view-hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════════════════════════
   MUSHAF VIEW
════════════════════════════════════════════════════════════════════════════════ */

/* View mode toggle row — above study toggles */
.sh-view-toggles {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--gold-border);
}

/* Riwaya (qiraat) pill row — below view mode toggles */
.sh-riwaya-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--gold-border);
}

/* Mushaf pages container */
#mushaf-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Individual mushaf page image */
.mushaf-page {
  width: 100%;
  max-width: 800px;
  background: #fff;
  display: block;
  border-radius: 4px;
  box-shadow: 0 2px 16px rgba(44,24,16,0.1);
}

/* Gold loading spinner */
.mushaf-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4rem 0;
  width: 100%;
}

.mushaf-spin-ring {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(201,169,110,0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: mushaf-spin 0.75s linear infinite;
}

@keyframes mushaf-spin {
  to { transform: rotate(360deg); }
}

.mushaf-error {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 2rem;
  font-family: "Inter", sans-serif;
}

/* Page-by-page navigator */
.mushaf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: var(--sidebar-bg);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  width: 100%;
  max-width: 800px;
}

/* Center cluster: "Page X / Y · Versets A–B" + verse hint pill */
.mushaf-nav-center {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
  min-width: 0;
}

.mushaf-page-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.mushaf-nav-sep {
  color: var(--gold-border);
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
}

.mushaf-verse-range {
  font-family: "Amiri", serif;
  font-size: 1rem;
  color: var(--gold-dark);
  white-space: nowrap;
}

.vr-short { display: none; }

.mushaf-verse-hint {
  font-size: 0.75rem;
  color: var(--gold-dark);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 0.1rem 0.65rem;
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

/* "Aller à" button */
.mushaf-goto-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Inline goto input (replaces button when active) */
.mushaf-goto-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.mushaf-goto-field {
  width: 2.8rem;
  padding: 0.22rem 0.35rem;
  font-size: 0.85rem;
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  text-align: center;
  font-family: "Inter", sans-serif;
  outline: none;
}
.mushaf-goto-field:focus { box-shadow: 0 0 0 2px rgba(201,169,110,0.25); }

.mushaf-goto-of {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.mushaf-goto-ok {
  font-size: 0.78rem;
  padding: 0.22rem 0.55rem;
}

/* Arrow buttons: show full text on desktop */
.mushaf-arrow { flex-shrink: 0; }
.mushaf-arrow-icon { display: none; }

/* ─── Mobile mushaf nav ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mushaf-nav { padding: 0.55rem 0.6rem; gap: 0.4rem; }

  .mushaf-arrow {
    width: 36px; height: 36px;
    border-radius: 50%;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .mushaf-arrow-label { display: none; }
  .mushaf-arrow-icon { display: inline; font-size: 1rem; }

  .mushaf-page-counter { font-size: 0.75rem; }
  .mushaf-verse-range { font-size: 0.88rem; }
  .vr-full { display: none; }
  .vr-short { display: inline; }

  .mushaf-goto-btn { font-size: 0.7rem; padding: 0.22rem 0.5rem; }
  .mushaf-goto-field { width: 2.4rem; font-size: 0.78rem; }
}

/* ════════════════════════════════════════════════════════════════════════════════
   AUDIO PLAYER
════════════════════════════════════════════════════════════════════════════════ */

/* Playing verse — gold left border + subtle tint */
.verse-block.audio-playing {
  border-left: 3px solid var(--gold);
  background: rgba(201,169,110,0.07);
}

/* Per-verse play button — inherits discrete toggle-btn style, just needs width */
.verse-play-btn {
  min-width: 22px;
  text-align: center;
  font-size: 9px !important;
  letter-spacing: 0;
}

/* Surah player bar — sticky at bottom of reader-inner */
#audio-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--sidebar-bg);
  border: 0.5px solid var(--gold-border);
  border-top: 1.5px solid var(--gold);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  box-shadow: 0 -2px 8px rgba(44,24,16,0.07);
}

.audio-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.audio-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.audio-btn-play {
  font-size: 0.82rem;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}

.audio-btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-bar-verse {
  font-family: "Amiri", serif;
  font-size: 1rem;
  color: var(--gold-dark);
  flex: 1;
  text-align: center;
  min-width: 0;
}

.audio-reciter-select {
  padding: 0.28rem 0.6rem;
  border: 1.5px solid var(--gold-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--gold-dark);
  font-size: 0.78rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  transition: border-color 0.12s;
}
.audio-reciter-select:focus,
.audio-reciter-select:hover { border-color: var(--gold); }

.audio-bar-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.4rem;
  font-family: "Inter", sans-serif;
}

@media (max-width: 640px) {
  #audio-bar { padding: 0.5rem 0.6rem; }
  .audio-bar-inner { gap: 0.4rem; }
  .audio-btn-play { font-size: 0.75rem; padding: 0.28rem 0.6rem; }
  .audio-bar-verse { font-size: 0.88rem; width: 100%; text-align: left; }
  .audio-reciter-select { font-size: 0.72rem; }
}

/* ════════════════════════════════════════════════════════════════════════════════
   À PROPOS PAGE
════════════════════════════════════════════════════════════════════════════════ */
#apropos-content {
  padding: 2rem 1rem 4rem;
  background: var(--cream);
}
#apropos-inner {
  max-width: 800px;
  margin: 0 auto;
}
.ap-header {
  text-align: center;
  padding: 2.5rem 0 2rem;
}
.ap-title {
  font-family: "Amiri", serif;
  font-size: 2.2rem;
  color: var(--brown-dark);
  margin-bottom: 0.5rem;
}
.ap-subtitle {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.ap-ornament {
  font-family: "Amiri", serif;
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: 0.1em;
}
.ap-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ap-card {
  display: flex;
  gap: 1.2rem;
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 8px;
  padding: 1.4rem 1.6rem;
  transition: border-color 0.15s;
}
.ap-card:hover { border-color: var(--gold); }
.ap-card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 2.2rem;
  text-align: center;
  padding-top: 0.1rem;
}
.ap-card-body { flex: 1; min-width: 0; }
.ap-card-title {
  font-family: "Inter", sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--brown-dark);
  margin-bottom: 0.75rem;
}
.ap-card-content {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ap-card-content li {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  padding-left: 1rem;
  position: relative;
}
.ap-card-content li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--gold);
}
.ap-card-content strong { color: var(--brown-dark); font-weight: 600; }
.ap-card-content em { font-style: italic; color: var(--text-muted); }

.ap-table-wrap { overflow-x: auto; }
.ap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
}
.ap-table th, .ap-table td {
  padding: 0.45rem 0.7rem;
  text-align: left;
  border-bottom: 0.5px solid var(--gold-border);
  white-space: nowrap;
}
.ap-table th {
  color: var(--brown-dark);
  font-weight: 600;
  border-bottom: 1.5px solid var(--gold);
}
.ap-table td { color: var(--text); }
.ap-table-note {
  margin-top: 0.6rem;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}

.ap-footer {
  margin-top: 2.5rem;
  padding: 1.5rem;
  text-align: center;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 0.5px solid var(--gold-border);
  line-height: 1.8;
}
@media (max-width: 600px) {
  .ap-card { flex-direction: column; gap: 0.6rem; }
  .ap-card-icon { width: auto; }
}

/* ─── Translation source tooltip ────────────────────────────────────────────── */
.info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.info-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.5;
  padding: 0 0.2rem;
  line-height: 1;
  transition: opacity 0.12s;
  font-family: "Inter", sans-serif;
}
.info-btn:hover { opacity: 1; }
.info-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: var(--brown-dark);
  color: var(--cream);
  font-size: 0.72rem;
  font-family: "Inter", sans-serif;
  padding: 0.45rem 0.7rem;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 200;
  border: 0.5px solid var(--gold-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  pointer-events: auto;
}
.info-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 10px;
  border: 5px solid transparent;
  border-bottom-color: var(--brown-dark);
}
.info-tooltip a { color: var(--gold); text-decoration: none; }
.info-tooltip a:hover { text-decoration: underline; }
.info-wrap:hover .info-tooltip,
.info-wrap.open .info-tooltip { display: block; }

/* ─── Roots subtitle link ────────────────────────────────────────────────────── */
.roots-subtitle-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}
.roots-subtitle-link:hover { color: var(--gold); text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════════════════
   FAVORIS, PROGRESSION, PARTAGE
════════════════════════════════════════════════════════════════════════════════ */

/* ─── Fav + Share verse buttons ─────────────────────────────────────────────── */
#verses-container .verse-toggles .fav-btn { color: var(--text-muted); }
#verses-container .verse-toggles .fav-btn.fav-on {
  color: var(--gold);
  border-color: var(--gold);
  background: transparent;
}
#verses-container .verse-toggles .fav-btn:hover:not(.fav-on) {
  color: var(--gold);
  border-color: var(--gold);
  background: transparent;
}
#verses-container .verse-toggles .share-btn { color: var(--text-muted); font-size: 10px; }
#verses-container .verse-toggles .share-btn:hover { color: var(--gold-dark); border-color: var(--gold); }

/* ─── Favoris bar (sidebar) ──────────────────────────────────────────────────── */
#favoris-bar {
  padding: 6px 12px 8px;
  background: var(--sidebar-bg);
  border-bottom: 0.5px solid var(--gold-border);
  flex-shrink: 0;
}
.favoris-btn {
  width: 100%;
  background: transparent;
  border: 0.5px solid var(--gold);
  border-radius: 4px;
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
  font-size: 0.77rem;
  padding: 5px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.favoris-btn:hover { background: rgba(201,169,110,0.12); }

/* ─── Favoris panel ──────────────────────────────────────────────────────────── */
#favoris-panel { display: none; }
#favoris-panel.open { display: block; }

.fav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
}
.fav-drawer {
  position: fixed;
  top: 52px;
  left: 0;
  bottom: 0;
  width: 320px;
  background: var(--bg);
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.18);
}
.fav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--sidebar-bg);
  border-bottom: 0.5px solid var(--gold-border);
  flex-shrink: 0;
}
.fav-title {
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-dark);
}
.fav-header-actions { display: flex; gap: 8px; align-items: center; }
.fav-clear {
  background: none;
  border: none;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  padding: 0;
}
.fav-clear:hover { color: #c0392b; }
.fav-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.fav-close:hover { color: var(--text); }
.fav-list { overflow-y: auto; flex: 1; scrollbar-width: thin; }
.fav-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
  line-height: 1.7;
}
.fav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 0.5px solid rgba(212,201,184,0.4);
  transition: background 0.1s;
}
.fav-item:hover { background: rgba(201,169,110,0.06); }
.fav-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}
.fav-item-surah {
  font-size: 0.78rem;
  font-family: "Inter", sans-serif;
  color: var(--text-muted);
  line-height: 1.4;
}
.fav-item-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.5;
  padding: 0 2px;
}
.fav-item-del:hover { opacity: 1; color: #c0392b; }
.fav-item-text {
  font-family: "Amiri", serif;
  font-size: 1rem;
  color: var(--text);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) { .fav-drawer { width: 100%; } }

/* ─── Resume banner ──────────────────────────────────────────────────────────── */
#resume-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--cream-card);
  border-left: 3px solid var(--gold);
  border-radius: 0 4px 4px 0;
  flex-wrap: wrap;
}
.resume-text {
  flex: 1;
  font-size: 0.84rem;
  font-family: "Inter", sans-serif;
  color: var(--text);
  min-width: 0;
}
.resume-btn {
  padding: 4px 12px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: transparent;
  color: var(--gold-dark);
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.resume-btn:hover { background: rgba(201,169,110,0.1); }
.resume-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.resume-close:hover { color: var(--text); }

/* ─── Progress dot in sidebar ────────────────────────────────────────────────── */
.s-progress-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Share popover ──────────────────────────────────────────────────────────── */
#share-popover {
  position: fixed;
  background: var(--bg-card);
  border: 0.5px solid var(--gold-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  z-index: 300;
  display: flex;
  flex-direction: column;
  min-width: 175px;
  overflow: hidden;
}
.share-option {
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 0.5px solid var(--gold-border);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: "Inter", sans-serif;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.share-option:last-child { border-bottom: none; }
.share-option:hover { background: rgba(201,169,110,0.08); color: var(--gold-dark); }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--brown-dark);
  color: var(--cream);
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  padding: 7px 18px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}

/* ─── Offline banner ──────────────────────────────────────────────────────── */
#offline-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--brown-dark);
  color: var(--gold);
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-family: Inter, sans-serif;
  z-index: 9999;
  border-top: 0.5px solid var(--gold);
}
.toast.toast-show { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════════════════════════════════════════════════════
   DARK / LIGHT MODE
════════════════════════════════════════════════════════════════════════════════ */

/* Global smooth transition for dark-mode toggling (lowest specificity — element
   rules override this automatically, so existing 0.12 s transitions are safe) */
* { transition: background-color 0.3s, color 0.3s, border-color 0.3s; }

/* Suppress ALL transitions on first paint to avoid flash */
html.no-transition *,
html.no-transition *::before,
html.no-transition *::after { transition: none !important; }

/* ─── Dark-mode variable overrides ──────────────────────────────────────────── */
html.dark {
  --brown-dark:   #0A1209;
  --brown-deep:   #E8DCC8;   /* verse-arabic uses this for text */
  --cream:        #0F1A12;
  --cream-card:   #0D1810;
  --sidebar-bg:   #0A1209;
  --gold-dark:    #C4964A;
  --gold-light:   rgba(74, 58, 34, 0.8);
  --gold-border:  #2E3E2E;
  --text:         #E8DCC8;
  --text-muted:   #7A6A52;
  --green:        #5E9C6F;
  --green-lt:     #0A1E0F;
  --bg:           #0F1A12;
  --bg-card:      #1A2A1A;
  --border:       #2A3A2A;
}

/* Elements that use --brown-dark as TEXT color (not background) */
html.dark .sh-arabic,
html.dark .search-title-ar,
html.dark .group-arabic,
html.dark .ap-title,
html.dark .ap-card-title,
html.dark .ap-card-content strong,
html.dark .ap-table th,
html.dark .root-arabic { color: var(--text); }

/* Nav links use --gold-border as text, which darkens too much */
html.dark .nav-link { color: rgba(201, 169, 110, 0.5); }
html.dark .nav-link.active,
html.dark .nav-link:hover { color: var(--gold); }

/* Toast: --brown-dark bg + --cream text → both become dark */
html.dark .toast { color: var(--text); }

/* Info tooltip: same issue */
html.dark .info-tooltip { background: #1A2A1A; color: var(--text); border-color: #2E3E2E; }
html.dark .info-tooltip::before { border-bottom-color: #1A2A1A; }

/* Mushaf pages are white SVGs */
html.dark .mushaf-page { filter: brightness(0.88) contrast(1.02); }

/* ─── Dark toggle button (in topbar) ────────────────────────────────────────── */
.nav-left { display: flex; align-items: center; gap: 0.5rem; }

.dark-toggle-btn {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}
.dark-toggle-btn:hover { opacity: 0.75; }

/* ════════════════════════════════════════════════════════════════════════════════
   FONT SIZE CONTROL
════════════════════════════════════════════════════════════════════════════════ */
.sh-font-size {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--gold-border);
}

.font-size-btn {
  font-size: 11px;
  font-family: "Inter", sans-serif;
  padding: 3px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: transparent;
  color: var(--gold-dark);
  cursor: pointer;
  line-height: 1.5;
}
.font-size-btn:hover { background: rgba(201, 169, 110, 0.1); }
.font-size-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

/* Font-size classes on #verses-container */
.font-small  .verse-arabic { font-size: 18px !important; }
.font-normal .verse-arabic { font-size: 22px !important; }
.font-large  .verse-arabic { font-size: 28px !important; line-height: 2.2; }

/* ════════════════════════════════════════════════════════════════════════════════
   GOTO INPUT (direct reference navigation in sidebar)
════════════════════════════════════════════════════════════════════════════════ */
.sidebar-ref-divider {
  height: 0.5px;
  background: var(--gold);
  margin: 8px 0;
  opacity: 0.35;
}

#goto-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  font-size: 0.82rem;
  background: var(--cream);
  color: var(--text);
  outline: none;
  font-family: "Inter", sans-serif;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 0.5rem;
}
#goto-input:focus {
  border-color: var(--gold);
  background: var(--bg-card);
}
#goto-input::placeholder { color: var(--text-muted); font-size: 0.78rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   Translation selector (per-verse dropdown inside .translation-box)
════════════════════════════════════════════════════════════════════════════ */
.translation-box .tr-select {
  display: block;
  margin-top: 8px;
  padding: 3px 8px;
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--cream);
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  cursor: pointer;
  max-width: 100%;
}
.translation-box .tr-select:focus {
  outline: none;
  border-color: var(--gold);
}
html.dark .translation-box .tr-select {
  background: var(--bg-card);
}
