/* ============================================================================
   public/assets/css/iqra.css — Fitur Iqro (fitur-iqro.md §12–§19)
   ----------------------------------------------------------------------------
   Berisi: beranda Iqro (hero, kartu lanjutkan, grid jilid, progress),
   detail jilid (cover, pemilih halaman), dan reader imersif (viewport,
   hotspot, scrubber, bottom bar, dialog latihan/rekam).
   Memakai variabel tema MuslimHub (--green-*, --gold-500, --bg-card, --ink-*,
   --c-primary) supaya ikut mode terang/gelap & preset warna.
   ============================================================================ */

/* ------------------------------------------------------------------ */
/* BERANDA (§2, §24)                                                  */
/* ------------------------------------------------------------------ */
.iq-hero {
  position: relative;
  border-radius: var(--radius-xl, 22px);
  padding: 20px 18px;
  color: #EAF4EF;
  background: linear-gradient(135deg, var(--green-800, #0B4A3A), var(--green-500, #17755C));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.iq-hero::after {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,163,51,.35), transparent 65%);
}
.iq-hero-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill, 999px);
  background: rgba(255, 255, 255, .16);
}
.iq-hero h2 { margin: 10px 0 6px; font-size: 22px; }
.iq-hero p { margin: 0; font-size: 13.5px; line-height: 1.55; opacity: .92; }

/* Kartu "Lanjutkan" (§2) */
.iq-continue {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-card, #fff);
  border: 1px solid rgba(17, 99, 80, .14);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
}
.iq-continue-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.iq-continue-label { font-weight: 600; font-size: 13px; color: var(--green-600, #116350); }
.iq-continue-sub { font-size: 15px; font-weight: 600; }
.iq-continue-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ink-500, #66756D); }
.iq-btn-inline { color: var(--green-600, #116350); font-weight: 600; }

/* Progress bar bersama */
.iq-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 99, 80, .14);
  overflow: hidden;
}
.iq-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-500, #17755C), var(--gold-500, #F7A333));
  transition: width .35s ease;
}

.iq-start { display: grid; gap: 8px; }
.iq-start h3 { margin: 0; }

/* Grid 6 jilid */
.iq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.iq-book {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-card, #fff);
  border: 1px solid rgba(17, 99, 80, .12);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
}
.iq-book.done { border-color: rgba(247, 163, 51, .5); }
.iq-book-no { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--green-600, #116350); font-weight: 600; }
.iq-book-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; min-height: 36px; }
.iq-book-meta { font-size: 11.5px; color: var(--ink-500, #66756D); }
.iq-book-last { font-size: 11.5px; color: var(--ink-700, #33413A); }
.iq-book-done { position: absolute; top: 10px; right: 10px; font-size: 11px; color: #8A5A00; background: #FFF3D6; border-radius: 999px; padding: 2px 8px; }

/* Dashboard progress (§24) */
.iq-progress { display: grid; gap: 14px; }
.iq-progress-row { display: grid; gap: 6px; }
.iq-progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.iq-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed rgba(17, 99, 80, .18);
}
.iq-stats .cell { display: grid; gap: 2px; text-align: center; }
.iq-stats .cell b { font-size: 16px; color: var(--green-700, #0E5745); }
.iq-stats .cell span { font-size: 11.5px; color: var(--ink-500, #66756D); }

.iq-guide ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.5; }
.iq-note { display: grid; gap: 6px; font-size: 12.5px; line-height: 1.5; }
.iq-note p { margin: 0; color: var(--ink-500, #66756D); }
.iq-dot { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--green-100, #DCEFE7); flex: none; }

/* ------------------------------------------------------------------ */
/* DETAIL JILID (§15, §16)                                            */
/* ------------------------------------------------------------------ */
.iq-cover {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-card, #fff);
  border: 1px solid rgba(17, 99, 80, .12);
  box-shadow: var(--shadow-card);
}
.iq-cover-art {
  display: grid;
  place-content: center;
  gap: 2px;
  text-align: center;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  color: #F6FBF8;
  background: linear-gradient(160deg, var(--green-700, #0E5745), var(--green-500, #17755C));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.iq-cover-art span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.iq-cover-art b { font-size: 34px; line-height: 1; }
.iq-cover-body { display: grid; gap: 8px; align-content: start; }
.iq-cover-body h2 { margin: 0; font-size: 18px; }
.iq-cover-sub { margin: 0; font-size: 13px; color: var(--green-600, #116350); font-weight: 500; }
.iq-cover-body p { margin: 0; }
.iq-cover-bar { display: grid; gap: 6px; margin: 2px 0 4px; }
.iq-cover-body .btn-pill { justify-self: start; }

.iq-materi ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; font-size: 13px; line-height: 1.5; }

.iq-chips { margin-bottom: 12px; }
.iq-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}
.iq-page-cell {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid rgba(17, 99, 80, .14);
  background: var(--bg-card, #fff);
  text-decoration: none;
  color: var(--ink-900, #101613);
}
.iq-page-cell:active { transform: scale(.97); }
.iq-page-no { font-size: 14px; font-weight: 600; }
.iq-page-sym { font-size: 11px; line-height: 1; }
.iq-page-sym.s-unread { color: var(--ink-300, #9AA8A0); }
.iq-page-sym.s-learning { color: var(--gold-500, #F7A333); }
.iq-page-sym.s-mastered { color: var(--green-600, #116350); }
.iq-page-cell.marked { border-color: rgba(247, 163, 51, .55); background: #FFF9EE; }
.iq-page-bm { position: absolute; top: 4px; right: 5px; font-size: 11px; }
.iq-legend { display: block; margin: 10px 2px 0; }

.iq-latihan { display: grid; gap: 10px; }
.iq-latihan-row { display: grid; gap: 4px; }
.iq-latihan-label { font-size: 12px; color: var(--ink-500, #66756D); }
.iq-latihan-items { font-family: var(--font-arab, 'Amiri', serif); font-size: 20px; line-height: 1.9; direction: rtl; }

/* ------------------------------------------------------------------ */
/* READER IMERSIF (§12, §13, §14)                                     */
/* ------------------------------------------------------------------ */
.iq-loading { display: grid; place-items: center; height: 60vh; color: var(--ink-500, #66756D); }

/* Mode imersif: chrome aplikasi disembunyikan (pola sama quran-reader-mode). */
body.iqra-reader-mode .header,
body.iqra-reader-mode .bottom-nav,
body.iqra-reader-mode .audio-player,
body.iqra-reader-mode footer { display: none !important; }
body.iqra-reader-mode { overflow: hidden; overscroll-behavior: none; }
body.iqra-reader-mode #app { padding: 0; max-width: none; margin: 0; }

.iq-reader {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  background: #0B1410; /* chrome gelap: nyaman untuk bacaan panjang (§30) */
  color: #EAF4EF;
  z-index: 60;
}

/* ---- Top bar ---- */
.iq-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
  background: linear-gradient(rgba(4, 10, 8, .92), rgba(4, 10, 8, .55));
  transition: opacity .25s ease, transform .25s ease;
}
.iq-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.iq-title b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-title span { font-size: 11.5px; opacity: .72; }
.iq-icon {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  color: #EAF4EF;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}
.iq-icon svg { width: 20px; height: 20px; }
.iq-icon.on { background: var(--gold-500, #F7A333); color: #1A1305; }
.iq-icon:active { transform: scale(.94); }

/* ---- Viewport halaman (zoom/pan oleh DocumentReader) ---- */
.iq-viewport {
  position: relative;
  overflow: hidden;
  touch-action: none;   /* gesture ditangani reader, bukan browser (§14) */
  display: grid;
  place-items: center;
  padding: 6px;
}
.doc-viewport { position: relative; }
.doc-content {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform .08s linear;
}
.doc-page {
  position: relative;
  margin: 0;
  width: min(100%, 720px);
  height: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  background: #FBF7F0;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.iq-page-img { width: 100%; height: 100%; object-fit: contain; display: block; background: #FBF7F0; }
.iq-page-img.missing { display: none; }

/* Kerangka halaman saat aset scan belum tersedia (lisensi — §catatan penting) */
.iq-page-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  gap: 8px;
  padding: 26px;
  text-align: center;
  color: #33413A;
  background:
    repeating-linear-gradient(180deg, rgba(17, 99, 80, .07) 0 1px, transparent 1px 34px),
    radial-gradient(circle at 50% 12%, rgba(247, 163, 51, .16), transparent 60%),
    #FBF7F0;
}
.iq-page-fallback.show { display: grid; }
.iq-page-fallback-badge {
  justify-self: center;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(17, 99, 80, .12);
  color: var(--green-700, #0E5745);
}
.iq-page-fallback b { font-size: 22px; }
.iq-page-fallback-note { font-size: 12px; line-height: 1.6; color: #66756D; }
.iq-page-fallback-note code { font-size: 11px; background: rgba(17, 99, 80, .1); padding: 1px 5px; border-radius: 6px; }

/* Hotspot bacaan (§6, §7) */
.doc-hotspots { position: absolute; inset: 0; pointer-events: none; }
.doc-region {
  position: absolute;
  padding: 0;
  border: 1.5px dashed rgba(17, 99, 80, .35);
  border-radius: 8px;
  background: rgba(247, 163, 51, .10);
  pointer-events: auto;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.doc-region.active {
  background: rgba(247, 163, 51, .34);
  border-color: var(--gold-500, #F7A333);
  border-style: solid;
}

/* ---- Scrubber + tombol lompat halaman (§15) ---- */
.iq-scrub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  transition: opacity .25s ease, transform .25s ease;
}
.iq-scrub input[type="range"] { flex: 1; accent-color: var(--gold-500, #F7A333); }
.iq-jump {
  flex: none;
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, .1);
  color: #EAF4EF;
  font-size: 12px;
  cursor: pointer;
}

/* ---- Bottom bar + aksi (§12, §17) ---- */
.iq-bottombar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(rgba(4, 10, 8, .55), rgba(4, 10, 8, .92));
  transition: opacity .25s ease, transform .25s ease;
}
.iq-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .1);
  color: #EAF4EF;
  font-size: 13px;
  cursor: pointer;
  min-width: 44px;
}
.iq-btn.wide { flex: 1; }
.iq-btn.primary { background: var(--gold-500, #F7A333); color: #1A1305; font-weight: 600; }
.iq-btn:disabled { opacity: .35; cursor: default; }
.iq-btn:active:not(:disabled) { transform: scale(.96); }
.iq-rate { font-size: 11px; opacity: .8; }
.iq-actions {
  display: flex;
  justify-content: center;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
  transition: opacity .25s ease, transform .25s ease;
}
.iq-master {
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  color: #EAF4EF;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
}
.iq-master.on { background: var(--green-500, #17755C); border-color: transparent; font-weight: 600; }

/* Chrome disembunyikan otomatis saat membaca (§12) */
.iq-reader.chrome-off .iq-topbar { opacity: 0; pointer-events: none; transform: translateY(-10px); }
.iq-reader.chrome-off .iq-scrub,
.iq-reader.chrome-off .iq-bottombar,
.iq-reader.chrome-off .iq-actions { opacity: 0; pointer-events: none; transform: translateY(10px); }

/* ---- Dialog: lompat halaman, latihan, rekam, jilid selesai ---- */
.iq-dialog {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 380px;
  width: calc(100% - 32px);
  background: #14201B;
  color: #EAF4EF;
}
.iq-dialog::backdrop { background: rgba(4, 8, 6, .6); backdrop-filter: blur(3px); }
.iq-dialog-body { display: grid; gap: 12px; padding: 18px; }
.iq-dialog-body h3 { margin: 0; font-size: 16px; }
.iq-dialog-body input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  color: inherit;
  font-size: 15px;
}
.iq-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.iq-dialog-actions .iq-btn { flex: 1; text-align: center; text-decoration: none; display: inline-grid; place-items: center; }
.iq-practice-arab {
  font-family: var(--font-arab, 'Amiri', serif);
  font-size: 34px;
  line-height: 1.8;
  text-align: center;
  direction: rtl;
  padding: 14px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
}

/* ---- Responsif (§13: tetap SATU halaman, karakter sebesar mungkin) ---- */
@media (min-width: 760px) {
  .iq-cover { grid-template-columns: 132px 1fr; }
  .iq-stats { grid-template-columns: repeat(4, 1fr); }
  .iq-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
html[data-theme='dark'] .iq-page-cell.marked { background: rgba(247, 163, 51, .16); }
html[data-theme='dark'] .iq-continue,
html[data-theme='dark'] .iq-book { border-color: rgba(255, 255, 255, .08); }
