/* Qari — Al-Quran Digital | gaya Material, hijau zamrud, rapi dan tenang */
:root {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-2: #eef5ef;
  --surface-3: #e3efe6;
  --text: #1c2b25;
  --muted: #5d6f66;
  --faint: #8aa096;
  --border: #dde8df;
  --primary: #059669;
  --primary-dark: #047857;
  --primary-soft: #d1f2e4;
  --primary-ink: #065f46;
  --gold: #b45309;
  --gold-soft: #fdf0d7;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(16, 42, 30, .06), 0 4px 14px rgba(16, 42, 30, .06);
  --shadow-lg: 0 8px 30px rgba(16, 42, 30, .16);
  --radius: 16px;
  --radius-sm: 12px;
  --arabic-font: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --ui-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 64px;
  --header-h: 60px;
}
html[data-theme="dark"] {
  --bg: #0d1712;
  --surface: #152420;
  --surface-2: #1b2f28;
  --surface-3: #223a31;
  --text: #e9f2ec;
  --muted: #a7bcb0;
  --faint: #7d9387;
  --border: #264036;
  --primary: #34d399;
  --primary-dark: #10b981;
  --primary-soft: #123f2e;
  --primary-ink: #a7f3d0;
  --gold: #fbbf24;
  --gold-soft: #3a2f10;
  --danger: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ui-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary-dark); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--text); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 860px; margin: 0 auto; height: var(--header-h);
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary); color: #fff; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand-text small { font-size: 12px; color: var(--muted); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.hijri-chip {
  font-size: 12.5px; font-weight: 600; color: var(--primary-ink);
  background: var(--primary-soft); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  display: inline-grid; place-items: center; padding: 0 8px;
}
.icon-btn:active { transform: scale(.96); }
html[data-theme="light"] .ic-moon { display: none; }
html[data-theme="dark"] .ic-sun { display: none; }

/* ---------- Layout ---------- */
.app-main { max-width: 860px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 28px); }
.page-head { margin: 6px 0 16px; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 15px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 14px; }
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 14px; }
.section-title { font-size: 17px; font-weight: 700; margin: 22px 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Buttons / chips ---------- */
.btn {
  min-height: 48px; padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface); color: var(--primary-ink); border-color: var(--border); }
.btn.ghost { background: transparent; color: var(--primary-dark); border-color: transparent; min-height: 44px; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 600;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Hero (beranda) ---------- */
.hero {
  border-radius: 20px; padding: 22px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #047857 0%, #059669 55%, #10b981 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px;
  border-radius: 50%; background: rgba(255,255,255,.08);
}
.hero::before {
  content: ""; position: absolute; right: 60px; bottom: -70px; width: 140px; height: 140px;
  border-radius: 50%; background: rgba(255,255,255,.06);
}
.hero .hero-date { font-size: 13.5px; opacity: .9; font-weight: 600; }
.hero h1 { font-size: 24px; font-weight: 800; margin: 6px 0 2px; position: relative; z-index: 1; }
.hero p { opacity: .92; font-size: 15px; position: relative; z-index: 1; }
.hero .hero-next { margin-top: 14px; position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.next-prayer {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 8px 14px;
  font-size: 14px; font-weight: 700;
}
.next-prayer small { font-weight: 500; opacity: .9; }

/* ---------- Shortcut grid ---------- */
.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .shortcuts { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
.shortcut {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text); min-height: 88px; text-align: center;
}
.shortcut .sc-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-ink);
}
.shortcut span { font-size: 12.5px; font-weight: 600; line-height: 1.25; }

/* ---------- Ayat hari ini ---------- */
.daily-verse { position: relative; overflow: hidden; }
.daily-verse .dv-label {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; color: var(--gold);
}
.daily-verse .dv-arabic {
  font-family: var(--arabic-font); font-size: 28px; line-height: 2; direction: rtl; text-align: right;
  margin: 12px 0 8px;
}
.daily-verse .dv-trans { color: var(--muted); font-size: 15px; }
.daily-verse .dv-ref { margin-top: 12px; font-size: 13.5px; font-weight: 700; color: var(--primary-ink); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; color: var(--primary-dark); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- Surah list ---------- */
.search-box { position: relative; margin-bottom: 12px; }
.search-box input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); padding: 0 48px 0 16px; outline: none;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box .search-ic { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 44px; height: 44px; display: grid; place-items: center; }
.surah-list { display: flex; flex-direction: column; gap: 10px; }
.surah-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
  color: var(--text); min-height: 76px; text-align: left; width: 100%;
}
.surah-item:active { background: var(--surface-2); }
.surah-num {
  width: 48px; height: 48px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--primary-ink); font-weight: 800; font-size: 16px;
  border: 1px solid var(--border);
}
.surah-meta { flex: 1; min-width: 0; }
.surah-meta b { display: block; font-size: 16.5px; font-weight: 700; }
.surah-meta small { color: var(--muted); font-size: 13.5px; }
.surah-arabic { font-family: var(--arabic-font); font-size: 24px; color: var(--primary-dark); direction: rtl; }
.surah-item .chev { color: var(--faint); flex: none; }

/* ---------- Reader ---------- */
.surah-head { text-align: center; padding: 22px 18px; }
.surah-head .sh-arabic { font-family: var(--arabic-font); font-size: 34px; line-height: 1.6; color: var(--primary-dark); }
.surah-head h1 { font-size: 21px; margin-top: 6px; }
.surah-head .sh-info { color: var(--muted); font-size: 14px; margin-top: 4px; }
.bismillah {
  font-family: var(--arabic-font); font-size: 30px; text-align: center; direction: rtl;
  padding: 18px 12px; color: var(--text);
}
.reader-tools {
  position: sticky; top: var(--header-h); z-index: 30; display: flex; gap: 8px; align-items: center;
  background: var(--bg); padding: 10px 0; flex-wrap: wrap;
}
.reader-tools .spacer { flex: 1; }
.ayah {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; scroll-margin-top: calc(var(--header-h) + 70px);
}
.ayah.playing { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.ayah-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ayah-num {
  min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 800; font-size: 15px;
}
.sajda-badge {
  font-size: 12px; font-weight: 800; color: var(--gold); background: var(--gold-soft);
  border-radius: 999px; padding: 5px 10px;
}
.ayah-top .spacer { flex: 1; }
.ayah-arabic {
  font-family: var(--arabic-font); direction: rtl; text-align: right;
  font-size: var(--arabic-size, 30px); line-height: 2.1; margin: 4px 0 10px;
  word-spacing: 2px;
}
.ayah-latin { color: var(--muted); font-size: 14.5px; font-style: italic; margin-bottom: 8px; line-height: 1.7; }
.ayah-trans { font-size: 16px; line-height: 1.75; }
.ayah-actions { display: flex; gap: 4px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; flex-wrap: wrap; }
.ayah-actions .icon-btn { border: none; background: transparent; min-width: 44px; }
.ayah-actions .icon-btn.active { color: var(--primary-dark); background: var(--primary-soft); }
.ayah-actions .icon-btn.active svg { fill: currentColor; }
.ayah-actions .icon-btn.active svg path { fill: currentColor; }

/* ---------- Prayer ---------- */
.prayer-next { text-align: center; padding: 20px 18px; }
.prayer-next .pn-label { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.prayer-next .pn-name { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.prayer-next .pn-time { font-size: 44px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; line-height: 1.1; }
.prayer-next .pn-count { font-size: 15px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.prayer-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px;
  border-bottom: 1px solid var(--border); min-height: 56px;
}
.prayer-row:last-child { border-bottom: none; }
.prayer-row .pr-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary-ink); flex: none; }
.prayer-row b { flex: 1; font-size: 16px; }
.prayer-row time { font-weight: 800; font-size: 16.5px; font-variant-numeric: tabular-nums; }
.prayer-row.next { background: var(--primary-soft); border-radius: 12px; padding-left: 12px; padding-right: 12px; }
.prayer-row.next .pr-ic { background: var(--surface); }
.prayer-row.passed { opacity: .55; }

/* ---------- Tasbih ---------- */
.tasbih-counter { text-align: center; padding: 26px 16px; }
.tasbih-ring {
  width: 190px; height: 190px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--primary); background: var(--primary-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none;
}
.tasbih-ring b { font-size: 52px; font-weight: 800; color: var(--primary-ink); line-height: 1; font-variant-numeric: tabular-nums; }
.tasbih-ring small { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.tasbih-ring:active { transform: scale(.97); background: var(--surface-3); }
.tasbih-dhikr { font-family: var(--arabic-font); font-size: 30px; direction: rtl; margin-bottom: 4px; }
.tasbih-latin { color: var(--muted); font-size: 15px; margin-bottom: 14px; }

/* ---------- Doa ---------- */
.doa-item { border-bottom: 1px solid var(--border); padding: 16px 2px; }
.doa-item:last-child { border-bottom: none; }
.doa-item h3 { font-size: 16.5px; margin-bottom: 8px; }
.doa-arabic { font-family: var(--arabic-font); font-size: 24px; direction: rtl; text-align: right; line-height: 2; margin-bottom: 8px; }
.doa-latin { color: var(--muted); font-size: 14.5px; font-style: italic; margin-bottom: 6px; line-height: 1.7; }
.doa-trans { font-size: 15.5px; line-height: 1.7; }

/* ---------- Menu ---------- */
.menu-list { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--border);
  padding: 14px 4px; min-height: 60px; color: var(--text); font-size: 16px; font-weight: 600;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); flex: none; }
.menu-item small { display: block; font-weight: 500; color: var(--muted); font-size: 13.5px; }
.menu-item .chev { margin-left: auto; color: var(--faint); }

/* ---------- Settings ---------- */
.setting-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); min-height: 60px; }
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-text { flex: 1; }
.setting-row b { display: block; font-size: 16px; }
.setting-row small { color: var(--muted); font-size: 13.5px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--border);
  transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }
.seg { display: flex; gap: 6px; }
.seg button {
  min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 700;
}
.seg button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
select.input, input.input {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); padding: 0 12px; width: 100%;
}

/* ---------- Qibla ---------- */
.qibla-compass { text-align: center; padding: 20px 16px; }
.compass {
  width: 220px; height: 220px; margin: 8px auto 16px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface-2); position: relative;
}
.compass .needle {
  position: absolute; inset: 14px; transition: transform .3s ease;
}
.compass .needle svg { width: 100%; height: 100%; }
.compass .center-dot {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--surface);
}
.compass .dir { position: absolute; font-weight: 800; font-size: 14px; color: var(--muted); }
.compass .dir.n { top: 6px; left: 50%; transform: translateX(-50%); color: var(--danger); }
.compass .dir.e { right: 10px; top: 50%; transform: translateY(-50%); }
.compass .dir.s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.compass .dir.w { left: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- Empty / loading / error ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { color: var(--faint); margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%; margin: 40px auto;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: var(--radius-sm); padding: 16px; }
html[data-theme="dark"] .error-box { background: #3a1515; border-color: #7f1d1d; color: #fca5a5; }
.skeleton { border-radius: 12px; background: var(--surface-2); min-height: 76px; margin-bottom: 10px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Audio bar ---------- */
.audio-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 12px);
  z-index: 45; width: min(860px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; padding: 10px 12px;
}
.audio-btn {
  min-width: 44px; min-height: 44px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; display: grid; place-items: center; flex: none;
}
.audio-btn:nth-of-type(2), .audio-btn:nth-of-type(3) { background: transparent; color: var(--muted); }
.audio-bar .ic-pause { display: none; }
.audio-bar.playing .ic-play { display: none; }
.audio-bar.playing .ic-pause { display: block; }
.audio-info { flex: 1; min-width: 0; }
.audio-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-progress { height: 4px; background: var(--border); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.audio-progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: 999px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  display: flex; justify-content: center; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 700; min-height: 44px;
}
.nav-item.active { color: var(--primary-dark); }
.nav-item.active svg { color: var(--primary); }

/* ---------- Toast & modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px); transform: translateX(-50%) translateY(16px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s;
  z-index: 60; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 25, 18, .55); }
.modal-card {
  position: relative; width: min(860px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 18px 28px;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h2 { font-size: 18px; }
.modal-body .tafsir-arabic { font-family: var(--arabic-font); font-size: 24px; direction: rtl; text-align: right; line-height: 2; margin-bottom: 10px; }
.modal-body .tafsir-text { font-size: 16px; line-height: 1.8; }
.modal-body .tafsir-text p { margin-bottom: 10px; }
.modal-body .tafsir-text i { font-style: normal; }

footer.foot { text-align: center; color: var(--faint); font-size: 13px; padding: 18px 0 4px; }
footer.foot b { color: var(--muted); }
