/* =========================================================
   صدقة جارية — العيادي مجدوب
   تصميم: أخضر عميق + لمسات ذهبية، داكن افتراضيًا
   ========================================================= */

:root {
  --green-deep: #0e3a2e;
  --green-deep-2: #123f32;
  --green-light: #1b5c48;
  --gold: #c9a227;
  --gold-soft: #e3c565;
  --bg: #0a1f1a;
  --bg-elevated: #0f2a22;
  --card-bg: #11332a;
  --text: #f3eee0;
  --text-dim: #b9c9c2;
  --border: rgba(201, 162, 39, 0.25);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font-ui: "Cairo", "Tajawal", "Noto Naskh Arabic", sans-serif;
  --font-quran: "Amiri", "Noto Naskh Arabic", serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="light"] {
  --bg: #f7f3e8;
  --bg-elevated: #ffffff;
  --card-bg: #ffffff;
  --text: #1d2a24;
  --text-dim: #51615a;
  --border: rgba(14, 58, 46, 0.15);
  --shadow: 0 10px 25px rgba(14, 58, 46, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  direction: rtl;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: calc(64px + var(--safe-top));
  padding-bottom: calc(72px + var(--safe-bottom));
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

.skip-link {
  position: absolute;
  right: -999px;
  top: 0;
  background: var(--gold);
  color: var(--green-deep);
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  z-index: 1000;
  font-weight: 700;
}
.skip-link:focus {
  right: 12px;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0; right: 0; left: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--green-deep), var(--green-deep-2));
  padding-top: var(--safe-top);
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--gold-soft);
}
.brand-moon { font-size: 1.3rem; }

.top-nav {
  display: none;
  gap: 18px;
}
.nav-link {
  color: #e9e3cf;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .2s, color .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover, .nav-link.active {
  background: rgba(201,162,39,0.18);
  color: var(--gold-soft);
}

.theme-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  color: var(--gold-soft);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.icon-light { display: none; }
[data-theme="light"] .icon-dark { display: none; }
[data-theme="light"] .icon-light { display: inline; }

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; right: 0; left: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(0deg, var(--green-deep), var(--green-deep-2));
  padding: 6px 4px calc(6px + var(--safe-bottom));
  box-shadow: 0 -6px 20px rgba(0,0,0,0.3);
}
.bnav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #cfd8d2;
  font-size: 0.72rem;
  padding: 6px 2px;
  border-radius: 10px;
}
.bnav-link span:first-child { font-size: 1.25rem; }
.bnav-link.active {
  color: var(--gold-soft);
  background: rgba(201,162,39,0.15);
}

@media (min-width: 760px) {
  .top-nav { display: flex; }
  .bottom-nav { display: none; }
  body { padding-bottom: calc(24px + var(--safe-bottom)); }
}

/* ===== Main / layout ===== */
main#main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.site-footer {
  text-align: center;
  padding: 18px 16px calc(18px);
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ===== Common components ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero-dedication {
  text-align: center;
  padding: 28px 18px;
  border-radius: var(--radius);
  background: radial-gradient(circle at top, rgba(201,162,39,0.14), transparent 70%), var(--card-bg);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.hero-dedication .moon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 10px;
}
.hero-dedication h1 {
  font-size: 1.3rem;
  line-height: 1.9;
  color: var(--gold-soft);
  margin: 0 0 10px;
  font-weight: 800;
}
.hero-dedication .invite {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.children-card {
  text-align: center;
  padding: 22px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(201,162,39,0.14), rgba(201,162,39,0.02));
  border: 1px solid var(--gold);
  position: relative;
}
.children-card::before {
  content: "﷽";
  display: block;
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 10px;
  opacity: 0.85;
}
.children-card p.main {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-soft);
  line-height: 1.9;
  margin: 0 0 10px;
}
.children-card p.sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.8;
  margin: 0;
}

.dua-deceased {
  text-align: center;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px dashed var(--border);
  margin-bottom: 18px;
  font-family: var(--font-quran);
  font-size: 1.15rem;
  line-height: 2.1;
  color: var(--text);
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.shortcut-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform .15s, border-color .15s;
}
.shortcut-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.shortcut-card .emoji { font-size: 1.8rem; }
.shortcut-card .label { font-weight: 700; font-size: 0.9rem; }

.last-read {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.last-read .info { font-size: 0.9rem; color: var(--text-dim); }
.last-read strong { color: var(--gold-soft); display:block; font-size: 1.05rem; margin-top: 2px;}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  background: var(--gold);
  color: var(--green-deep);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  font-size: 0.92rem;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn.secondary {
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid var(--gold);
}
.btn.block { width: 100%; }

.share-row { text-align: center; margin: 22px 0 6px; }

/* ===== Quran list ===== */
.search-box {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 16px;
  font-family: var(--font-ui);
}
.search-box:focus { outline: 2px solid var(--gold); }

.surah-list { display: flex; flex-direction: column; gap: 8px; }
.surah-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.surah-item:hover { border-color: var(--gold); }
.surah-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  color: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  flex-shrink: 0;
}
.surah-info { flex: 1; min-width: 0; }
.surah-name { font-weight: 700; font-size: 1.02rem; }
.surah-meta { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }

/* ===== Surah reading ===== */
.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: sticky;
  top: calc(64px + var(--safe-top) + 4px);
  z-index: 40;
}
.reader-toolbar select, .reader-toolbar .range-wrap {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-ui);
}
.icon-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--gold-soft);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.icon-btn.active { background: var(--gold); color: var(--green-deep); }

.basmala {
  text-align: center;
  font-family: var(--font-quran);
  font-size: 1.6rem;
  color: var(--gold-soft);
  margin: 10px 0 20px;
}

.ayah-text {
  font-family: var(--font-quran);
  line-height: 2.3;
  font-size: 1.4rem;
  text-align: justify;
  padding: 4px 2px;
}
.ayah {
  display: inline;
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
}
.ayah.playing { background: rgba(201,162,39,0.28); }
.ayah-num {
  font-family: var(--font-ui);
  color: var(--gold);
  font-size: 1rem;
  padding: 0 2px;
}

.player-bar {
  position: sticky;
  bottom: calc(72px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--green-deep);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  margin: 18px auto 0;
  box-shadow: var(--shadow);
  width: fit-content;
}
@media (min-width: 760px) {
  .player-bar { bottom: 18px; }
}
.player-bar button {
  background: none;
  border: none;
  color: var(--gold-soft);
  font-size: 1.3rem;
}
.player-bar button.play-pause { font-size: 1.7rem; }

/* ===== Duas ===== */
.dua-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}
.dua-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.dua-tab.active { background: var(--gold); color: var(--green-deep); border-color: var(--gold); }
.dua-tab.featured { border-color: var(--gold); color: var(--gold-soft); }

.dua-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.dua-card .arabic {
  font-family: var(--font-quran);
  font-size: 1.25rem;
  line-height: 2.1;
  margin-bottom: 10px;
}
.dua-card .source {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.dua-card .dua-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.counter-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--gold-soft);
  user-select: none;
}
.counter-pill small { color: var(--text-dim); font-weight: 400; }
.fav-btn, .copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.fav-btn.active { color: var(--gold); border-color: var(--gold); }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-dim);
}

/* ===== Tasbih ===== */
.tasbih-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-top: 10px;
}
.dhikr-select {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.dhikr-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.dhikr-chip.active { background: var(--gold); color: var(--green-deep); border-color: var(--gold); }

.tasbih-circle {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--green-light), var(--green-deep));
  border: 4px solid var(--gold);
  box-shadow: var(--shadow), inset 0 0 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-size: 3.2rem;
  font-weight: 800;
  user-select: none;
  touch-action: manipulation;
  transition: transform .08s;
}
.tasbih-circle:active { transform: scale(0.96); }
.tasbih-circle .current-dhikr {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
  max-width: 85%;
  text-align: center;
}
.tasbih-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}
.goal-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.goal-chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}
.goal-chip.active { border-color: var(--gold); color: var(--gold-soft); }
.tasbih-stats {
  display: flex;
  gap: 24px;
  text-align: center;
}
.tasbih-stats .stat strong { display: block; font-size: 1.3rem; color: var(--gold-soft); }
.tasbih-stats .stat span { font-size: 0.78rem; color: var(--text-dim); }
.tasbih-actions { display: flex; gap: 10px; }

.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  right: 50%;
  transform: translateX(50%);
  background: var(--gold);
  color: var(--green-deep);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  z-index: 300;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity:0; transform: translateX(50%) translateY(10px);} to {opacity:1; transform: translateX(50%) translateY(0);} }

.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold-soft);
  margin: 6px 0 14px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}
