/* ==========================================================================
   Bayan | بيان - Offline Islamic Quran Reader & Search Application
   Theme: Islamic Emerald Green & Gold Luxury Design System
   Author: Youssef Mahmoud
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  /* Emerald Luxury Light Palette (Default) */
  --bg-primary: #FDFBF7;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F6F3EC;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(253, 251, 247, 0.94);
  
  --primary: #0A4D34;
  --primary-hover: #083E2A;
  --primary-light: #EBF4F0;
  --primary-border: #D2E4DC;
  --primary-glow: rgba(10, 77, 52, 0.15);

  --gold: #D4AF37;
  --gold-dark: #9A7C1E;
  --gold-light: #FBF6E2;
  --gold-border: #E8D387;

  --text-main: #1C2B24;
  --text-secondary: #566860;
  --text-muted: #82948C;
  --text-inverse: #FFFFFF;
  --text-arabic: #11261D;

  --border-color: #E6E1D5;
  --border-subtle: #F0EBE0;

  --badge-meccan-bg: #FBF4E4;
  --badge-meccan-text: #8E6B10;
  --badge-medinan-bg: #E8F5EE;
  --badge-medinan-text: #0E6B48;

  --shadow-sm: 0 2px 4px rgba(10, 77, 52, 0.04);
  --shadow-md: 0 4px 14px rgba(10, 77, 52, 0.08);
  --shadow-lg: 0 10px 30px rgba(10, 77, 52, 0.12);
  --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* Typography Scales */
  --font-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', 'Geeza Pro', 'Noto Naskh Arabic', 'KFGQPC Uthman Taha Naskh', serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --quran-font-size: 26px;
  --quran-line-height: 2.3;

  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --footer-height: 48px;
}

/* Dark Slate Theme */
[data-theme="dark"] {
  --bg-primary: #0F1715;
  --bg-surface: #172320;
  --bg-surface-elevated: #1F2E2A;
  --bg-card: #172320;
  --bg-glass: rgba(15, 23, 21, 0.95);

  --primary: #1F8762;
  --primary-hover: #269E74;
  --primary-light: #162E25;
  --primary-border: #2B4E41;
  --primary-glow: rgba(31, 135, 98, 0.25);

  --gold: #E5C358;
  --gold-dark: #C9A533;
  --gold-light: #2A2514;
  --gold-border: #6B571B;

  --text-main: #EBF3F0;
  --text-secondary: #A6BBB2;
  --text-muted: #6E857C;
  --text-inverse: #0F1715;
  --text-arabic: #F6FAF8;

  --border-color: #273832;
  --border-subtle: #1E2D28;

  --badge-meccan-bg: #2B2312;
  --badge-meccan-text: #E5C358;
  --badge-medinan-bg: #142F24;
  --badge-medinan-text: #48D69F;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.6);
}

/* Warm Sepia / Traditional Mushaf Paper Theme */
[data-theme="sepia"] {
  --bg-primary: #F4EBD9;
  --bg-surface: #EFE4CC;
  --bg-surface-elevated: #E5D7BC;
  --bg-card: #EFE4CC;
  --bg-glass: rgba(244, 235, 217, 0.95);

  --primary: #4A3319;
  --primary-hover: #3B2813;
  --primary-light: #E7DCBF;
  --primary-border: #C8B896;
  --primary-glow: rgba(74, 51, 25, 0.15);

  --gold: #B8860B;
  --gold-dark: #8C6504;
  --gold-light: #E6D8B5;
  --gold-border: #CBB47C;

  --text-main: #2E1F0F;
  --text-secondary: #5C4A36;
  --text-muted: #8A755E;
  --text-inverse: #FFF9EE;
  --text-arabic: #221405;

  --border-color: #DACDB3;
  --border-subtle: #E3D7BD;

  --badge-meccan-bg: #E3D1AE;
  --badge-meccan-text: #6A4B0C;
  --badge-medinan-bg: #DCE5D8;
  --badge-medinan-text: #2C5724;
}

/* --- Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
  user-select: text;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--footer-height) + 12px);
}

/* Direction-aware typography */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.arabic-font {
  font-family: var(--font-arabic);
}

/* --- App Container & Layout --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  box-shadow: 0 2px 8px var(--primary-glow);
  font-family: var(--font-arabic);
  font-size: 20px;
  font-weight: bold;
}

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

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title span.arabic-title {
  font-family: var(--font-arabic);
  font-size: 1.25rem;
  color: var(--gold-dark);
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Button & Icon Styling */
.btn-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.btn-icon:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-icon:active {
  transform: scale(0.94);
}

.btn-icon.active {
  background-color: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-inverse);
  border: 1px solid var(--primary-border);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Navigation Tabs Bar */
.nav-tabs-wrapper {
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.nav-tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  color: var(--primary);
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--gold);
}

/* --- Main Layout Container --- */
.main-content {
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

/* View Sections */
.view-section {
  display: none;
  animation: fadeIn 0.2s ease forwards;
}

.view-section.active {
  display: block;
}

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

/* --- Search Bar Container --- */
.search-container {
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  width: 100%;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
}

.search-clear-btn.visible {
  display: flex;
}

.search-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.chip-btn.active {
  background-color: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

/* --- Surah Index Grid --- */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.surah-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.surah-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-border);
  box-shadow: var(--shadow-md);
}

.surah-card.has-data::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 3px;
  height: 100%;
  background: var(--gold);
}

.surah-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.surah-number-badge {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
}

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

.surah-name-latin {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
}

.surah-sub-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.badge-type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-type.meccan {
  background-color: var(--badge-meccan-bg);
  color: var(--badge-meccan-text);
}

.badge-type.medinan {
  background-color: var(--badge-medinan-bg);
  color: var(--badge-medinan-text);
}

.surah-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.surah-name-arabic {
  font-family: var(--font-arabic);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.surah-offline-tag {
  font-size: 0.7rem;
  color: var(--gold-dark);
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* --- Search Results Section --- */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-result-card:hover {
  border-color: var(--gold-border);
}

.search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
}

.search-result-surah {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-result-ayah {
  font-size: 0.8rem;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.search-result-arabic {
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  line-height: 2.2;
  color: var(--text-arabic);
  margin-bottom: 10px;
}

.search-result-trans {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.search-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.highlight-match {
  background-color: rgba(212, 175, 55, 0.3);
  color: var(--text-main);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: bold;
}

/* --- Mushaf Reader View --- */
.mushaf-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.mushaf-topbar {
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.mushaf-surah-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mushaf-surah-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mushaf-surah-title span.ar-title {
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  color: var(--gold-dark);
}

.mushaf-controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-size-control {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px 4px;
}

.font-size-btn {
  background: none;
  border: none;
  color: var(--text-main);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px;
}

.font-size-btn:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.font-size-label {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 4px;
  color: var(--text-secondary);
}

/* Surah Header Ornament */
.surah-header-ornament {
  margin: 20px 16px;
  padding: 16px;
  border: 2px solid var(--gold-border);
  background: linear-gradient(180deg, var(--bg-surface), var(--primary-light));
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.surah-header-title {
  font-family: var(--font-arabic);
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 4px;
}

.surah-header-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.bismillah-block {
  text-align: center;
  font-family: var(--font-arabic);
  font-size: 1.8rem;
  color: var(--primary);
  margin: 24px 0 16px;
  padding: 0 16px;
  line-height: 2.2;
}

/* Mushaf Text Content */
.mushaf-body {
  padding: 24px 20px 40px;
}

.verses-flow-container {
  font-family: var(--font-arabic);
  font-size: var(--quran-font-size);
  line-height: var(--quran-line-height);
  color: var(--text-arabic);
  text-align: justify;
  text-align-last: center;
  direction: rtl;
}

.verse-span {
  display: inline;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.verse-span:hover {
  background-color: var(--gold-light);
}

.verse-span.highlighted {
  background-color: rgba(212, 175, 55, 0.25);
  box-shadow: 0 0 0 2px var(--gold);
}

.verse-number-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dark);
  font-size: 0.88em;
  margin: 0 4px;
  user-select: none;
  font-weight: bold;
  white-space: nowrap;
}

/* Verses List / Detailed Mode */
.verse-item-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s ease;
}

.verse-item-card:last-child {
  border-bottom: none;
}

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

.verse-item-badge {
  font-size: 0.8rem;
  font-weight: 700;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.verse-item-actions {
  display: flex;
  gap: 6px;
}

.verse-item-arabic {
  font-family: var(--font-arabic);
  font-size: var(--quran-font-size);
  line-height: var(--quran-line-height);
  color: var(--text-arabic);
  margin-bottom: 12px;
  direction: rtl;
  text-align: right;
}

.verse-item-translation {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Modals & Drawers --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
  animation: modalFadeIn 0.2s ease forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Tafseer Content inside Modal */
.tafseer-verse-quote {
  font-family: var(--font-arabic);
  font-size: 1.45rem;
  line-height: 2.3;
  color: var(--text-arabic);
  padding: 14px 16px;
  background-color: var(--primary-light);
  border-right: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  direction: rtl;
}

[dir="ltr"] .tafseer-verse-quote {
  border-right: none;
  border-left: 4px solid var(--gold);
}

.tafseer-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tafseer-ar-body {
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--text-main);
  margin-bottom: 20px;
  direction: rtl;
  text-align: justify;
}

.tafseer-en-body {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* --- Bookmarks List --- */
.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.bookmark-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s ease;
}

.bookmark-card:hover {
  border-color: var(--gold-border);
}

.bookmark-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bookmark-surah-title {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

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

.bookmark-text {
  font-family: var(--font-arabic);
  font-size: 1.25rem;
  line-height: 2.1;
  color: var(--text-arabic);
  direction: rtl;
}

.bookmark-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

/* Empty State Box */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 0.88rem;
  max-width: 360px;
  margin: 0 auto 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(var(--footer-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background-color: var(--primary);
  color: var(--text-inverse);
  border: 1px solid var(--gold);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastPop {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Quick Resume Banner --- */
.resume-banner {
  background: linear-gradient(135deg, var(--primary-light), var(--bg-surface));
  border: 1.5px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resume-icon {
  color: var(--gold-dark);
  display: flex;
}

.resume-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary);
}

.resume-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Settings Panel Options --- */
.settings-group {
  margin-bottom: 20px;
}

.settings-group-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.settings-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-options {
  display: flex;
  gap: 8px;
}

.theme-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.theme-btn.active {
  border-color: var(--gold);
  background-color: var(--primary-light);
  color: var(--primary);
}

/* --- Fixed Signature Footer --- */
.app-footer-signature {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background-color: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.signature-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}

.signature-name {
  color: var(--primary);
  font-weight: 700;
}

.signature-gold-dot {
  width: 5px;
  height: 5px;
  background-color: var(--gold);
  border-radius: 50%;
  display: inline-block;
}

/* --- Responsive Adjustments --- */
@media (max-width: 640px) {
  .header-inner {
    padding: 8px 12px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .surah-grid {
    grid-template-columns: 1fr;
  }

  .mushaf-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .mushaf-controls-group {
    justify-content: space-between;
  }

  :root {
    --quran-font-size: 22px;
    --quran-line-height: 2.2;
  }
}

/* ==========================================================================
   Azkar & Digital Rosbaha Module Styles (الأذكار والمسبحة الإلكترونية)
   ========================================================================== */

/* Standalone Digital Rosbaha Card */
.rosbaha-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rosbaha-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--primary), var(--gold));
}

.rosbaha-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.rosbaha-title-group {
  text-align: start;
}

.rosbaha-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-light);
  color: var(--primary);
  margin-bottom: 4px;
}

.rosbaha-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.rosbaha-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.rosbaha-reset-btn:hover {
  color: #b91c1c;
  border-color: #fca5a5;
  background-color: #fef2f2;
}

.rosbaha-display-wrap {
  width: 100%;
  max-width: 380px;
  margin: 0 auto 20px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rosbaha-target-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.rosbaha-target-label {
  font-weight: 600;
}

.rosbaha-target-select {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.rosbaha-counter-screen {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.rosbaha-count-number {
  font-size: 3.2rem;
  font-weight: 800;
  font-family: var(--font-sans);
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: 1px;
  transition: transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rosbaha-count-number.pulse {
  transform: scale(1.12);
  color: var(--gold-dark);
}

.rosbaha-target-progress {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* Large Interactive Tap Target Button */
.rosbaha-tap-button {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #136948, var(--primary) 70%, var(--primary-hover) 100%);
  border: 4px solid var(--gold-border);
  box-shadow: 0 8px 24px var(--primary-glow), inset 0 2px 4px rgba(255, 255, 255, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  margin: 6px 0 10px 0;
}

.rosbaha-tap-button:active {
  transform: scale(0.93);
  box-shadow: 0 2px 10px var(--primary-glow);
}

.rosbaha-tap-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.rosbaha-tap-arabic {
  font-size: 1.7rem;
  font-weight: 800;
  font-family: var(--font-arabic);
  line-height: 1.2;
}

.rosbaha-tap-sub {
  font-size: 0.75rem;
  color: #E2EFEA;
  margin-top: 2px;
  font-weight: 500;
}

/* Azkar Section Header */
.azkar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.azkar-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.azkar-section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.azkar-filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

/* Auto Scroll Recite Controls */
.autoscroll-control-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 2px;
}

.autoscroll-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.autoscroll-toggle-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 0 10px var(--primary-glow);
}

.autoscroll-toggle-btn.active svg {
  stroke: #FFFFFF;
  animation: spinPulse 2s infinite linear;
}

@keyframes spinPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.chip-btn.chip-highlight {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 700;
}

.chip-btn.chip-highlight.active {
  background: linear-gradient(135deg, var(--primary), #083E2A);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Azkar Cards Grid */
.azkar-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.azkar-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.azkar-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
  transform: translateY(-2px);
}

.azkar-card.completed {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--gold-light) 100%);
}

[data-theme="dark"] .azkar-card.completed {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(212, 175, 55, 0.12) 100%);
}

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

.azkar-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.azkar-target-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  gap: 4px;
}

.azkar-arabic-main {
  font-family: var(--font-arabic);
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 2.1;
  color: var(--text-arabic);
  text-align: right;
  direction: rtl;
  margin-bottom: 14px;
  letter-spacing: 0.2px;
}

.azkar-trans-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  font-style: italic;
  direction: ltr;
  text-align: left;
}

[dir="rtl"] .azkar-trans-text {
  direction: ltr;
  text-align: left;
}

.azkar-virtue-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--bg-surface-elevated);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border-right: 3px solid var(--gold);
  margin-bottom: 14px;
}

[dir="ltr"] .azkar-virtue-box {
  border-right: none;
  border-left: 3px solid var(--gold);
}

.azkar-virtue-box svg {
  color: var(--gold-dark);
  flex-shrink: 0;
}

.azkar-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: var(--border-subtle);
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  overflow: hidden;
}

.azkar-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.azkar-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.azkar-item-reset-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--surface-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.azkar-item-reset-btn:hover {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fef2f2;
}

.azkar-tap-counter-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background-color: var(--primary);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.azkar-tap-counter-btn:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.azkar-tap-counter-btn:active {
  transform: scale(0.96);
}

.azkar-tap-counter-btn.done {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #FFFFFF;
}

.azkar-tap-count-num {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.azkar-tap-label {
  font-size: 0.8rem;
  opacity: 0.92;
}

.azkar-single-reset {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.azkar-single-reset:hover {
  color: #b91c1c;
  border-color: #fca5a5;
}

/* ==========================================================================
   Header Rosbaha Button
   ========================================================================== */
.header-rosbaha-btn {
  color: var(--gold-dark);
}
.header-rosbaha-btn:hover {
  background-color: var(--gold-light);
  color: var(--primary);
}

/* ==========================================================================
   Reading Modes Toolbar & Switcher
   ========================================================================== */
.reading-mode-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  padding: 4px;
}

.reading-mode-tabs {
  display: inline-flex;
  background-color: var(--surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.mode-tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--surface-hover);
}

.mode-tab-btn.active {
  background-color: var(--primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.mode-tab-btn.active svg {
  stroke: #FFFFFF;
}

.reader-mode-content {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.reader-mode-content.active {
  display: block;
}

/* ==========================================================================
   Full Mushaf Page Mode & Page Turn Navigation
   ========================================================================== */
.page-navigation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.btn-turn-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-turn-page:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

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

.btn-turn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.page-jump-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 320px;
}

.page-meta-indicator {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-sans);
}

.page-slider-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mushaf-page-slider {
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: var(--border-color);
  accent-color: var(--primary);
  cursor: pointer;
}

/* Authentic Medina Mushaf Page Frame */
.mushaf-page-frame-container {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}

.mushaf-page-frame-container.turn-right-anim {
  animation: pageTurnRight 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mushaf-page-frame-container.turn-left-anim {
  animation: pageTurnLeft 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pageTurnRight {
  0% {
    transform: translateX(30px) rotateY(-4deg);
    opacity: 0.4;
  }
  100% {
    transform: translateX(0) rotateY(0deg);
    opacity: 1;
  }
}

@keyframes pageTurnLeft {
  0% {
    transform: translateX(-30px) rotateY(4deg);
    opacity: 0.4;
  }
  100% {
    transform: translateX(0) rotateY(0deg);
    opacity: 1;
  }
}

.mushaf-page-border {
  border: 3px double var(--gold);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  background-color: var(--surface);
  position: relative;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.page-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--gold-light);
  padding-bottom: 12px;
  margin-bottom: 20px;
  font-family: var(--font-quran);
  font-size: 1.25rem;
  color: var(--gold-dark);
  font-weight: 700;
}

.page-frame-content {
  font-family: var(--font-quran);
  font-size: 1.95rem;
  line-height: 2.3;
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  color: var(--text-primary);
  flex: 1;
}

.page-frame-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1.5px solid var(--gold-light);
  padding-top: 12px;
  margin-top: 24px;
}

.page-footer-number {
  font-family: var(--font-quran);
  font-size: 1.35rem;
  color: var(--gold-dark);
  font-weight: 800;
}

.page-turn-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px;
}

.swipe-hint-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Verses Cards Mode
   ========================================================================== */
.verses-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ayah-card-item {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.ayah-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.ayah-card-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background-color: var(--surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.ayah-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ayah-card-arabic {
  font-family: var(--font-quran);
  font-size: 1.85rem;
  line-height: 2.1;
  text-align: right;
  direction: rtl;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.ayah-card-translation {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px dashed var(--border-subtle);
  padding-top: 10px;
}

/* ==========================================================================
   Interactive Electronic Rosbaha Enhancements
   ========================================================================== */
.dhikr-presets-wrapper {
  margin-bottom: 16px;
}

.dhikr-presets-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dhikr-presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dhikr-preset-btn {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-quran);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dhikr-preset-btn:hover {
  background-color: var(--surface-hover);
  border-color: var(--gold);
}

.dhikr-preset-btn.active {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.active-dhikr-display {
  font-family: var(--font-quran);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  padding: 10px 16px;
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px dashed var(--gold);
  line-height: 1.5;
}

/* Animated Prayer Beads Track & Visual Ring */
.rosbaha-centerpiece-container {
  position: relative;
  width: 290px;
  height: 290px;
  margin: 14px auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beads-ring-visual {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.beads-track-circle {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.bead-spherical {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef08a, var(--gold) 60%, var(--gold-dark) 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.bead-spherical.bead-marker {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle at 35% 30%, #a7f3d0, var(--primary) 65%, #064e3b 100%);
  box-shadow: 0 0 8px var(--primary-glow), inset 0 1px 3px rgba(255, 255, 255, 0.9);
}

.bead-spherical.bead-active {
  transform: translate(-50%, -50%) scale(1.4);
  background: radial-gradient(circle at 35% 30%, #ffffff, #60a5fa 50%, var(--primary) 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), inset 0 1px 2px #fff;
  z-index: 5;
}

/* Central Circular Gauge Dial & Tactile Button */
.rosbaha-dial-wrapper {
  position: relative;
  width: 210px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rosbaha-radial-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.rosbaha-radial-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 6;
  opacity: 0.4;
}

.rosbaha-radial-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 603;
  stroke-dashoffset: 603;
  transition: stroke-dashoffset 0.25s ease, stroke 0.25s ease;
}

.rosbaha-dial-btn {
  width: 184px;
  height: 184px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--surface), var(--bg-surface-elevated) 70%, var(--border-color) 100%);
  border: 3px solid var(--gold-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), inset 0 2px 4px rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  position: relative;
  z-index: 2;
}

.rosbaha-dial-btn:hover {
  box-shadow: 0 10px 28px rgba(0,0,0,0.16), 0 0 14px var(--primary-glow);
}

.rosbaha-dial-btn:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.rosbaha-dial-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.rosbaha-target-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-light);
  color: var(--primary);
  margin-bottom: 2px;
}

.rosbaha-count-number {
  font-size: 3.4rem;
  font-weight: 800;
  font-family: var(--font-sans);
  color: var(--primary);
  line-height: 1;
  letter-spacing: 0.5px;
  transition: transform 0.08s ease, color 0.15s ease;
}

.rosbaha-count-number.pulse {
  transform: scale(1.15);
  color: var(--gold-dark);
}

.rosbaha-tap-action-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Dhikr Presets Header & Custom Add */
.dhikr-presets-wrapper {
  width: 100%;
  margin-bottom: 14px;
}

.dhikr-presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.dhikr-presets-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-custom-dhikr-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-custom-dhikr-add:hover {
  background: var(--primary);
  color: #fff;
}

.dhikr-presets-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.dhikr-preset-btn {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.dhikr-preset-btn:hover {
  color: var(--primary);
  border-color: var(--primary-border);
}

.dhikr-preset-btn.active {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* Active Dhikr Card with Translation */
.active-dhikr-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto 14px auto;
  padding: 12px 16px;
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--gold-border);
  text-align: center;
}

.active-dhikr-display {
  font-family: var(--font-arabic);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.active-dhikr-meaning {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

/* Top Toolbar Action Buttons */
.rosbaha-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rosbaha-tool-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
}

.rosbaha-tool-btn.active {
  background-color: var(--gold-light);
  color: var(--gold-dark);
  border-color: var(--gold);
}

/* Auxiliary Quick Bar (Undo, Target Selector, +10) */
.rosbaha-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 480px;
  gap: 8px;
  margin: 10px 0 16px 0;
  flex-wrap: wrap;
}

.btn-rosbaha-aux {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rosbaha-aux:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.rosbaha-target-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.target-select-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.target-options-group {
  display: inline-flex;
  background: var(--surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 2px;
}

.target-opt-btn {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.target-opt-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Home Quick Rosbaha Feature Card */
.home-rosbaha-card {
  background: linear-gradient(135deg, var(--bg-card), var(--surface-secondary));
  border: 1.5px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-rosbaha-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--primary), var(--gold));
}

.home-rosbaha-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.home-rosbaha-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-rosbaha-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-dark);
}

.home-rosbaha-dhikr {
  font-family: var(--font-arabic);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.home-rosbaha-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.home-rosbaha-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-quick-tap-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #136948, var(--primary) 70%, var(--primary-hover) 100%);
  border: 2px solid var(--gold);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: transform 0.08s ease;
  user-select: none;
}

.home-quick-tap-btn:active {
  transform: scale(0.9);
}

.home-tap-num {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
}

.home-tap-sub {
  font-size: 0.62rem;
  color: #d1fae5;
}

.home-open-azkar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.home-open-azkar-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Fullscreen Immersive Tasbeeh Overlay */
.fullscreen-tasbeeh-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  z-index: 1000;
  display: none;
  flex-direction: column;
  padding: 16px;
  animation: fadeIn 0.2s ease forwards;
}

.fullscreen-tasbeeh-overlay.active {
  display: flex;
}

.fullscreen-tasbeeh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

.fullscreen-target-indicator {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold-dark);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-secondary);
}

.fullscreen-tasbeeh-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 20px;
}

.fullscreen-dhikr-title {
  font-family: var(--font-arabic);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 24px;
}

.fullscreen-counter-box {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--surface), var(--surface-secondary) 75%);
  border: 4px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18), 0 0 20px var(--primary-glow);
  margin-bottom: 30px;
  transition: transform 0.08s ease;
}

.fullscreen-counter-box:active {
  transform: scale(0.94);
}

.fullscreen-counter-num {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--font-sans);
  line-height: 1;
}

.fullscreen-counter-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.fullscreen-progress-line {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: var(--surface-secondary);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.fullscreen-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)) 12px;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg {
  transition: transform 0.15s ease, stroke 0.15s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active svg {
  transform: translateY(-2px);
  stroke: var(--primary);
}

.mobile-nav-item.mob-nav-highlight {
  position: relative;
}

.mobile-nav-item.mob-nav-highlight .mob-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: 1.5px solid var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--primary-glow);
  margin-top: -12px;
  transition: transform 0.15s ease;
}

.mobile-nav-item.mob-nav-highlight.active .mob-icon-wrap {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Responsive adjustments for handheld mobile devices */
@media (max-width: 768px) {
  body {
    padding-bottom: 74px;
  }
  .app-footer-signature {
    margin-bottom: 58px;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .nav-tabs-wrapper {
    display: none; /* Hide duplicate top bar on small screens to give pure native mobile feel */
  }
  .home-rosbaha-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .home-rosbaha-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
  }
}



