/* ===================================================================
   ذِكْر (Thakr) — Islamic Companion App
   iOS-matched stylesheet · RTL · Mobile-first
   =================================================================== */

/* ----- Custom Properties ----- */
:root {
  --teal: #0D6B59;
  --emerald: #1A8C6B;
  --gold: #C7A852;
  --dark-teal: #054033;
  --bg: #F2F2F7;
  --card-bg: #FFFFFF;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --text-primary: #1C1C1E;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-quran: "Amiri", "Traditional Arabic", serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tab-height: 56px;
  --header-height: 56px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
  overflow-x: hidden;
}

#main-content {
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: var(--teal);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ===================================================================
   2. Tab Bar
   =================================================================== */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  padding-bottom: var(--safe-bottom);
  z-index: 90;
  transition: transform var(--transition-normal);
}

#tab-bar.tab-bar-hidden {
  transform: translateX(-50%) translateY(100%);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 50px;
  padding: 6px 0 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.tab-btn svg {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-fast);
}

.tab-btn.active {
  color: var(--teal);
}

.tab-btn.active svg {
  transform: scale(1.08);
}

.tab-btn:active {
  transform: scale(0.9);
}

/* ===================================================================
   3. Navigation Header
   =================================================================== */
.nav-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 16px;
  padding-top: var(--safe-top);
  background: rgba(242, 242, 247, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  z-index: 80;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--teal);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.back-btn:active {
  background: rgba(13, 107, 89, 0.1);
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 36px;
}

.nav-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--teal);
  transition: background var(--transition-fast);
}

.nav-actions button:active {
  background: rgba(13, 107, 89, 0.1);
}

/* ===================================================================
   4. Cards
   =================================================================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.card + .card {
  margin-top: 12px;
}

.hero-card {
  background: linear-gradient(135deg, var(--dark-teal) 0%, var(--teal) 50%, var(--emerald) 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -30%;
  left: -20%;
  width: 70%;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-card .hero-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hero-card .hero-subtitle {
  font-size: 14px;
  opacity: 0.85;
}

.hero-card .hero-value {
  font-size: 40px;
  font-weight: 700;
  font-family: var(--font-quran);
  margin-top: 12px;
}

.prayer-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.prayer-card .prayer-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(13, 107, 89, 0.1);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prayer-card .prayer-info {
  flex: 1;
}

.prayer-card .prayer-name {
  font-size: 15px;
  font-weight: 600;
}

.prayer-card .prayer-time-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.prayer-card .prayer-time-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--teal);
  flex-shrink: 0;
}

/* ===================================================================
   5. Section Helpers
   =================================================================== */
.section {
  padding: 0 16px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  padding: 0 4px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.section-row .see-all {
  font-size: 14px;
  color: var(--teal);
  font-weight: 500;
}

/* ===================================================================
   6. Quran — Surah List
   =================================================================== */
.surah-list {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.surah-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  transition: background var(--transition-fast);
  cursor: pointer;
}

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

.surah-row:active {
  background: rgba(0, 0, 0, 0.03);
}

.surah-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  transform: rotate(45deg);
  border: 1.5px solid var(--teal);
  border-radius: 8px;
  flex-shrink: 0;
}

.surah-number span {
  transform: rotate(-45deg);
}

.surah-info {
  flex: 1;
  min-width: 0;
}

.surah-name-ar {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-quran);
  line-height: 1.4;
}

.surah-details {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.surah-meta {
  text-align: left;
  flex-shrink: 0;
}

.surah-type {
  font-size: 12px;
  color: var(--text-secondary);
}

.surah-ayah-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ===================================================================
   7. Quran — Reader
   =================================================================== */
.quran-reader {
  padding-bottom: 24px;
}

.bismillah {
  text-align: center;
  font-family: var(--font-quran);
  font-size: 26px;
  color: var(--teal);
  padding: 24px 16px 20px;
  line-height: 1.8;
}

.verse-row {
  padding: 16px 20px;
  position: relative;
}

.verse-row:nth-child(even) {
  background: rgba(13, 107, 89, 0.02);
}

.verse-text {
  font-family: var(--font-quran);
  font-size: 24px;
  line-height: 2;
  text-align: right;
  color: var(--text-primary);
  word-spacing: 4px;
}

.verse-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--teal);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  margin-inline-start: 8px;
  vertical-align: middle;
  font-family: var(--font-body);
}

.verse-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.04);
}

.verse-actions button {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--transition-fast);
}

.verse-actions button:active {
  background: rgba(0, 0, 0, 0.04);
}

.sajda-badge {
  display: inline-block;
  background: var(--gold);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-inline-start: 6px;
  vertical-align: middle;
}

.page-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.page-divider::before,
.page-divider::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--text-tertiary);
}

.juz-badge {
  display: inline-block;
  background: rgba(13, 107, 89, 0.08);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  text-align: center;
  margin: 8px 20px;
}

/* ===================================================================
   8. Azkar — Categories & Cards
   =================================================================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.category-card {
  background: linear-gradient(145deg, var(--teal) 0%, var(--emerald) 100%);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.category-card::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -30%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.category-card:active {
  transform: scale(0.97);
}

.category-card .category-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.category-card .category-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.category-card .category-count {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
}

.category-card.variant-gold {
  background: linear-gradient(145deg, #8B7530, var(--gold));
}

.category-card.variant-dark {
  background: linear-gradient(145deg, var(--dark-teal), var(--teal));
}

.zikr-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
  margin-bottom: 12px;
  position: relative;
}

.zikr-card .zikr-text {
  font-family: var(--font-quran);
  font-size: 20px;
  line-height: 1.9;
  margin-bottom: 10px;
}

.zikr-card .zikr-reference {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.zikr-card .zikr-translation {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
  padding-top: 10px;
  margin-top: 10px;
}

.counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--teal);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
}

.zikr-repeat {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: rgba(13, 107, 89, 0.1);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  border-radius: 14px;
  padding: 0 8px;
}

/* ===================================================================
   9. Zikr Detail — Fullscreen Overlay
   =================================================================== */
.zikr-detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.zikr-detail-overlay .detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
}

.zikr-detail-overlay .detail-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.zikr-detail-overlay .detail-text {
  font-family: var(--font-quran);
  font-size: 26px;
  line-height: 2;
  max-width: 100%;
  margin-bottom: 16px;
}

.zikr-detail-overlay .detail-translation {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 90%;
}

.zikr-counter-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--teal);
  color: #FFFFFF;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 20px rgba(13, 107, 89, 0.35);
}

.zikr-counter-btn:active {
  transform: scale(0.93);
}

.zikr-counter-btn .progress-ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  transform: rotate(-90deg);
}

.zikr-counter-btn .progress-ring circle {
  fill: none;
  stroke-width: 3;
}

.zikr-counter-btn .progress-ring .ring-bg {
  stroke: rgba(13, 107, 89, 0.15);
}

.zikr-counter-btn .progress-ring .ring-fill {
  stroke: var(--gold);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-normal);
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.detail-nav button {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.detail-nav button:active {
  background: rgba(13, 107, 89, 0.08);
}

.detail-nav button:disabled {
  color: var(--text-tertiary);
}

.detail-counter-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===================================================================
   10. Tasbih
   =================================================================== */
.tasbih-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--tab-height) - var(--safe-bottom) - var(--header-height));
  padding: 24px 16px;
  text-align: center;
}

.tasbih-count {
  font-size: 72px;
  font-weight: 700;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 8px;
}

.tasbih-target {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.tasbih-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dark-teal), var(--teal), var(--emerald));
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  box-shadow: 0 8px 32px rgba(13, 107, 89, 0.3);
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
}

.tasbih-circle::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(13, 107, 89, 0.25);
  pointer-events: none;
}

.tasbih-circle::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(13, 107, 89, 0.1);
  pointer-events: none;
}

.tasbih-circle:active {
  transform: scale(0.95);
}

.tasbih-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
}

.tasbih-controls button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}

.tasbih-controls button:active {
  transform: scale(0.9);
}

.tasbih-total {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 24px;
}

.dhikr-selector {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
  z-index: 95;
  padding: 12px 0;
  padding-bottom: var(--safe-bottom);
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform var(--transition-slow);
}

.dhikr-selector.hidden {
  transform: translateX(-50%) translateY(100%);
}

.dhikr-selector .sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.dhikr-selector .dhikr-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  transition: background var(--transition-fast);
}

.dhikr-selector .dhikr-option:active {
  background: rgba(0, 0, 0, 0.03);
}

.dhikr-selector .dhikr-option.selected {
  color: var(--teal);
  font-weight: 600;
}

/* ===================================================================
   11. Prayer Times
   =================================================================== */
.prayer-grid {
  display: grid;
  gap: 10px;
}

.prayer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow);
  transition: border-color var(--transition-fast);
  border: 1.5px solid transparent;
}

.prayer-item .prayer-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(13, 107, 89, 0.08);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prayer-item .prayer-item-name {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
}

.prayer-item .prayer-item-time {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  flex-shrink: 0;
}

.prayer-item.next-prayer-highlight {
  border-color: var(--teal);
  background: rgba(13, 107, 89, 0.04);
}

.prayer-item.next-prayer-highlight .prayer-item-name {
  color: var(--teal);
  font-weight: 600;
}

.prayer-countdown {
  text-align: center;
  padding: 16px;
}

.prayer-countdown .countdown-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.prayer-countdown .countdown-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

/* ===================================================================
   12. Allah Names (أسماء الله الحسنى)
   =================================================================== */
.names-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.name-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.name-card:active {
  transform: scale(0.96);
}

.name-card.selected {
  border-color: var(--teal);
  background: rgba(13, 107, 89, 0.04);
}

.name-card .name-ar {
  font-family: var(--font-quran);
  font-size: 22px;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.6;
}

.name-card .name-number {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.meaning-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
  text-align: center;
}

.meaning-card .meaning-name {
  font-family: var(--font-quran);
  font-size: 32px;
  color: var(--teal);
  margin-bottom: 8px;
}

.meaning-card .meaning-transliteration {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.meaning-card .meaning-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
}

/* ===================================================================
   13. Settings
   =================================================================== */
.settings-group {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
}

.settings-group-title {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 8px 16px 4px;
  letter-spacing: 0.02em;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  min-height: 48px;
}

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

.settings-row .setting-label {
  font-size: 16px;
  flex: 1;
}

.settings-row .setting-value {
  font-size: 15px;
  color: var(--text-secondary);
}

/* iOS-style toggle */
.toggle-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .toggle-slider {
  position: absolute;
  inset: 0;
  background: #E9E9EA;
  border-radius: 31px;
  transition: background var(--transition-normal);
  cursor: pointer;
}

.toggle-switch .toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 27px;
  height: 27px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--teal);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(-20px);
}

/* Slider */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: 2px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--teal);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

/* ===================================================================
   14. Utilities
   =================================================================== */

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--text-tertiary);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.empty-state .empty-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state .empty-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Search bar */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 40px;
  background: rgba(118, 118, 128, 0.12);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  transition: background var(--transition-fast);
}

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

.search-bar input:focus {
  background: rgba(118, 118, 128, 0.18);
}

.search-bar .search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

.modal .modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.modal .modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal .modal-actions {
  display: flex;
  gap: 8px;
}

.modal .modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  transition: opacity var(--transition-fast);
}

.modal .modal-actions button:active {
  opacity: 0.7;
}

.modal .modal-actions .btn-primary {
  background: var(--teal);
  color: #FFFFFF;
}

.modal .modal-actions .btn-secondary {
  background: rgba(118, 118, 128, 0.12);
  color: var(--text-primary);
}

/* Animations */
.fade-in {
  animation: fadeIn var(--transition-normal) ease both;
}

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

.slide-up {
  animation: slideUp var(--transition-slow) both;
}

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

.slide-in-right {
  animation: slideInRight var(--transition-normal) ease both;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.scale-in {
  animation: scaleIn var(--transition-normal) ease both;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--teal);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(13, 107, 89, 0.08);
  color: var(--teal);
  transition: background var(--transition-fast);
}

.chip.active {
  background: var(--teal);
  color: #FFFFFF;
}

/* Divider */
.divider {
  height: 0.5px;
  background: rgba(0, 0, 0, 0.06);
  margin: 0 16px;
}

/* ===================================================================
   15. Scrollbar
   =================================================================== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(13, 107, 89, 0.25);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(13, 107, 89, 0.4);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 107, 89, 0.25) transparent;
}

/* ===================================================================
   16. View Transitions
   =================================================================== */
.view-enter {
  animation: viewEnter var(--transition-slow) both;
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.view-exit {
  animation: viewExit var(--transition-normal) both;
}

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

/* ===================================================================
   17. Dark Mode
   =================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card-bg: #1C1C1E;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --text-primary: #FFFFFF;
    --text-secondary: #98989D;
    --text-tertiary: #48484A;
  }

  body {
    color-scheme: dark;
  }

  .nav-header {
    background: rgba(0, 0, 0, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  #tab-bar {
    background: rgba(28, 28, 30, 0.85);
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .surah-row {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .surah-row:active {
    background: rgba(255, 255, 255, 0.04);
  }

  .verse-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
  }

  .search-bar input {
    background: rgba(118, 118, 128, 0.24);
  }

  .search-bar input:focus {
    background: rgba(118, 118, 128, 0.36);
  }

  .toggle-switch .toggle-slider {
    background: #39393D;
  }

  .settings-row {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .prayer-item.next-prayer-highlight {
    background: rgba(13, 107, 89, 0.12);
  }

  .modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }

  .modal .modal-actions .btn-secondary {
    background: rgba(118, 118, 128, 0.24);
    color: #FFFFFF;
  }

  .zikr-card .zikr-translation {
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .verse-actions {
    border-top-color: rgba(255, 255, 255, 0.04);
  }

  .dhikr-selector {
    background: #2C2C2E;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  }

  .dhikr-selector .dhikr-option:active {
    background: rgba(255, 255, 255, 0.04);
  }

  .divider {
    background: rgba(255, 255, 255, 0.06);
  }

  .name-card.selected {
    background: rgba(13, 107, 89, 0.12);
  }

  .tasbih-controls button {
    background: var(--card-bg);
  }

  .page-divider {
    color: var(--text-tertiary);
  }

  .page-divider::before,
  .page-divider::after {
    border-top-color: var(--text-tertiary);
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(13, 107, 89, 0.35);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 107, 89, 0.5);
  }
}
