/* ===================== EhliSünnet Design System ===================== */
:root {
  --bg: #eaf2ee;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --border: rgba(16, 40, 33, 0.10);
  --border-strong: rgba(16, 40, 33, 0.18);
  --text: #16241f;
  --muted: #5f7a70;
  --emerald: #9b4f96;
  --emerald-soft: rgba(155, 79, 150, 0.12);
  --emerald-deep: #7e3f7a;
  --gold: #b07d24;
  --gold-soft: rgba(176, 125, 36, 0.13);
  --danger: #d2604f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(16, 40, 33, 0.08);
  --shadow-sm: 0 2px 10px rgba(16, 40, 33, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --arabic: "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Scheherazade New", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 100% -10%, rgba(155,79,150,0.12), transparent 55%),
    radial-gradient(900px 500px at -10% 0%, rgba(176,125,36,0.08), transparent 50%),
    linear-gradient(180deg, #f4f9f6, var(--bg));
  background-attachment: fixed;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---- Logo / Brand mark ---- */
.brand {
  display: inline-block;
  background-image: url("icon.svg?v=4");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.brand--sm { width: 34px; height: 34px; }
.brand--lock { width: 84px; height: 84px; margin: 0 auto 10px; }

/* ===================== Top bar ===================== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 18px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.7));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 11px; }
.topbar__title { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.topbar__sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: scale(0.94); }

/* ===================== View / layout ===================== */
.app { min-height: 100dvh; }
.view {
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  max-width: 680px; margin: 0 auto;
  animation: fade 0.35s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted); margin: 22px 4px 10px; font-weight: 700;
}
.page-head { margin-bottom: 6px; }
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: -0.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Date navigator */
.datenav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; margin: 14px 0 6px; box-shadow: var(--shadow-sm);
}
.datenav button {
  width: 40px; height: 40px; border-radius: 10px; border: none;
  background: transparent; color: var(--text); font-size: 20px; cursor: pointer;
}
.datenav button:active { background: var(--surface-2); }
.datenav__label { text-align: center; flex: 1; }
.datenav__label b { display: block; font-size: 15px; }
.datenav__label span { font-size: 12px; color: var(--muted); }
.datenav__today {
  font-size: 11px !important; width: auto !important; padding: 0 10px;
  color: var(--emerald) !important; font-weight: 700;
}

/* ===================== Buttons ===================== */
.btn {
  appearance: none; border: 1px solid var(--border-strong); cursor: pointer;
  background: var(--surface); color: var(--text);
  border-radius: 14px; padding: 13px 18px; font-size: 15px; font-weight: 600;
  font-family: var(--font); transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: linear-gradient(180deg, var(--emerald), var(--emerald-deep));
  border-color: transparent; color: #ffffff;
  box-shadow: 0 8px 20px rgba(155,79,150,0.32);
}
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--danger { color: var(--danger); border-color: rgba(210,96,79,0.4); background: rgba(210,96,79,0.07); }
.btn--block { width: 100%; }
.btn--lg { padding: 16px; font-size: 16px; }

/* Big toggle (Teheccüt) */
.bigtoggle {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 26px; text-align: center;
}
.bigtoggle__ring {
  width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(155,79,150,0.08), transparent 70%);
  border: 2px solid var(--border-strong); position: relative; cursor: pointer;
  transition: all 0.25s ease;
}
.bigtoggle__ring.on {
  border-color: var(--emerald);
  background: radial-gradient(circle at 50% 35%, var(--emerald-soft), transparent 72%);
  box-shadow: 0 0 0 6px rgba(155,79,150,0.08), 0 14px 36px rgba(155,79,150,0.22);
}
.bigtoggle__ring svg { width: 58px; height: 58px; color: #c2cdc8; transition: color 0.25s; }
.bigtoggle__ring.on svg { color: var(--emerald); }
.bigtoggle__status { font-size: 18px; font-weight: 700; }
.bigtoggle__status.on { color: var(--emerald); }

/* ===================== Checklist items ===================== */
.check {
  display: flex; align-items: center; gap: 13px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  cursor: pointer; margin-bottom: 9px; transition: border-color 0.15s, background 0.15s;
  box-shadow: var(--shadow-sm);
}
.check.on { border-color: var(--emerald); background: var(--emerald-soft); }
.check__box {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--border-strong); display: grid; place-items: center;
  transition: all 0.15s; background: var(--surface);
}
.check.on .check__box { background: var(--emerald); border-color: var(--emerald); }
.check__box--radio { border-radius: 50%; }
.check--radio { margin-bottom: 0; }
.check--radio + .check--radio { margin-top: 9px; }
.check__box svg { width: 16px; height: 16px; color: #fff; opacity: 0; transition: opacity 0.15s; }
.check.on .check__box svg { opacity: 1; }
.check__body { flex: 1; min-width: 0; }
.check__title { font-weight: 600; font-size: 15px; }
.check__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.check__badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  background: var(--gold-soft); color: var(--gold);
}

/* ===================== Stepper (Evrad) ===================== */
.stepper-card { text-align: center; padding: 20px 16px; }
.stepper-card h3 { margin: 0 0 2px; font-size: 17px; }
.stepper-card .ar { font-family: var(--arabic); font-size: 22px; color: var(--gold); margin-bottom: 14px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper button {
  width: 54px; height: 54px; border-radius: 16px; font-size: 26px; font-weight: 300;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.stepper button:active { transform: scale(0.92); }
.stepper button.plus { background: linear-gradient(180deg, var(--emerald), var(--emerald-deep)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(155,79,150,0.30); }
.stepper__val { min-width: 64px; }
.stepper__val b { font-size: 40px; font-weight: 700; line-height: 1; }
.stepper__val span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ===================== Stat / metrics ===================== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow-sm);
}
.stat__val { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.stat__val small { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat__label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat__icon { font-size: 18px; }
.flame { color: var(--gold); }

/* Progress bar */
.bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--emerald), var(--gold)); transition: width 0.4s ease; }

/* ===================== Hifz ===================== */
.hifz-hero { text-align: center; padding: 22px 16px; }
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 0 auto 6px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-wrap .ring-center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.ring-center b { font-size: 38px; font-weight: 800; }
.ring-center span { font-size: 12px; color: var(--muted); }
.hifz-mini { display: flex; justify-content: center; gap: 26px; margin-top: 10px; }
.hifz-mini div { text-align: center; }
.hifz-mini b { font-size: 20px; font-weight: 800; }
.hifz-mini span { font-size: 11.5px; color: var(--muted); }

.surah-search {
  width: 100%; padding: 13px 14px; border-radius: 14px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  margin: 4px 0 12px; font-family: var(--font); box-shadow: var(--shadow-sm);
}
.surah-search::placeholder { color: var(--muted); }
.surah {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.surah.done { border-color: rgba(155,79,150,0.45); }
.surah__no {
  flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: 13px;
  position: relative;
}
.surah.done .surah__no { background: var(--emerald-soft); color: var(--emerald); }
.surah__body { flex: 1; min-width: 0; }
.surah__name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.surah__name .ar { font-family: var(--arabic); color: var(--gold); font-size: 16px; font-weight: 400; }
.surah__meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.surah__pct { font-weight: 800; font-size: 14px; min-width: 42px; text-align: right; color: var(--emerald); }
.surah .bar { margin-top: 7px; }

/* ===================== Modal ===================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(16,40,33,0.40);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.2s ease;
}
.modal {
  width: 100%; max-width: 520px; background: var(--bg-2);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + var(--safe-bottom));
  box-shadow: 0 -20px 60px rgba(16,40,33,0.18); animation: slideup 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal__grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 6px auto 14px; }
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal .ar { font-family: var(--arabic); color: var(--gold); font-size: 20px; }
.field { margin: 14px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 12px; font-size: 16px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  font-family: var(--font);
}
.field textarea { min-height: 70px; resize: vertical; }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type=range] { flex: 1; accent-color: var(--emerald); height: 30px; }
.range-val { font-size: 22px; font-weight: 800; min-width: 96px; text-align: right; }
.range-val small { font-size: 13px; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 20px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--emerald-soft); border-color: var(--emerald); color: var(--emerald); }
.modal__actions { display: flex; gap: 10px; margin-top: 18px; }
.modal__actions .btn { flex: 1; }
.modal code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* Vird-i Şerif-i Sağir modal frame */
.virdisagir-frame {
  width: 100%; height: calc(70dvh - 120px); min-height: 320px; max-height: 680px;
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  background: var(--surface); margin: 8px 0 14px;
}
.virdisagir-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ===================== PIN lock ===================== */
.lock { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: linear-gradient(180deg, #f4f9f6, var(--bg)); padding: 24px; }
.lock-card { text-align: center; max-width: 320px; width: 100%; }
.lock-card h1 { margin: 0; font-size: 24px; letter-spacing: 0.5px; }
.pin-input {
  width: 100%; text-align: center; letter-spacing: 14px; font-size: 28px;
  padding: 14px; margin: 18px 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
}
.pin-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ===================== Tabbar ===================== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.98));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border: none; background: none; color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 10.5px; font-weight: 600; padding-top: 6px;
  transition: color 0.15s;
}
.tab svg { width: 24px; height: 24px; transition: transform 0.15s; }
.tab.active { color: var(--emerald); }
.tab.active svg { transform: translateY(-1px) scale(1.06); }

/* ===================== Toast ===================== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 60;
  background: #16241f; border: 1px solid rgba(255,255,255,0.08);
  color: #eaf5f0; padding: 11px 18px; border-radius: 30px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.3s ease; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--action { display: flex; align-items: center; gap: 14px; padding: 9px 9px 9px 18px; }
.toast--action.show { pointer-events: auto; }
.toast__btn {
  appearance: none; border: none; background: rgba(255,255,255,0.12); cursor: pointer;
  color: var(--gold); font-weight: 800; font-size: 14px; font-family: var(--font);
  padding: 7px 13px; border-radius: 22px;
}
.toast__btn:active { transform: scale(0.95); }

/* Misc */
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.spacer { height: 8px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
@media (min-width: 560px) { .page-head h2 { font-size: 30px; } }

/* ===================== Dark Mode (Teheccüt = Nachtnutzung) ===================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1613;
    --bg-2: #161f1b;
    --surface: #18221e;
    --surface-2: #212d28;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #e8f0ec;
    --muted: #95aaa0;
    --emerald: #c77fc1;
    --emerald-soft: rgba(199, 127, 193, 0.18);
    --emerald-deep: #a85fa2;
    --gold: #d7ab5b;
    --gold-soft: rgba(215, 171, 91, 0.16);
    --danger: #e0786a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
  body {
    background:
      radial-gradient(1100px 600px at 100% -10%, rgba(199, 127, 193, 0.14), transparent 55%),
      radial-gradient(900px 500px at -10% 0%, rgba(215, 171, 91, 0.08), transparent 50%),
      linear-gradient(180deg, #121a16, var(--bg));
  }
  .topbar { background: linear-gradient(180deg, rgba(22, 31, 27, 0.92), rgba(22, 31, 27, 0.66)); }
  .tabbar { background: linear-gradient(180deg, rgba(18, 26, 22, 0.85), rgba(18, 26, 22, 0.98)); }
  .lock { background: linear-gradient(180deg, #121a16, var(--bg)); }
  .bigtoggle__ring svg { color: #5f7068; }
  .toast { background: #243029; color: #eaf5f0; border: 1px solid rgba(255, 255, 255, 0.10); }
  .btn--primary { box-shadow: 0 8px 20px rgba(199, 127, 193, 0.30); }
}
