/* ============================================================
   Dikr Quran — Design System  (dikr blue + iOS aesthetics)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Scheherazade+New:wght@400;700&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Brand blue */
  --blue:          #46bfff;
  --blue-dark:     #1aaae8;
  --blue-darker:   #0d88c4;
  --blue-bg:       rgba(70, 191, 255, 0.10);
  --blue-border:   rgba(70, 191, 255, 0.28);
  --blue-glow:     rgba(70, 191, 255, 0.18);

  /* iOS system colours */
  --sys-bg:        #f2f2f7;   /* systemGray6 */
  --sys-bg2:       #e5e5ea;   /* systemGray5 */
  --page-bg:       #ffffff;
  --page-text:     #1c1c1e;   /* label */
  --text-sec:      #6e6e73;   /* secondaryLabel */
  --text-ter:      #aeaeb2;   /* tertiaryLabel */
  --separator:     rgba(60, 60, 67, 0.12);

  /* Page anatomy */
  --page-border:   var(--blue);
  --line:          var(--blue);

  /* Typography */
  --font-quran:    'Scheherazade New', 'Amiri', Georgia, serif;
  --font-ui:       'Amiri', -apple-system, 'Segoe UI', sans-serif;
  --size-quran:    26px;
  --lh-quran:      2.5;

  /* Motion */
  --ease-ios:      cubic-bezier(0.4, 0, 0.2, 1);
  --dur:           0.32s;
}

/* Dark mode */
body.dark {
  --sys-bg:        #1c1c1e;
  --sys-bg2:       #2c2c2e;
  --page-bg:       #111111;
  --page-text:     #f2f2f7;
  --text-sec:      #aeaeb2;
  --text-ter:      #6e6e73;
  --separator:     rgba(255,255,255,0.10);
  --blue-border:   rgba(70, 191, 255, 0.22);
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-ui);
  background: var(--sys-bg);
  color: var(--page-text);
  min-height: 100vh;
  direction: rtl;
  transition: background var(--dur) var(--ease-ios), color var(--dur) var(--ease-ios);
  -webkit-font-smoothing: antialiased;
}

/* ── GLASSMORPHISM HEADER ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(200%) blur(22px);
  -webkit-backdrop-filter: saturate(200%) blur(22px);
  border-bottom: 0.5px solid rgba(70, 191, 255, 0.22);
  box-shadow:
    0 0.5px 0 rgba(70, 191, 255, 0.15),
    0 2px 16px rgba(70, 191, 255, 0.08);
  transition: background var(--dur);
}

body.dark .site-header {
  background: rgba(28, 28, 30, 0.82);
  border-bottom-color: rgba(70, 191, 255, 0.15);
  box-shadow: 0 0.5px 0 rgba(70, 191, 255, 0.12), 0 2px 20px rgba(0,0,0,0.4);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

/* ── Logo ──────────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  width: 38px;
  height: 38px;
  border-radius: 22%;   /* iOS app icon style */
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(70,191,255,0.30), 0 0 0 0.5px rgba(70,191,255,0.2);
}

.logo-text {
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
  letter-spacing: -0.3px;
}
body.dark .logo-text { color: var(--blue); }

/* ── Header Nav ─────────────────────────────────────────────── */
.header-nav {
  display: flex;
  gap: 2px;
  justify-content: flex-start;
}

.nav-link {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-sec);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.18s, color 0.18s;
  cursor: pointer;
}
.nav-link:hover,
.nav-link.active {
  background: var(--blue-bg);
  color: var(--blue-dark);
}
body.dark .nav-link:hover,
body.dark .nav-link.active {
  color: var(--blue);
  background: rgba(70,191,255,0.12);
}

/* ── Header actions ─────────────────────────────────────────── */
.header-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, transform 0.15s;
}
.btn-icon:hover { background: rgba(70,191,255,0.2); transform: scale(1.05); }
body.dark .btn-icon { color: var(--blue); }

/* ── Main ───────────────────────────────────────────────────── */
.main-content {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

/* ── Top bar ────────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 0 2px;
}

.page-meta { display: flex; gap: 8px; }

.meta-badge {
  background: var(--blue);
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-family: var(--font-quran);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(70,191,255,0.3);
}

.font-controls { display: flex; gap: 6px; }

.btn-font {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue-dark);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-quran);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}
.btn-font:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
body.dark .btn-font { color: var(--blue); }

/* ── Book wrapper ───────────────────────────────────────────── */
.book-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* ── Nav arrows ─────────────────────────────────────────────── */
.nav-arrow {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(70,191,255,0.4);
  transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
  flex-shrink: 0;
}
.nav-arrow:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: scale(1.07);
  box-shadow: 0 6px 20px rgba(70,191,255,0.5);
}
.nav-arrow:disabled {
  background: var(--sys-bg2);
  color: var(--text-ter);
  box-shadow: none;
  cursor: not-allowed;
}

/* ── Quran page ─────────────────────────────────────────────── */
.quran-page {
  flex: 1;
  max-width: 620px;
  min-height: 800px;
  background: var(--page-bg);
  border-radius: 4px 10px 10px 4px;
  box-shadow:
    0 10px 40px rgba(0,0,0,0.18),
    0 2px 8px rgba(0,0,0,0.10),
    inset 4px 0 12px rgba(70,191,255,0.06);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity var(--dur) var(--ease-ios), transform var(--dur) var(--ease-ios);
}

/* Spine shadow */
.quran-page::before {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 8px;
  background: linear-gradient(to left, rgba(70,191,255,0.10), transparent);
  pointer-events: none;
  z-index: 2;
}

/* Page curl */
.quran-page::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--sys-bg) 50%, transparent 50%);
  pointer-events: none;
  z-index: 2;
}
body.dark .quran-page::after {
  background: linear-gradient(135deg, #0a0a0a 50%, transparent 50%);
}

/* Page flip animations */
.quran-page.flip-out { animation: flipOut var(--dur) var(--ease-ios) forwards; }
.quran-page.flip-in  { animation: flipIn  var(--dur) var(--ease-ios) forwards; }

@keyframes flipOut {
  0%   { opacity: 1; transform: rotateY(0) translateX(0); }
  100% { opacity: 0; transform: rotateY(-12deg) translateX(-24px); }
}
@keyframes flipIn {
  0%   { opacity: 0; transform: rotateY(12deg) translateX(24px); }
  100% { opacity: 1; transform: rotateY(0) translateX(0); }
}

/* ── Gold → Blue decorative border ──────────────────────────── */
.page-frame {
  margin: 12px;
  border: 1.5px solid var(--blue);
  border-radius: 3px;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  opacity: 0.99; /* stacking context for corners */
}

/* Corner ornaments */
.page-frame::before,
.page-frame::after {
  content: '✦';
  position: absolute;
  font-size: 11px;
  color: var(--blue);
  line-height: 1;
  background: var(--page-bg);
  padding: 0 4px;
}
.page-frame::before { top: -7px; right: 8px; }
.page-frame::after  { bottom: -7px; left: 8px; }

.page-frame-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  position: relative;
}
.page-frame-inner::before,
.page-frame-inner::after {
  content: '✦';
  position: absolute;
  font-size: 11px;
  color: var(--blue);
  line-height: 1;
  background: var(--page-bg);
  padding: 0 4px;
}
.page-frame-inner::before { top: -19px; left: 8px; }
.page-frame-inner::after  { bottom: -19px; right: 8px; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--blue);
  font-family: var(--font-quran);
  font-size: 13px;
  color: var(--blue-dark);
  direction: rtl;
}
body.dark .page-header { color: var(--blue); border-bottom-color: rgba(70,191,255,0.35); }
body.dark .page-frame  { border-color: rgba(70,191,255,0.35); }

/* Clickable surah label in page header */
.surah-label-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-quran);
  font-size: 13px;
  color: var(--blue-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.surah-label-btn:hover { background: var(--blue-bg); }
body.dark .surah-label-btn { color: var(--blue); }

/* ── Page body / Quran text ─────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 14px 0 8px;
  overflow: hidden;
}

.quran-text {
  font-family: var(--font-quran);
  font-size: var(--size-quran);
  line-height: var(--lh-quran);
  color: var(--page-text);
  direction: rtl;
  text-align: justify;
  word-spacing: 3px;
}

/* Verse end marker circle */
.verse-end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  font-size: 0.52em;
  font-family: var(--font-quran);
  color: var(--blue-dark);
  margin: 0 4px;
  vertical-align: middle;
  line-height: 1;
  position: relative;
  top: -2px;
  background: transparent;
}
body.dark .verse-end { color: var(--blue); border-color: rgba(70,191,255,0.6); }

/* ── Surah heading block ─────────────────────────────────────── */
.surah-heading {
  text-align: center;
  margin: 14px 0 10px;
  direction: rtl;
}

.surah-diamond {
  text-align: center;
  color: var(--blue);
  font-size: 11px;
  letter-spacing: 8px;
  margin: 4px 0;
  line-height: 1;
}

.surah-heading-box {
  display: inline-block;
  border: 1.5px solid var(--blue);
  border-radius: 4px;
  padding: 8px 32px;
  position: relative;
  background: linear-gradient(180deg, rgba(70,191,255,0.04) 0%, transparent 100%);
  min-width: 240px;
}

.surah-heading-box::before,
.surah-heading-box::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28px;
  height: 1.5px;
  background: var(--blue);
  opacity: 0.5;
}
.surah-heading-box::before { right: -30px; }
.surah-heading-box::after  { left:  -30px; }

.surah-name-ar {
  font-family: var(--font-quran);
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
  display: block;
  line-height: 1.5;
}
body.dark .surah-name-ar { color: var(--blue); }

.surah-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-sec);
  margin-top: 2px;
}

/* Bismillah separator */
.bismillah-line {
  text-align: center;
  font-family: var(--font-quran);
  font-size: 22px;
  color: var(--blue-dark);
  margin: 10px 0 12px;
  direction: rtl;
}
body.dark .bismillah-line { color: var(--blue); }

/* ── Page footer ────────────────────────────────────────────── */
.page-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 6px;
  border-top: 1px solid var(--blue);
  gap: 12px;
  direction: rtl;
}
body.dark .page-footer { border-top-color: rgba(70,191,255,0.35); }

.page-number {
  font-family: var(--font-quran);
  font-size: 15px;
  color: var(--blue-dark);
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}
body.dark .page-number { color: var(--blue); }

.footer-ornament {
  color: var(--blue);
  font-size: 11px;
  letter-spacing: 5px;
  opacity: 0.7;
}

/* ── Bottom controls ────────────────────────────────────────── */
.bottom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-nav {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border: 1.5px solid var(--blue);
  border-radius: 24px;
  background: transparent;
  color: var(--blue-dark);
  font-family: var(--font-quran);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-nav:hover:not(:disabled) {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(70,191,255,0.35);
}
.btn-nav:disabled { opacity: 0.35; cursor: not-allowed; }
body.dark .btn-nav { color: var(--blue); }

.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-quran);
  font-size: 15px;
  color: var(--text-sec);
  direction: rtl;
}

.page-jump input {
  width: 58px;
  height: 34px;
  border: 1.5px solid var(--blue-border);
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-quran);
  font-size: 16px;
  background: var(--page-bg);
  color: var(--page-text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.page-jump input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(70,191,255,0.15);
}

/* ── Loading & error ────────────────────────────────────────── */
.loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--blue);
  font-family: var(--font-quran);
  font-size: 18px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(70,191,255,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff3b30;
  font-family: var(--font-quran);
  font-size: 18px;
  padding: 20px;
  text-align: center;
}

/* ── SIDE MENU ──────────────────────────────────────────────── */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 198;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-ios);
  backdrop-filter: blur(2px);
}
.menu-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 92vw;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-left: 0.5px solid rgba(70,191,255,0.2);
  box-shadow: -6px 0 40px rgba(0,0,0,0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.34s var(--ease-ios);
  overflow: hidden;
}
.side-menu.open { transform: translateX(0); }

body.dark .side-menu {
  background: rgba(28, 28, 30, 0.94);
  border-left-color: rgba(70,191,255,0.15);
}

/* Menu header */
.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
}

.side-menu-title {
  font-family: var(--font-quran);
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}
body.dark .side-menu-title { color: var(--blue); }

.side-menu-title i { color: var(--blue); font-size: 16px; }

.close-menu-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--sys-bg2);
  color: var(--text-sec);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.close-menu-btn:hover { background: var(--blue); color: #fff; }

/* Search bar */
.search-wrapper {
  position: relative;
  padding: 12px 14px 10px;
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--separator);
}

.search-icon {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-ter);
  font-size: 13px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid var(--blue-border);
  background: var(--sys-bg);
  color: var(--page-text);
  font-family: var(--font-quran);
  font-size: 15px;
  padding: 0 38px 0 14px;
  direction: rtl;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(70,191,255,0.15);
}
.search-input::placeholder { color: var(--text-ter); }
body.dark .search-input { background: var(--sys-bg2); }

/* Surah list */
.surah-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 20px;
  direction: rtl;
}

.surah-list::-webkit-scrollbar { width: 4px; }
.surah-list::-webkit-scrollbar-track { background: transparent; }
.surah-list::-webkit-scrollbar-thumb { background: rgba(70,191,255,0.3); border-radius: 4px; }

/* Surah item */
.surah-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  direction: rtl;
  transition: background 0.15s;
  border-bottom: 0.5px solid transparent;
}
.surah-item:hover  { background: var(--blue-bg); }
.surah-item.active { background: rgba(70,191,255,0.12); }
.surah-item.disabled { cursor: default; opacity: 0.45; }
.surah-item.disabled:hover { background: transparent; }

/* Surah number badge */
.surah-num {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--blue-bg);
  border: 1.5px solid var(--blue-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-quran);
  font-size: 13px;
  color: var(--blue-dark);
  font-weight: 700;
}
body.dark .surah-num { color: var(--blue); }

.surah-item.active .surah-num,
.surah-item:hover .surah-num {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.surah-item.disabled .surah-num { border-color: var(--separator); }

/* Surah names */
.surah-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.surah-item-name-ar {
  font-family: var(--font-quran);
  font-size: 16px;
  color: var(--page-text);
  font-weight: 700;
  line-height: 1.3;
}

.surah-item-name-en {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-sec);
  direction: ltr;
  text-align: right;
}

/* Surah stats */
.surah-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0;
}

.surah-type-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.surah-type-badge.makki {
  background: rgba(70,191,255,0.12);
  color: var(--blue-dark);
}
.surah-type-badge.madani {
  background: rgba(52,199,89,0.12);
  color: #22863a;
}
body.dark .surah-type-badge.makki { color: var(--blue); }
body.dark .surah-type-badge.madani { color: #4cdb79; }

.surah-verse-count {
  font-family: var(--font-quran);
  font-size: 10px;
  color: var(--text-ter);
  text-align: center;
  width: 100%;
}

/* Soon badge */
.soon-badge {
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--sys-bg2);
  color: var(--text-ter);
}

/* No results */
.no-results {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-quran);
  font-size: 16px;
  color: var(--text-sec);
  direction: rtl;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 28, 30, 0.88);
  color: #fff;
  font-family: var(--font-quran);
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease-ios);
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
body.dark .toast { background: rgba(70,191,255,0.92); color: #fff; }

/* ── Footer ─────────────────────────────────────────────────── */
/* ── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--page-bg);
  border-top: 0.5px solid var(--separator);
  direction: rtl;
  margin-top: 32px;
}
body.dark .site-footer {
  background: var(--sys-bg2);
  border-top-color: rgba(255,255,255,0.06);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 20px;
}

/* ── Top row ── */
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 20px;
  flex-wrap: wrap;
}

/* Logo */
.footer-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
.footer-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 22%;
  box-shadow: 0 2px 8px rgba(70,191,255,0.22);
}
.footer-logo-wordmark {
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  font-size: 19px;
  line-height: 1;
  direction: ltr;
}
.footer-logo-wordmark strong {
  font-weight: 800;
  color: #1a3a58;
}
body.dark .footer-logo-wordmark strong { color: #e0eaf5; }
.footer-logo-wordmark span {
  font-weight: 700;
  color: var(--blue);
}

/* Nav links */
.footer-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-link {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-sec);
  text-decoration: none;
  padding: 2px 0;
  position: relative;
  transition: color 0.18s;
}
.footer-link::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 0; height: 1px;
  background: var(--blue);
  transition: width 0.22s var(--ease-ios);
}
.footer-link:hover { color: var(--blue-dark); }
.footer-link:hover::after { width: 100%; left: 0; right: auto; }
body.dark .footer-link:hover { color: var(--blue); }

.footer-sep {
  color: var(--text-ter);
  font-size: 13px;
  user-select: none;
}

/* Social icons */
.footer-social {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  text-decoration: none;
  transition: transform 0.18s var(--ease-ios), box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.social-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}
.social-btn.instagram {
  background: radial-gradient(circle at 28% 110%,
    #fdf497 0%, #fd5949 40%, #d6249f 65%, #285AEB 100%);
}
.social-btn.whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

/* ── Verse divider ── */
.footer-verse-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 14px;
  direction: rtl;
}
.footer-verse-line {
  flex: 1;
  height: 0.5px;
  background: linear-gradient(to left, transparent, var(--separator));
}
.footer-verse-line:last-child {
  background: linear-gradient(to right, transparent, var(--separator));
}
.footer-verse {
  font-family: var(--font-quran);
  font-size: 15px;
  color: var(--text-ter);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Copyright ── */
.footer-copy {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-ter);
  direction: rtl;
  letter-spacing: 0.02em;
}

/* ── Footer responsive ── */
@media (max-width: 680px) {
  .footer-top {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 22px 0 16px;
    text-align: center;
  }
  .footer-links { gap: 4px; justify-content: center; }
  .footer-verse  { font-size: 13px; }
  .footer-verse-row { gap: 8px; margin: 2px 0 10px; }
}

/* ── QUICK CATEGORY NAV ─────────────────────────────────────── */
.quick-nav {
  position: sticky;
  top: 60px;          /* sits just below the 60px header */
  z-index: 90;
  background: rgba(242, 242, 247, 0.88);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 0.5px solid rgba(70, 191, 255, 0.14);
  direction: rtl;
}
body.dark .quick-nav {
  background: rgba(28, 28, 30, 0.88);
}

/* Collapsible scroll area */
.quick-nav-wrap {
  overflow: hidden;
  max-height: 62px;
  opacity: 1;
  transition: max-height 0.34s var(--ease-ios), opacity 0.22s var(--ease-ios);
  position: relative;
}
.quick-nav.collapsed .quick-nav-wrap {
  max-height: 0;
  opacity: 0;
}

/* Horizontal scroll strip */
.quick-nav-scroll {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 10px 16px 10px 52px; /* extra left padding for the fade */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  direction: rtl;
}
.quick-nav-scroll::-webkit-scrollbar { display: none; }

/* Left-edge fade → indicates more content */
.qnav-fade {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 52px;
  background: linear-gradient(to right, rgba(242,242,247,1) 30%, transparent);
  pointer-events: none;
  z-index: 1;
  transition: background 0.3s;
}
body.dark .qnav-fade {
  background: linear-gradient(to right, rgba(28,28,30,1) 30%, transparent);
}

/* Individual item pill */
.qnav-item {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--page-bg);
  border: 1px solid rgba(70, 191, 255, 0.18);
  color: var(--page-text);
  font-family: var(--font-quran);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: background 0.18s, border-color 0.18s, color 0.18s,
              box-shadow 0.18s, transform 0.15s;
  cursor: pointer;
  line-height: 1.4;
}
.qnav-item:hover {
  background: var(--blue-bg);
  border-color: var(--blue);
  color: var(--blue-dark);
  box-shadow: 0 3px 10px rgba(70, 191, 255, 0.22);
  transform: translateY(-1px);
}
.qnav-item.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 3px 12px rgba(70, 191, 255, 0.4);
}
body.dark .qnav-item {
  background: var(--sys-bg2);
  border-color: rgba(70, 191, 255, 0.14);
  color: var(--page-text);
}
body.dark .qnav-item:hover {
  background: rgba(70, 191, 255, 0.12);
  color: var(--blue);
}

/* Toggle / collapse bar */
.quick-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 3px 0 4px;
  background: none;
  border: none;
  border-top: 0.5px solid rgba(70, 191, 255, 0.1);
  cursor: pointer;
  color: var(--text-ter);
  font-size: 11px;
  font-family: var(--font-ui);
  transition: background 0.15s, color 0.15s;
  direction: ltr; /* keep icon + label order consistent */
}
.quick-nav-toggle:hover {
  background: rgba(70, 191, 255, 0.06);
  color: var(--blue);
}
.qnav-toggle-label {
  font-size: 10px;
  letter-spacing: 0.03em;
}
.qnav-chevron {
  font-size: 10px;
  transition: transform 0.34s var(--ease-ios);
}
.quick-nav.collapsed .qnav-chevron {
  transform: rotate(180deg);
}

/* Mobile sticky top offset */
@media (max-width: 680px) {
  .quick-nav { top: 54px; }
  .qnav-item { font-size: 13px; padding: 5px 13px; }
  .quick-nav-scroll { gap: 6px; padding: 8px 12px 8px 48px; }
}

/* ── JUZ BOTTOM SHEET ───────────────────────────────────────── */
.juz-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18), 0 -1px 0 rgba(70,191,255,0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-height: 72vh;
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.juz-sheet.open { transform: translateY(0); }

body.dark .juz-sheet {
  background: rgba(28, 28, 30, 0.96);
  box-shadow: 0 -4px 40px rgba(0,0,0,0.5), 0 -1px 0 rgba(70,191,255,0.12);
}

/* Drag handle */
.juz-handle-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 2px;
  cursor: grab;
  flex-shrink: 0;
}
.juz-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--separator);
}
body.dark .juz-handle { background: rgba(255,255,255,0.15); }

/* Sheet header */
.juz-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
  direction: rtl;
}
.juz-sheet-title {
  font-family: var(--font-quran);
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.juz-sheet-title i { color: var(--blue); font-size: 16px; }
body.dark .juz-sheet-title { color: var(--blue); }

/* Card grid */
.juz-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 16px 20px 32px;
  overflow-y: auto;
  direction: rtl;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.juz-grid::-webkit-scrollbar { width: 3px; }
.juz-grid::-webkit-scrollbar-thumb { background: var(--blue-border); border-radius: 3px; }

/* Individual juz card */
.juz-card {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1.5px solid var(--blue-border);
  background: var(--blue-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 4px;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
  direction: rtl;
}
.juz-card:hover:not(.disabled) {
  background: var(--blue);
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(70,191,255,0.38);
}
.juz-card.active {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 4px 14px rgba(70,191,255,0.4);
}
.juz-card.disabled {
  opacity: 0.32;
  cursor: default;
  border-style: dashed;
}

.juz-card-num {
  font-family: var(--font-quran);
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.1;
}
.juz-card.active .juz-card-num,
.juz-card:hover:not(.disabled) .juz-card-num { color: #fff; }
body.dark .juz-card-num { color: var(--blue); }

.juz-card-surah {
  font-family: var(--font-quran);
  font-size: 9px;
  color: var(--text-sec);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.juz-card.active .juz-card-surah,
.juz-card:hover:not(.disabled) .juz-card-surah { color: rgba(255,255,255,0.85); }

/* ── App Promo Banner ───────────────────────────────────────── */
.app-promo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0d88c4 0%, #1aaae8 40%, #46bfff 100%);
  padding: 56px 24px;
}

/* Decorative orbs */
.app-promo-bg { position: absolute; inset: 0; pointer-events: none; }
.promo-orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.18;
  filter: blur(48px);
  background: #fff;
}
.promo-orb-1 { width: 320px; height: 320px; top: -100px; right: -60px; }
.promo-orb-2 { width: 200px; height: 200px; bottom: -60px; left: 10%; }
.promo-orb-3 { width: 140px; height: 140px; top: 40px; left: 38%; opacity: 0.10; }

.app-promo-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
  direction: rtl;
}

/* Icon */
.promo-icon-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.22)) drop-shadow(0 2px 8px rgba(0,0,0,0.12));
  transition: transform 0.4s var(--ease-ios);
}
.promo-icon-wrap:hover { transform: translateY(-4px) scale(1.04); }
.promo-icon {
  width: 100px;
  height: 100px;
  border-radius: 22%;
  object-fit: cover;
  display: block;
}

/* Text */
.promo-text {
  flex: 1;
  color: #fff;
  text-align: right;
}
.promo-eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
  margin: 0 0 6px;
}
.promo-title {
  font-family: var(--font-quran);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 10px;
}
.promo-brand {
  color: #fff;
  text-shadow: 0 0 18px rgba(255,255,255,0.55);
}
.promo-sub {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  opacity: 0.88;
  margin: 0;
  max-width: 400px;
}

/* Badges */
.promo-badges {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.promo-badge-link {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.28s var(--ease-ios), box-shadow 0.28s var(--ease-ios);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.promo-badge-link:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 28px rgba(0,0,0,0.26);
}
.promo-badge {
  display: block;
  height: 44px;
  width: auto;
  max-width: 160px;
}

/* Dark mode adjustments */
body.dark .app-promo {
  background: linear-gradient(135deg, #0a6699 0%, #1291c9 40%, #2aabee 100%);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .header-inner { padding: 0 10px; height: 54px; }
  .nav-link { font-size: 12px; padding: 5px 8px; }
  .main-content { padding: 16px 8px 40px; }
  .book-wrapper { gap: 8px; }
  .nav-arrow { width: 38px; height: 38px; font-size: 14px; }
  .quran-page { min-height: 520px; }
  :root { --size-quran: 20px; --lh-quran: 2.3; }
  .page-frame { margin: 8px; }
  .surah-heading-box { min-width: 190px; padding: 6px 20px; }
  .surah-name-ar { font-size: 17px; }
  .btn-nav { padding: 8px 14px; font-size: 14px; }
  .side-menu { width: 100%; max-width: 100%; }
  .juz-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px 14px 28px; }
  .juz-card-num { font-size: 17px; }

  /* Promo banner — mobile */
  .app-promo { padding: 40px 20px; }
  .app-promo-inner { flex-wrap: wrap; gap: 24px; justify-content: center; text-align: center; }
  .promo-text { text-align: center; }
  .promo-sub { max-width: 100%; }
  .promo-badges { align-items: center; flex-direction: row; justify-content: center; }
  .promo-icon { width: 80px; height: 80px; }
  .promo-title { font-size: 24px; }
}

@media (max-width: 420px) {
  :root { --size-quran: 18px; }
  .quran-page { min-height: 440px; }
  .logo-text { display: none; }
}
