/* ==========================================================================
   QUR'ON TAJVID AI — PROFESSIONAL ISLAMIC DESIGN SYSTEM & STYLESHEET
   Themes: Emerald Luxury (Default) | Warm Parchment | Layli Night Mushaf
   ========================================================================== */

:root, [data-theme="emerald"] {
  --bg: #f3f6f4;
  --bg-gradient: radial-gradient(circle at 15% 15%, #eaf3ed 0%, #f3f6f4 60%, #edf2ef 100%);
  --surface: #ffffff;
  --surface-card: #ffffff;
  --surface-sunken: #edf3f0;
  --surface-hover: #f8faf9;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;

  /* Primary Emerald Palette */
  --accent: #059669;
  --accent-dark: #064e3b;
  --accent-deep: #022c22;
  --accent-soft: #ecfdf5;
  --accent-glow: rgba(5, 150, 105, 0.22);
  --accent-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);

  /* Royal Islamic Gold Palette */
  --gold: #d4af37;
  --gold-dark: #b45309;
  --gold-soft: #fefce8;
  --gold-border: #fde047;
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  /* Mushaf Canvas Palette */
  --mushaf-paper: #fffdf7;
  --mushaf-wrapper: #ebe5d3;
  --mushaf-border: #d4af37;
  --mushaf-ink: #0f172a;

  /* Status Colors */
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #ea580c;
  --warning-soft: #fff7ed;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  /* Elevations */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px -2px rgba(6, 78, 59, 0.07), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 36px -6px rgba(6, 78, 59, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
  --shadow-mushaf: 0 12px 32px rgba(6, 78, 59, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.8);

  /* Typography */
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-quran: 'Scheherazade New', 'Amiri Quran', 'Amiri', 'Noto Naskh Arabic', serif;
  --font-calligraphy: 'Reem Kufi', var(--font-quran);
  --quran-size: 24px;
  --quran-lh: 2.3;

  /* Tajweed Rule Palette (High Visibility & Distinct Tones) */
  --c-mad-2: #0284c7;       /* Mad Tabiiy (2 harakat) - Moviy Ko'k (Sky Blue) */
  --c-mad-45: #e11d48;      /* Mad Muttasil/Munfasil (4-5 harakat) - Yoqut Qizil (Crimson) */
  --c-mad-6: #991b1b;       /* Mad Lozim (6 harakat) - To'q Qizil (Deep Ruby) */
  --c-ikhfa: #b45309;       /* Ixfo (Burunda yashirish) - Tilla Qahrabo (Amber Gold) */
  --c-ghunna: #059669;      /* G'unna (2 harakat) - Zumrad Yashil (Emerald) */
  --c-idgham-ghn: #0891b2;  /* Idg'om G'unnali - Feruza (Cyan/Teal) */
  --c-idgham-wghn: #475569; /* Idg'om G'unnasiz - Slate Qoramtir */
  --c-iqlab: #7e22ce;       /* Iqlob (Mimga aylanish) - Qirollik Binafsha (Royal Violet) */
  --c-qalqala: #ea580c;     /* Qalqala (Tebranish: قطب جد) - Olovrang To'q Sariq (Vermilion Orange) */
  --c-izhar: #064e3b;       /* Izhor (Aniq talaffuz) - To'q Qarag'ay (Deep Spruce) */
  --c-silent: #94a3b8;      /* Hamzatul Wasl & Shamsiy - Muted Slate */
}

/* WARM PARCHMENT THEME (VINTAGE MANUSCRIPT) */
[data-theme="parchment"] {
  --bg: #f5eee0;
  --bg-gradient: radial-gradient(circle at 20% 20%, #fbf5e8 0%, #f5eee0 70%, #ebdcc6 100%);
  --surface: #fffdf8;
  --surface-card: #fbf7ee;
  --surface-sunken: #ede2cd;
  --surface-hover: #f7eedc;
  --ink: #292524;
  --ink-secondary: #57534e;
  --muted: #78716c;
  --border: #e7dbbf;
  --border-subtle: #f0e6cf;

  --accent: #92400e;
  --accent-dark: #78350f;
  --accent-deep: #451a03;
  --accent-soft: #fef3c7;
  --accent-glow: rgba(180, 83, 9, 0.2);
  --accent-gradient: linear-gradient(135deg, #b45309 0%, #78350f 100%);

  --gold: #b45309;
  --gold-dark: #78350f;
  --gold-soft: #fffbeb;
  --gold-border: #fcd34d;
  --gold-gradient: linear-gradient(135deg, #d97706 0%, #b45309 100%);

  --mushaf-paper: #fbf5e5;
  --mushaf-wrapper: #dfd1b8;
  --mushaf-border: #c59b27;
  --mushaf-ink: #1c1917;

  --shadow-md: 0 6px 20px -2px rgba(120, 53, 15, 0.08);
  --shadow-lg: 0 18px 36px -6px rgba(120, 53, 15, 0.12);
}

/* LAYLI / NIGHT MUSHAF THEME (DARK MODE) */
[data-theme="dark"] {
  --bg: #090e17;
  --bg-gradient: radial-gradient(circle at 10% 10%, #10192a 0%, #090e17 65%, #05080e 100%);
  --surface: #0f172a;
  --surface-card: #131d33;
  --surface-sunken: #1a2742;
  --surface-hover: #1e2c4a;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --border: #243350;
  --border-subtle: #19243c;

  --accent: #10b981;
  --accent-dark: #059669;
  --accent-deep: #022c22;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-glow: rgba(16, 185, 129, 0.35);
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --gold: #fbbf24;
  --gold-dark: #f59e0b;
  --gold-soft: rgba(251, 191, 36, 0.15);
  --gold-border: #d97706;
  --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);

  --mushaf-paper: #0b1324;
  --mushaf-wrapper: #17233c;
  --mushaf-border: #d4af37;
  --mushaf-ink: #f8fafc;

  --danger-soft: rgba(220, 38, 38, 0.18);
  --warning-soft: rgba(234, 88, 12, 0.18);
  --success-soft: rgba(22, 163, 74, 0.18);
  --info-soft: rgba(2, 132, 199, 0.18);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.7);
  --shadow-mushaf: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.05);

  /* Tajweed High-Contrast Adjustments for Dark Mode */
  --c-mad-2: #38bdf8;
  --c-mad-45: #fb7185;
  --c-mad-6: #f87171;
  --c-ikhfa: #fbbf24;
  --c-ghunna: #34d399;
  --c-idgham-ghn: #22d3ee;
  --c-idgham-wghn: #94a3b8;
  --c-iqlab: #c084fc;
  --c-qalqala: #fb923c;
  --c-izhar: #6ee7b7;
  --c-silent: #64748b;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.7); }

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
header.app-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] header.app-header {
  background: rgba(15, 23, 42, 0.88);
}
[data-theme="parchment"] header.app-header {
  background: rgba(255, 253, 248, 0.92);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-emblem {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 6px 16px var(--accent-glow);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-emblem::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .brand-title {
  color: #fff;
}

.brand-title .badge-v2 {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
  font-weight: 800;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* Nav Tabs (Desktop Segmented Bar) */
.nav-tabs-container {
  display: flex;
  align-items: center;
  background: var(--surface-sunken);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  gap: 2px;
}

.nav-tabs-container button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-tabs-container button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
}

.nav-tabs-container button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .nav-tabs-container button.active {
  background: var(--surface-card);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Header Action Right (Theme & Profile) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-icon {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-logout-icon:hover {
  background: var(--danger-soft);
}

/* ==========================================================================
   MAIN LAYOUT & VIEWS
   ========================================================================== */
main.app-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 100px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   UNIVERSAL CARDS & CONTAINERS
   ========================================================================== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.card:hover {
  border-color: rgba(5, 150, 105, 0.3);
}

.card-title {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   TOOLBARS & CONTROL BARS
   ========================================================================== */
.font-toolbar {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.font-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-ctrl-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.font-btn {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}

.font-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: scale(1.02);
}

.font-btn:active {
  transform: scale(0.96);
}

.font-size-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 6px;
}

.font-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  font-family: var(--font-ui);
  cursor: pointer;
}

.font-select:focus {
  border-color: var(--accent);
}

/* Controls Bar (Filter/Select/Navigation Row) */
.controls-bar {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.controls-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.control-item select, 
.control-item input[type="number"], 
.control-item input[type="text"], 
.control-item input[type="date"], 
.control-item input[type="password"] {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  font-family: var(--font-ui);
  transition: all 0.15s;
}

.control-item select:focus, 
.control-item input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Switcher Buttons (View Switch: Mushaf vs Cards) */
.view-switch {
  display: flex;
  background: var(--surface-sunken);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 3px;
}

.view-switch button {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-ui);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-switch button:hover {
  color: var(--ink);
}

.view-switch button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   TAJWEED QUICK LEGEND BAR & TOOLTIPS
   ========================================================================== */
.quick-legend {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.quick-legend-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-legend-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s;
}

.quick-legend-link:hover {
  transform: translateX(2px);
}

.quick-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.legend-chip:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.legend-chip.active-filter {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

/* Tajweed Markup Class Definitions (Crystal Clear Visibility & Live Tooltips) */
tajweed {
  display: inline;
  font-family: inherit;
  font-size: inherit;
  transition: all 0.15s ease;
  border-radius: 4px;
  cursor: pointer;
  padding: 0 1.5px;
  position: relative;
}

tajweed:hover, tajweed:focus, tajweed.active-tajweed-rule {
  filter: brightness(1.2);
  outline: 2px solid var(--gold);
  background-color: rgba(251, 191, 36, 0.2) !important;
}

.ham_wasl, .laam_shamsiyah, .slnt, .sl {
  color: var(--c-silent) !important;
  opacity: 0.65;
}
.madda_normal, .madda_letter {
  color: var(--c-mad-2) !important;
  font-weight: 700 !important;
}
.madda_permissible, .madda_jaiz, .madda_obligatory_short, .madda_muttasil, .madda_munfasil {
  color: var(--c-mad-45) !important;
  font-weight: 700 !important;
}
.madda_obligatory, .madda_lazim, .madda_necessary, .madda_necessary_long {
  color: var(--c-mad-6) !important;
  font-weight: 800 !important;
  text-decoration: underline;
  text-decoration-color: var(--c-mad-6);
  text-underline-offset: 4px;
}
.ikhafa, .ikhf_shfw, .ikhfa_shafawi, .ikhfa {
  color: var(--c-ikhfa) !important;
  font-weight: 700 !important;
  background: rgba(180, 83, 9, 0.09);
  border-radius: 3px;
  padding: 0 2px;
}
.ghunnah, .ghn {
  color: var(--c-ghunna) !important;
  font-weight: 700 !important;
  background: rgba(5, 150, 105, 0.09);
  border-radius: 3px;
  padding: 0 2px;
}
.idgham_ghunnah, .idgham_shafawi, .idgh_ghn, .idgh_w_ghn {
  color: var(--c-idgham-ghn) !important;
  font-weight: 700 !important;
}
.idgham_wo_ghunnah, .idgham_mutajanisayn, .idgh_w_o_ghn {
  color: var(--c-idgham-wghn) !important;
  font-weight: 700 !important;
}
.iqlab, .iqlb {
  color: var(--c-iqlab) !important;
  font-weight: 800 !important;
  background: rgba(126, 34, 206, 0.09);
  border-radius: 3px;
  padding: 0 2px;
}
.qalaqah, .qlq {
  color: var(--c-qalqala) !important;
  font-weight: 800 !important;
  text-shadow: 0 0 1px rgba(234, 88, 12, 0.4);
}
.izhar, .izhar_shafawi, .izhr {
  color: var(--c-izhar) !important;
  font-weight: 700 !important;
}

/* ============ FLOATING INTERACTIVE TAJWEED TOOLTIP ============ */
.tajweed-floating-tooltip {
  position: fixed;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--gold-border);
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-ui);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 320px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
}
.tajweed-floating-tooltip.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tajweed-tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tajweed-tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tajweed-tooltip-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.tajweed-tooltip-body {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.5;
}
.tajweed-tooltip-example {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

/* ============ SAJDAH TILAWAT NOTIFICATION & BADGES ============ */
.mushaf-sajdah-ribbon {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.08) 100%);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 10px 16px;
  margin: 12px 18px 16px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: sajdahGlow 2.8s infinite alternate;
}
.mushaf-sajdah-ribbon:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.26) 0%, rgba(217, 119, 6, 0.15) 100%);
  transform: translateY(-1px);
}
@keyframes sajdahGlow {
  0% { box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15); }
  100% { box-shadow: 0 4px 22px rgba(245, 158, 11, 0.38); }
}
.sajdah-ribbon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gold-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.sajdah-ribbon-msg {
  flex: 1;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}
.sajdah-ribbon-link {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-dark);
  white-space: nowrap;
  background: var(--surface);
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid var(--gold-border);
}

.mushaf-sajdah-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin: 0 4px;
  border-radius: 20px;
  background: var(--gold-gradient);
  color: #fff !important;
  font-family: var(--font-ui) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.45);
  vertical-align: middle;
  animation: pulseGlow 2.5s infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.95; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.is-sajdah-verse {
  background: rgba(245, 158, 11, 0.1);
  border-radius: 10px;
  padding: 4px 6px;
  border: 1px dashed var(--gold-border);
}

.card-sajdah-alert {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.06) 100%);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sajdah-icon-big {
  font-size: 24px;
  color: var(--gold-dark);
}

/* ============ SURFACE DECLUTTERING & COMPACT CONTROLS ============ */
.btn-mushaf-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--surface-sunken);
  border: 1.5px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-ui);
}
.btn-mushaf-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.btn-bookmark-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 20px;
  background: var(--surface-sunken);
  border: 1.5px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-ui);
}
.btn-bookmark-pill:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-dark);
}

/* Streamlined Modern Controls Bar */
.mushaf-compact-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.toolbar-nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-round-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-round-btn:hover {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}
.page-jump-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-sunken);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.page-jump-input {
  width: 48px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: var(--accent-dark);
  outline: none;
}

/* Mushaf Drawer Tabs */
.drawer-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-sunken);
  border-radius: 14px;
  margin-bottom: 18px;
}
.drawer-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-ui);
}
.drawer-tab.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.tajweed-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}
.tajweed-rule-card {
  padding: 10px 12px;
  background: var(--surface-sunken);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tajweed-rule-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tajweed-rule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tajweed-rule-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
}
.tajweed-rule-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.tajweed-rule-sample {
  font-family: var(--font-quran);
  font-size: 18px;
  direction: rtl;
  color: var(--ink);
  margin-top: 4px;
  text-align: right;
}

.sajdah-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}
.sajdah-card-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-sunken);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}
.sajdah-card-btn:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  transform: translateY(-1px);
}


/* ==========================================================================
   HOME VIEW HERO & WIDGETS
   ========================================================================== */
.home-hero-card {
  background: var(--accent-gradient);
  color: #fff;
  padding: 28px;
  border-radius: 22px;
  margin-bottom: 22px;
  box-shadow: 0 12px 32px var(--accent-glow);
  position: relative;
  overflow: hidden;
}

.home-hero-card::before {
  content: '۞';
  position: absolute;
  right: -20px;
  bottom: -35px;
  font-size: 180px;
  color: rgba(255, 255, 255, 0.07);
  pointer-events: none;
  font-family: var(--font-quran);
  line-height: 1;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
  backdrop-filter: blur(4px);
}

.home-hero-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.home-hero-card .hero-desc {
  opacity: 0.92;
  font-size: 14px;
  line-height: 1.6;
  max-width: 640px;
  margin-bottom: 20px;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.hero-stat-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}

.hero-stat-num {
  font-size: 22px;
  font-weight: 800;
  display: block;
}

.hero-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  opacity: 0.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn-primary {
  background: #ffffff;
  color: var(--accent-dark);
  border: none;
  padding: 11px 22px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost-hero {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.btn-ghost-hero:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

/* ==========================================================================
   BOOKMARK HERO & RIBBON SYSTEM
   ========================================================================== */
.bookmark-hero-card {
  background: var(--surface-card);
  border: 1.5px solid var(--gold-border);
  border-radius: 20px;
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.12);
  position: relative;
  overflow: hidden;
}

.bookmark-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  background: var(--gold-gradient);
}

.bm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bm-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-dark);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bm-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.bm-snippet {
  font-family: var(--font-quran);
  font-size: 21px;
  color: var(--ink);
  direction: rtl;
  text-align: right;
  margin: 10px 0 16px;
  line-height: 1.8;
  background: var(--surface-sunken);
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px dashed var(--gold-border);
  word-spacing: 2px;
}

.bm-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Authentic Silk Satin Bookmark Ribbon in Mushaf Frame */
.mushaf-bookmark-ribbon {
  position: absolute;
  top: -6px;
  right: 36px;
  width: 32px;
  height: 56px;
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 65%, #991b1b 100%);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  cursor: pointer;
  z-index: 25;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
}

.mushaf-bookmark-ribbon::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 13px solid #991b1b;
}

.mushaf-bookmark-ribbon:hover {
  height: 68px;
  filter: brightness(1.15);
  transform: translateY(2px);
}

.mushaf-bookmark-ribbon.inactive {
  height: 26px;
  opacity: 0.45;
  background: linear-gradient(180deg, #9ca3af 0%, #64748b 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.mushaf-bookmark-ribbon.inactive::after {
  border-top-color: #64748b;
}

.mushaf-bookmark-ribbon.inactive:hover {
  opacity: 0.95;
  height: 52px;
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}

.mushaf-bookmark-ribbon.inactive:hover::after {
  border-top-color: #b91c1c;
}

.mushaf-bookmark-ribbon .ribbon-icon {
  font-size: 14px;
  color: #fef08a;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  user-select: none;
}

/* ==========================================================================
   AUTHENTIC MADINAH MUSHAF FRAME
   ========================================================================== */
.mushaf-book-wrapper {
  background: var(--mushaf-wrapper);
  padding: 14px;
  border-radius: 22px;
  box-shadow: var(--shadow-mushaf);
  margin-bottom: 24px;
  position: relative;
}

.mushaf-page-frame {
  background: var(--mushaf-paper);
  border: 5px double var(--mushaf-border);
  border-radius: 14px;
  padding: 24px 26px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  position: relative;
  direction: rtl;
}

/* Corner Gilded Rosettes */
.mushaf-page-frame::before {
  content: '۞';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 16px;
  color: var(--gold);
}

.mushaf-header-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px;
  margin-bottom: 16px;
  direction: ltr;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-dark);
}

[data-theme="dark"] .mushaf-header-ribbon {
  color: var(--gold);
}

.mushaf-header-box {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 3px 12px;
  border-radius: 8px;
  color: var(--gold-dark);
}

/* Surah Header Ornamental Banner */
.surah-ornament-header {
  background: radial-gradient(circle, #0e5c3b 0%, #064028 100%);
  border: 3px solid var(--gold);
  color: #fef08a;
  padding: 10px 18px;
  border-radius: 12px;
  text-align: center;
  margin: 16px 0 18px;
  font-family: var(--font-quran);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(6, 64, 40, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  direction: rtl;
}

.surah-ornament-side {
  font-size: 12px;
  color: #fef9c3;
  font-family: var(--font-ui);
  font-weight: 700;
}

.bismillah-calligraphy {
  text-align: center;
  font-family: var(--font-quran);
  font-size: 24px;
  color: var(--accent-dark);
  margin: 10px 0 16px;
  font-weight: 700;
  line-height: 1.6;
}

[data-theme="dark"] .bismillah-calligraphy {
  color: #fef08a;
}

.mushaf-body-text {
  font-family: var(--font-quran);
  font-size: var(--quran-size, 24px);
  line-height: var(--quran-lh, 2.3);
  text-align: justify;
  text-align-last: center;
  color: var(--mushaf-ink);
  word-spacing: 3px;
}

.mushaf-verse-span {
  cursor: pointer;
  border-radius: 8px;
  padding: 3px 4px;
  transition: all 0.15s ease-out;
  display: inline;
}

.mushaf-verse-span:hover {
  background: var(--gold-soft);
}

.mushaf-verse-span.active {
  background: #fde047;
  color: #111827;
  box-shadow: 0 0 0 3px #ca8a04;
}

.mushaf-verse-span.is-bookmarked {
  background: rgba(234, 179, 8, 0.24);
  box-shadow: 0 0 0 2px var(--gold), 0 3px 12px rgba(212, 175, 55, 0.25);
  border-radius: 8px;
}

.mushaf-ayah-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-quran);
  color: var(--gold);
  font-size: 18px;
  margin: 0 5px;
  font-weight: 800;
  vertical-align: middle;
  user-select: none;
}

.mushaf-footer-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--gold);
  padding-top: 8px;
  margin-top: 18px;
  direction: ltr;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-dark);
}

[data-theme="dark"] .mushaf-footer-ribbon {
  color: var(--gold);
}

/* ============ MOBILE-FRIENDLY MUSHAF PAGER ============ */
.mushaf-mobile-pager {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px dashed var(--gold-border);
  direction: ltr;
}

.btn-pager-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
}

.btn-pager-nav:active {
  transform: scale(0.97);
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.pager-center-info {
  font-weight: 800;
  font-size: 13px;
  color: var(--gold-dark);
  min-width: 60px;
  text-align: center;
}

@media (max-width: 768px) {
  .mushaf-mobile-pager {
    display: flex;
  }
}

/* ==========================================================================
   PAGE AUDIO & RECORDING TOOLBAR
   ========================================================================== */
.page-audio-bar {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  direction: ltr;
}

.page-audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Action Buttons (Record, Listen, Pause, AI) */
.btn {
  border: none;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-listen {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-listen:hover:not(:disabled) {
  background: var(--accent-dark);
}
.btn-listen.playing {
  background: var(--danger);
  animation: pulseListen 1.5s infinite;
}
@keyframes pulseListen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.btn-record {
  background: var(--surface);
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn-record:hover:not(:disabled) {
  background: var(--danger-soft);
}
.btn-record.recording {
  background: var(--danger);
  color: #fff;
  animation: pulseRecord 1.2s infinite;
}
@keyframes pulseRecord {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}

.btn-pause {
  background: var(--warning);
  color: #fff;
}
.btn-pause:hover:not(:disabled) {
  background: #c2410c;
}

.btn-play {
  background: var(--info);
  color: #fff;
}
.btn-play:hover:not(:disabled) {
  background: #0369a1;
}

.btn-ai {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.btn-ai:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
}

.btn-ghost {
  background: var(--surface-sunken);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--muted);
}

.rec-status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

/* ==========================================================================
   AYAH CARDS (STUDY / PRACTICE MODE)
   ========================================================================== */
.ayah-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 20px;
  direction: rtl;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.ayah-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.ayah-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ayah-card.extra {
  border-right: 5px solid var(--warning);
}

.ayah-meta {
  direction: ltr;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
  font-weight: 700;
}

.ayah-text {
  font-family: var(--font-quran);
  font-size: var(--quran-size, 24px);
  line-height: var(--quran-lh, 2.3);
  color: var(--ink);
  text-align: right;
  word-spacing: 3px;
}

.recorder-box {
  direction: ltr;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ==========================================================================
   GEMINI AI RESULTS DASHBOARD & SCORE GAUGE
   ========================================================================== */
.ai-result {
  direction: ltr;
  margin-top: 16px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.ai-score-card {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ai-score-radial {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.ai-score-radial.excellent { background: linear-gradient(135deg, #16a34a, #15803d); }
.ai-score-radial.good { background: linear-gradient(135deg, #059669, #047857); }
.ai-score-radial.medium { background: linear-gradient(135deg, #eab308, #ca8a04); }
.ai-score-radial.low { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.ai-score-info {
  flex: 1;
}

.ai-score-verdict {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.ai-score-bar-track {
  height: 10px;
  background: var(--surface-sunken);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ai-score-bar-fill {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

/* Mistakes Diagnostics */
.ai-mistakes-title {
  margin: 16px 0 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 800;
}

.mistake-item {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  border-left: 5px solid;
  font-size: 13px;
  line-height: 1.6;
}

.mistake-item.kichik {
  background: #fefce8;
  border-color: #eab308;
  color: #854d0e;
}
.mistake-item.orta {
  background: #fff7ed;
  border-color: #ea580c;
  color: #9a3412;
}
.mistake-item.jiddiy {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

[data-theme="dark"] .mistake-item.kichik { background: rgba(234, 179, 8, 0.12); color: #fef08a; }
[data-theme="dark"] .mistake-item.orta { background: rgba(234, 88, 12, 0.12); color: #fed7aa; }
[data-theme="dark"] .mistake-item.jiddiy { background: rgba(220, 38, 38, 0.14); color: #fecaca; }

.mistake-word {
  font-family: var(--font-quran);
  font-size: 22px;
  direction: rtl;
  display: inline-block;
  margin-right: 8px;
  font-weight: 700;
}

.mistake-rule {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  margin-left: 6px;
  font-weight: 800;
  text-transform: uppercase;
}

.ai-strengths {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 13px;
  color: var(--accent-dark);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .ai-strengths {
  color: #6ee7b7;
}

.ai-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--gold-dark);
  padding: 10px 14px;
  background: var(--gold-soft);
  border-radius: 10px;
  border: 1px solid var(--gold-border);
}

/* ==========================================================================
   FLOATING MINI AUDIO PLAYER SUITE
   ========================================================================== */
.floating-audio-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  width: calc(100% - 32px);
  max-width: 820px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 12px 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-glow);
  color: #fff;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}

.floating-audio-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.float-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.float-player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.float-player-texts {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.float-player-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.float-player-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Equalizer Dancing Bars */
.audio-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
}

.audio-equalizer span {
  width: 3px;
  background: var(--accent);
  border-radius: 9999px;
  height: 100%;
  animation: eqBounce 1s infinite ease-in-out;
}

.audio-equalizer span:nth-child(1) { animation-delay: 0.1s; }
.audio-equalizer span:nth-child(2) { animation-delay: 0.3s; }
.audio-equalizer span:nth-child(3) { animation-delay: 0.2s; }
.audio-equalizer span:nth-child(4) { animation-delay: 0.4s; }

@keyframes eqBounce {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

.float-player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.float-ctrl-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}

.float-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
}

.float-ctrl-btn.play-btn {
  background: var(--accent);
  width: 42px;
  height: 42px;
  font-size: 16px;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.float-ctrl-btn.play-btn:hover {
  background: var(--accent-dark);
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION BAR
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 6px 12px;
  z-index: 900;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(15, 23, 42, 0.95);
}
[data-theme="parchment"] .mobile-bottom-nav {
  background: rgba(255, 253, 248, 0.96);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  transition: all 0.15s;
}

.mobile-nav-item .nav-icon {
  font-size: 18px;
}

.mobile-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   MODALS & TOAST NOTIFICATIONS
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active,
.modal-overlay.visible {
  display: flex;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: var(--surface-card);
  border-radius: 22px;
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .modal-title { color: #fff; }

.modal-close-btn {
  border: none;
  background: var(--surface-sunken);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--accent-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE BREAKPOINTS)
   ========================================================================== */
@media (max-width: 900px) {
  .nav-tabs-container {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  main.app-main {
    padding-bottom: 90px;
  }
}

@media (max-width: 640px) {
  header.app-header {
    padding: 10px 14px;
  }
  .brand-title {
    font-size: 16px;
  }
  .user-name-text {
    display: none;
  }
  .home-hero-card {
    padding: 18px 16px;
  }
  .home-hero-card h2 {
    font-size: 19px;
  }

  /* Compact Mushaf on Mobile */
  .mushaf-book-wrapper {
    padding: 5px;
    border-radius: 14px;
    margin-bottom: 16px;
  }
  .mushaf-page-frame {
    padding: 14px 10px 16px;
    border-width: 3px;
    border-radius: 10px;
  }
  .mushaf-page-frame::before {
    font-size: 12px;
    top: 2px;
    right: 3px;
  }
  .mushaf-body-text {
    font-size: var(--quran-size, 21px);
    line-height: 2.15;
    word-spacing: 1.5px;
    text-align: justify;
    text-align-last: center;
  }
  .surah-ornament-header {
    font-size: 17px;
    padding: 8px 12px;
    margin: 10px 0 14px;
    border-radius: 10px;
  }
  .surah-ornament-side {
    font-size: 11px;
  }
  .bismillah-calligraphy {
    font-size: 20px;
    margin: 8px 0 12px;
  }
  .mushaf-ayah-num {
    font-size: 16px;
    margin: 0 3px;
  }
  .mushaf-header-ribbon {
    font-size: 11px;
    padding-bottom: 6px;
    margin-bottom: 12px;
  }
  .mushaf-header-box {
    padding: 2px 8px;
    font-size: 11px;
  }
  .mushaf-footer-ribbon {
    font-size: 11px;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 6px;
    margin-top: 14px;
  }
  .mushaf-compact-toolbar {
    padding: 8px 10px;
    gap: 8px;
    border-radius: 14px;
  }
  .page-jump-box {
    gap: 4px;
    padding: 3px 6px;
  }
  .page-jump-input {
    width: 44px;
    padding: 3px;
    font-size: 12px;
  }
  .nav-round-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .floating-audio-bar {
    bottom: 64px;
    padding: 8px 12px;
    width: calc(100% - 20px);
  }
  .mushaf-sajdah-ribbon {
    font-size: 11.5px;
    padding: 8px 10px;
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
  .btn-sajdah-action {
    width: 100%;
    text-align: center;
    padding: 4px 10px;
  }
}

@media (max-width: 420px) {
  .mushaf-body-text {
    font-size: var(--quran-size, 19.5px);
    line-height: 2.1;
  }
  .mushaf-page-frame {
    padding: 10px 6px 12px;
  }
  .mushaf-compact-toolbar select {
    font-size: 11px;
    padding: 4px 6px;
  }
}
