/* =========================================================
   Checklist Sholat 5 Waktu — style.css
   Tema: hijau zamrud + emas, cream (terang) / zamrud gelap (malam)
   ========================================================= */

:root {
  --emerald-900: #072A1F;
  --emerald-800: #0A3A2A;
  --emerald-700: #114B3E;
  --emerald-600: #1A6450;
  --gold: #C5A059;
  --gold-bright: #D4AF37;
  --gold-soft: #E9CF7A;

  --bg: #F6F1E6;
  --bg-2: #EFE7D6;
  --text: #1C2A23;
  --muted: #5E6B63;
  --card: rgba(255, 255, 255, 0.62);
  --card-border: rgba(197, 160, 89, 0.35);
  --item: rgba(255, 255, 255, 0.7);
  --item-done: rgba(17, 75, 62, 0.08);
  --shadow: 0 10px 30px -12px rgba(10, 58, 42, 0.25);
  --pattern-opacity: 0.18;
  --track: rgba(10, 58, 42, 0.1);
  --danger: #A23B2C;

  --radius: 20px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  color-scheme: light;
}

/* Mode malam: ikut sistem, kecuali user memaksa terang */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #04190F;
    --bg-2: #072A1F;
    --text: #EDE6D6;
    --muted: #A9B5AD;
    --card: rgba(17, 75, 62, 0.32);
    --card-border: rgba(212, 175, 55, 0.25);
    --item: rgba(10, 58, 42, 0.55);
    --item-done: rgba(212, 175, 55, 0.1);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --pattern-opacity: 0.1;
    --track: rgba(255, 255, 255, 0.1);
    --danger: #E08877;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #04190F;
  --bg-2: #072A1F;
  --text: #EDE6D6;
  --muted: #A9B5AD;
  --card: rgba(17, 75, 62, 0.32);
  --card-border: rgba(212, 175, 55, 0.25);
  --item: rgba(10, 58, 42, 0.55);
  --item-done: rgba(212, 175, 55, 0.1);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --pattern-opacity: 0.1;
  --track: rgba(255, 255, 255, 0.1);
  --danger: #E08877;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(120% 60% at 50% 0%, var(--bg-2), var(--bg) 60%);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
button, input, label { font-family: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; margin: 0.25rem 0 0.75rem; }

/* ---------- Pola geometris Islami (bintang 8 / rub el hizb) ---------- */
.bg-pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23C5A059' stroke-width='1.1'%3E%3Crect x='26' y='26' width='36' height='36'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3Cpath d='M0 0L18.5 18.5M88 0L69.5 18.5M0 88L18.5 69.5M88 88L69.5 69.5M44 0v10M44 78v10M0 44h10M78 44h10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px;
  transform: translateZ(0);
}

/* ---------- Header ---------- */
.app-header {
  position: relative;
  color: #F6EBD0;
  padding: calc(env(safe-area-inset-top) + 18px) 16px 46px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-opacity='.22' stroke-width='1.1'%3E%3Crect x='26' y='26' width='36' height='36'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3Cpath d='M0 0L18.5 18.5M88 0L69.5 18.5M0 88L18.5 69.5M88 88L69.5 69.5M44 0v10M44 78v10M0 44h10M78 44h10'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--emerald-700), var(--emerald-800) 55%, var(--emerald-900));
  background-size: 88px 88px, cover;
  border-bottom: 2px solid var(--gold);
  border-radius: 0 0 28px 28px;
  box-shadow: 0 14px 40px -18px rgba(7, 42, 31, 0.8);
}
.header-inner, .date-row { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 0 0 1px rgba(212,175,55,.5); }
.brand-title { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.2px; color: #fff; }
.brand-sub { margin: 0; font-size: 0.78rem; color: var(--gold-soft); opacity: 0.9; }
.date-row { margin-top: 14px; font-size: 0.9rem; font-weight: 600; justify-content: flex-start; flex-wrap: wrap; }
.badge-gold {
  font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--emerald-900);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid rgba(212,175,55,.45); background: rgba(255,255,255,.06); color: var(--gold-soft);
}
.icon-btn:active { transform: scale(.95); }
.ic-moon { display: none; }
:root[data-dark="1"] .ic-sun { display: none; }
:root[data-dark="1"] .ic-moon { display: block; }

/* ---------- Layout ---------- */
.container { max-width: 560px; margin: -30px auto 0; padding: 0 16px 24px; display: grid; gap: 14px; position: relative; }
.card { border-radius: var(--radius); padding: 18px; }
.glass {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
          backdrop-filter: blur(10px) saturate(130%);
  transform: translateZ(0); /* layer sendiri → mencegah glitch kotak kosong saat scroll di Chrome desktop */
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text); }
.section-title::before { content: "✦ "; color: var(--gold); }

/* ---------- Progres ---------- */
.progress-card { display: grid; grid-template-columns: 128px 1fr; gap: 16px; align-items: center; }
.ring-wrap { position: relative; width: 128px; height: 128px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--track); stroke-width: 10; }
.ring-bar {
  fill: none; stroke: url(#goldGrad); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73;
  transition: stroke-dashoffset .7s cubic-bezier(.2,.8,.2,1);
}
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.pct { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.count { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.status { margin: 0 0 8px; font-weight: 800; font-size: 0.98rem; }
.status-idle { color: var(--muted); }
.status-progress { color: var(--emerald-600); }
:root[data-dark="1"] .status-progress { color: var(--gold-soft); }
.status-done { background: linear-gradient(90deg, var(--gold-bright), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.linear { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.linear.thin { height: 6px; }
.linear-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--emerald-600), var(--gold)); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.stat { display: flex; flex-direction: column; }
.stat-val { font-size: 1.15rem; font-weight: 800; }
.stat-lbl { font-size: 0.68rem; color: var(--muted); line-height: 1.2; }

/* ---------- Level ---------- */
.level-card { padding: 14px 18px; }
.level-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; }
.level-kicker { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.level-name { font-weight: 800; color: var(--gold); }
.level-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }

/* ---------- Jumat ---------- */
.jumat-card { border-color: var(--gold); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: var(--track); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 10px 6px; border-radius: 11px; font-weight: 700; font-size: 0.88rem; color: var(--muted); transition: all .2s; cursor: pointer; }
.segmented input:checked + span { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800)); color: var(--gold-soft); box-shadow: 0 6px 14px -8px rgba(7,42,31,.8); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Checklist ---------- */
.prayer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prayer {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px;
  border-radius: 16px; background: var(--item); border: 1px solid transparent;
  cursor: pointer; transition: background .25s, border-color .25s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.prayer:active { transform: scale(.985); }
.prayer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.prayer input:focus-visible ~ .check { outline: 2px solid var(--gold); outline-offset: 3px; }
.p-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: linear-gradient(135deg, rgba(197,160,89,.22), rgba(197,160,89,.08)); flex: none; }
.p-text { flex: 1; min-width: 0; }
.p-name { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.p-ar { font-family: var(--font-ar); font-size: 1.1rem; color: var(--gold); font-weight: 700; }
.p-hint { font-size: 0.76rem; color: var(--muted); }
.check {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--gold); transition: all .25s;
}
.check svg { width: 16px; height: 16px; stroke: var(--emerald-900); stroke-width: 3.2; fill: none; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .05s; }
.prayer.done { background: var(--item-done); border-color: var(--card-border); }
.prayer.done .check { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212,175,55,.18); }
.prayer.done .check svg { stroke-dashoffset: 0; }
.prayer.done .p-name { color: var(--emerald-600); }
:root[data-dark="1"] .prayer.done .p-name { color: var(--gold-soft); }
.prayer .pts { font-size: 0.72rem; font-weight: 800; color: var(--gold); opacity: 0; transition: opacity .2s; }
.prayer.done .pts { opacity: 1; }
.bonus-note { margin: 12px 0 0; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ---------- Kalender Masehi + Hijriah ---------- */
.hijri-row { margin-top: 4px; }
.hijri-label { font-size: 0.84rem; font-weight: 600; color: var(--gold-soft); }
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.icon-btn.sm { width: 38px; height: 38px; font-size: 1.4rem; line-height: 1; color: var(--gold); background: var(--item); border-color: var(--card-border); }
.cal-month { text-align: center; display: flex; flex-direction: column; }
.cal-m { font-weight: 800; font-size: 1rem; text-transform: capitalize; }
.cal-h { font-size: 0.78rem; color: var(--gold); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { margin-bottom: 4px; }
.cal-week span { text-align: center; font-size: 0.68rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.cal-week .sun { color: var(--danger); }
.cal-week .fri { color: var(--gold); }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1.05; min-height: 42px; border-radius: 10px; border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--item); color: var(--text); padding: 2px; font-family: inherit;
}
.cal-cell.empty { background: transparent; }
.c-m { font-size: 0.9rem; font-weight: 800; line-height: 1; }
.c-h { font-size: 0.6rem; font-weight: 600; color: var(--muted); line-height: 1; white-space: nowrap; }
.c-ev { position: absolute; top: 2px; right: 4px; font-size: 0.55rem; color: var(--gold); }
.c-n { position: absolute; bottom: 2px; right: 4px; font-size: 0.55rem; font-weight: 800; color: var(--gold); }
.cal-cell.sun .c-m { color: var(--danger); }
.cal-cell.fri .c-m { color: var(--gold); }
.cal-cell.hstart .c-h { color: var(--gold); font-weight: 800; }
.cal-cell.l2 { background: color-mix(in srgb, var(--gold) 16%, var(--item)); }
.cal-cell.l5 { background: linear-gradient(160deg, var(--emerald-700), var(--emerald-800)); border-color: var(--gold); }
.cal-cell.l5 .c-m, .cal-cell.l5.sun .c-m, .cal-cell.l5.fri .c-m { color: var(--gold-soft); }
.cal-cell.l5 .c-h { color: rgba(233,207,122,.75); }
.cal-cell.future { opacity: .55; }
.cal-cell.today { outline: 2px solid var(--gold); outline-offset: 1px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; font-size: 0.7rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg { width: 12px; height: 12px; border-radius: 4px; display: inline-grid; place-items: center; font-style: normal; }
.lg.l0 { background: var(--track); }
.lg.l2 { background: color-mix(in srgb, var(--gold) 40%, transparent); }
.lg.l5 { background: var(--emerald-700); border: 1px solid var(--gold); }
.lg.ev { color: var(--gold); font-size: .7rem; }
.cal-summary { margin: 10px 0 0; text-align: center; font-size: 0.8rem; font-weight: 600; }
.cal-events { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.8rem; }
.cal-events li { padding: 8px 10px; border-radius: 10px; background: var(--item); }
.ev-star { color: var(--gold); margin-right: 6px; }

/* ---------- Pengaturan ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 4px; }
.setting-row label { display: flex; flex-direction: column; font-size: 0.9rem; }
.small-inline { font-size: 0.74rem; }
.select { min-height: 42px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--item); color: var(--text); font: inherit; font-weight: 700; font-size: 0.85rem; }

/* ---------- Tombol ---------- */
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 14px; border-radius: 14px; font-weight: 700; font-size: 0.92rem;
  border: 1px solid transparent; text-align: center; cursor: pointer; transition: transform .1s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold) 60%, #B8893A); color: var(--emerald-900); box-shadow: 0 8px 20px -10px rgba(184,137,58,.9); }
.btn-outline { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn-ghost { background: var(--item); border-color: var(--card-border); color: var(--text); }
.btn-danger-ghost { width: 100%; background: transparent; border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.link-btn { background: none; border: none; color: var(--gold); font-weight: 700; font-size: 0.85rem; padding: 6px 0; }
.link-btn.center { display: block; margin: 10px auto 0; }
.link-btn[hidden] { display: none; }

/* ---------- Footer ---------- */
.app-footer { text-align: center; padding: 8px 16px calc(env(safe-area-inset-bottom) + 28px); color: var(--muted); font-size: 0.8rem; }
.app-footer p { margin: 4px 0 0; }
.footer-orn { color: var(--gold); letter-spacing: 6px; font-size: 0.7rem; }

/* ---------- Modal ayat ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 25, 15, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .25s ease; }
.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  padding: 26px 20px calc(env(safe-area-inset-bottom) + 20px);
  border-radius: 26px 26px 0 0;
  color: #F3EAD3;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-opacity='.12' stroke-width='1.1'%3E%3Crect x='26' y='26' width='36' height='36'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(170deg, var(--emerald-700), var(--emerald-800) 50%, var(--emerald-900));
  border-top: 2px solid var(--gold);
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.6);
  animation: slideUp .35s cubic-bezier(.2,.9,.2,1);
}
@media (min-width: 600px) {
  .modal { place-items: center; }
  .modal-card { border-radius: 26px; border: 2px solid var(--gold); }
}
.modal-x { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,.08); color: var(--gold-soft); font-size: 1.5rem; line-height: 1; }
.modal-kicker { text-align: center; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-soft); font-weight: 700; }
.modal-title { text-align: center; margin: 4px 0 14px; font-size: 1.2rem; font-weight: 800; color: #fff; }
.verse-box { position: relative; padding: 20px 16px; border-radius: 18px; border: 1px solid rgba(212,175,55,.45); background: rgba(4,25,15,.35); }
.verse-box::before, .verse-box::after { content: "✦"; position: absolute; color: var(--gold); font-size: .8rem; }
.verse-box::before { top: 6px; left: 10px; }
.verse-box::after { bottom: 6px; right: 10px; }
.verse-ar { font-family: var(--font-ar); font-size: 1.65rem; line-height: 2.1; text-align: center; margin: 0; color: #FFF6DC; font-weight: 700; }
.verse-div { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--gold); }
.verse-div::before, .verse-div::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.verse-id { margin: 0; text-align: center; font-style: italic; font-weight: 500; font-size: 0.95rem; color: #EADFC4; }
.verse-ref { margin: 10px 0 0; text-align: center; font-weight: 800; color: var(--gold-bright); font-size: 0.85rem; }
.modal-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-top: 16px; }
.modal-card .link-btn { color: var(--gold-soft); }
.modal-card .btn-outline { color: var(--gold-soft); border-color: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  max-width: calc(100% - 32px); z-index: 80;
  background: var(--emerald-800); color: var(--gold-soft); border: 1px solid var(--gold);
  padding: 10px 16px; border-radius: 14px; font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: fade .2s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
.pop { animation: pop .35s ease; }

@media (max-width: 380px) {
  .progress-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .progress-info { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
