/* Markaz-e-ilm — Quran reader with tarjuma */

.qr-page {
  --qr-blue: var(--bs-primary, #1b5fae);
  --qr-green: #1f8a5b;
  --qr-ink: #1d2733;
  --qr-muted: #66727f;
  --qr-line: #e4e9ef;
  --qr-soft: #f4f8fc;
  --qr-gold: #b8913a;
  --qr-ar-size: 34px;
  --qr-tr-size: 17px;
  --qr-ar-font: "Amiri Quran", "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  --qr-ur-font: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;
  --qr-hi-font: "Noto Sans Devanagari", "Mangal", sans-serif;
  color: var(--qr-ink);
}

/* ---------- shared ---------- */
.qr-bismillah {
  font-family: var(--qr-ar-font);
  font-size: 30px;
  line-height: 2;
  color: var(--qr-green);
  text-align: center;
}
.qr-bismillah-lg { font-size: calc(var(--qr-ar-size) * 0.95); margin: 8px 0 18px; }

.qr-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 40px;
  border: 1px solid var(--qr-line); border-radius: 999px;
  background: #fff; color: var(--qr-ink);
  font-size: 14px; font-weight: 500; line-height: 1;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.qr-btn:hover { border-color: var(--qr-blue); color: var(--qr-blue); }
.qr-btn-primary { background: var(--qr-blue); border-color: var(--qr-blue); color: #fff; }
.qr-btn-primary:hover { background: var(--qr-green); border-color: var(--qr-green); color: #fff; }
.qr-btn-sm { padding: 6px 12px; min-height: 36px; }
.qr-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--qr-soft); color: var(--qr-blue); font-size: 12px;
  display: inline-grid; place-items: center;
}

/* ---------- index ---------- */
.qr-hero {
  padding: 40px 0 32px; text-align: center;
  background: linear-gradient(180deg, var(--qr-soft), #fff);
  border-bottom: 1px solid var(--qr-line);
}
.qr-hero-title { font-size: clamp(26px, 4vw, 36px); font-weight: 700; margin: 4px 0; }
.qr-hero-sub { color: var(--qr-muted); margin: 0; }
.qr-continue {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center;
  margin-top: 18px; padding: 10px 16px; border-radius: 12px;
  background: #fff; border: 1px solid var(--qr-line);
}
.qr-continue-label { font-size: 13px; color: var(--qr-muted); }
.qr-continue-link { font-weight: 600; color: var(--qr-green); text-decoration: none; }

.qr-index { padding-top: 24px; padding-bottom: 40px; }
.qr-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.qr-tabs { display: inline-flex; background: var(--qr-soft); border-radius: 999px; padding: 4px; }
.qr-tab {
  border: 0; background: transparent; padding: 8px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--qr-muted); cursor: pointer;
}
.qr-tab.is-active { background: #fff; color: var(--qr-blue); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.qr-search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 380px;
  padding: 0 14px; border: 1px solid var(--qr-line); border-radius: 999px; color: var(--qr-muted);
  background: #fff;
}
.qr-search input { border: 0; outline: 0; flex: 1; min-height: 42px; background: transparent; font-size: 15px; }
.qr-search:focus-within { border-color: var(--qr-blue); }

.qr-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.qr-grid[hidden] { display: none; }
.qr-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--qr-line); border-radius: 14px;
  background: #fff; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.qr-card:hover { border-color: var(--qr-blue); box-shadow: 0 4px 14px rgba(27,95,174,.08); transform: translateY(-1px); color: inherit; }
.qr-card[hidden] { display: none; }
.qr-card-num {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px;
  background: var(--qr-soft); color: var(--qr-blue); font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.qr-card:hover .qr-card-num { background: var(--qr-blue); color: #fff; }
.qr-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qr-card-title { font-weight: 600; }
.qr-card-meta { font-size: 12.5px; color: var(--qr-muted); }
.qr-card-side { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.qr-card-ar { font-family: var(--qr-ar-font); font-size: 20px; line-height: 1.6; color: var(--qr-green); }
.qr-empty { text-align: center; color: var(--qr-muted); padding: 24px 0; }
.qr-credit { margin-top: 28px; font-size: 12.5px; color: var(--qr-muted); text-align: center; }

/* ---------- reader ---------- */
.qr-surah-head {
  text-align: center; padding: 22px 0 26px;
  background: linear-gradient(180deg, var(--qr-soft), #fff);
}
.qr-back { display: inline-block; font-size: 14px; color: var(--qr-muted); text-decoration: none; margin-bottom: 6px; }
.qr-back:hover { color: var(--qr-blue); }
.qr-surah-ar { font-family: var(--qr-ar-font); font-size: 40px; line-height: 1.7; color: var(--qr-green); }
.qr-surah-title { font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; margin: 0; }
.qr-surah-meta { color: var(--qr-muted); margin: 4px 0 0; }

.qr-bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--qr-line); border-bottom: 1px solid var(--qr-line);
}
.qr-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
.qr-jump { display: inline-flex; gap: 6px; align-items: center; }
.qr-jump input {
  width: 92px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--qr-line); border-radius: 999px; font-size: 14px;
}
/* one-tap toolbar */
.qr-bar-inner { gap: 10px 18px; }
.qr-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qr-group-label { font-size: 13px; font-weight: 600; color: var(--qr-muted); margin-inline-end: 2px; }
.qr-toggle {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--qr-line); border-radius: 999px; background: #fff; color: var(--qr-ink);
  font-size: 14px; font-weight: 500; line-height: 1; text-decoration: none; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.qr-toggle:hover { border-color: var(--qr-blue); color: var(--qr-blue); }
.qr-toggle.is-on { background: var(--qr-blue); border-color: var(--qr-blue); color: #fff; }
.qr-toggle.is-on:hover { background: var(--qr-green); border-color: var(--qr-green); color: #fff; }
.qr-toggle:focus-visible, .qr-select:focus-visible, .qr-link:focus-visible { outline: 2px solid var(--qr-green); outline-offset: 2px; }
.qr-toggle[lang="ur"] { font-family: var(--qr-ur-font); font-size: 15px; padding-top: 2px; }
.qr-toggle [lang="hi"], .qr-toggle[lang="hi"] { font-family: var(--qr-hi-font); }
.qr-size { display: inline-flex; }
.qr-size .qr-toggle { padding: 6px 11px; font-weight: 600; }
.qr-size .qr-toggle:first-child { border-radius: 999px 0 0 999px; border-inline-end-width: 0; }
.qr-size .qr-toggle:last-child { border-radius: 0 999px 999px 0; }
.qr-select {
  min-height: 36px; padding: 0 30px 0 14px; border: 1px solid var(--qr-line); border-radius: 999px; background-color: #fff;
  font-size: 14px; color: var(--qr-ink); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2366727f' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px;
}
.qr-bar-sub { padding-bottom: 6px; margin-top: -4px; }
.qr-link { border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--qr-blue); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.qr-panel { border-top: 1px solid var(--qr-line); background: #fff; padding: 14px 0 16px; max-height: 60vh; overflow: auto; }
.qr-panel[hidden] { display: none; }
.qr-panel-hint { font-size: 13px; color: var(--qr-muted); margin: 0 0 8px; }
.qr-langset { margin: 0 0 12px; padding: 0; border: 0; }
.qr-langset legend { font-size: 13px; font-weight: 700; color: var(--qr-ink); margin-bottom: 6px; float: none; width: auto; padding: 0; }
.qr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-chip { position: relative; cursor: pointer; }
.qr-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.qr-chip span {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--qr-line); font-size: 13.5px; background: #fff; transition: all .15s;
}
.qr-chip input:checked + span { background: var(--qr-blue); border-color: var(--qr-blue); color: #fff; }
.qr-chip input:focus-visible + span { outline: 2px solid var(--qr-green); outline-offset: 2px; }
.qr-chip input:disabled + span { opacity: .45; cursor: not-allowed; }
.qr-panel-actions { display: flex; gap: 8px; margin-top: 6px; }
.qr-settings { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.qr-range, .qr-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; margin: 0; }
.qr-range input { width: 150px; accent-color: var(--qr-blue); }
.qr-switch input { width: 18px; height: 18px; accent-color: var(--qr-blue); }

.qr-ayahs { max-width: 920px; padding-top: 18px; padding-bottom: 12px; }
.qr-ayah {
  padding: 18px 0 20px; border-bottom: 1px solid var(--qr-line);
  scroll-margin-top: 80px; transition: background .3s;
}
.qr-ayah.is-target, .qr-ayah.is-playing {
  background: linear-gradient(90deg, rgba(31,138,91,.06), rgba(27,95,174,.04));
  border-radius: 12px; padding-left: 12px; padding-right: 12px;
}
.qr-ayah-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.qr-ref {
  font-size: 13px; font-weight: 600; color: var(--qr-blue); text-decoration: none;
  padding: 3px 10px; border-radius: 999px; background: var(--qr-soft);
}
.qr-sajda { font-size: 12px; color: var(--qr-gold); font-weight: 600; }
.qr-actions { margin-left: auto; display: flex; gap: 2px; }
.qr-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--qr-muted); cursor: pointer;
}
.qr-icon:hover { background: var(--qr-soft); color: var(--qr-blue); }
.qr-icon .qr-ico-pause { display: none; }
.qr-ayah.is-playing .qr-icon[data-qr-play] { color: var(--qr-green); }
.qr-ayah.is-playing .qr-icon .qr-ico-play { display: none; }
.qr-ayah.is-playing .qr-icon .qr-ico-pause { display: inline; }

.qr-arabic {
  font-family: var(--qr-ar-font);
  font-size: var(--qr-ar-size);
  line-height: 2.2;
  text-align: right;
  margin: 0 0 10px;
  word-spacing: 2px;
}
.qr-end {
  display: inline-grid; place-items: center;
  min-width: 1.35em; height: 1.35em; margin: 0 .3em; padding: 0 .15em;
  border: 1.5px solid var(--qr-gold); border-radius: 50%;
  font-size: .5em; line-height: 1; color: var(--qr-gold);
  vertical-align: middle; font-family: var(--qr-ar-font);
}

.qr-tr { margin-top: 10px; }
.qr-tr-by {
  display: block; font-size: 11.5px; letter-spacing: .02em; text-transform: uppercase;
  color: var(--qr-muted); margin-bottom: 2px; font-family: system-ui, sans-serif;
}
.qr-tr[dir="rtl"] .qr-tr-by { text-align: right; }
.qr-tr-text { margin: 0; font-size: var(--qr-tr-size); line-height: 1.75; }
.qr-tr-ur .qr-tr-text { font-family: var(--qr-ur-font); font-size: calc(var(--qr-tr-size) * 1.12); line-height: 2.3; }
.qr-tr-hi .qr-tr-text { font-family: var(--qr-hi-font); line-height: 1.9; }

.qr-reader.hide-arabic .qr-arabic,
.qr-reader.hide-arabic .qr-bismillah-lg { display: none; }
.qr-reader.hide-tarjuma .qr-tr { display: none; }

/* Quran in Hindi (Devanagari) letters — under the Arabic, when switched on in Display */
.qr-deva {
  display: none; margin: -2px 0 12px; padding: 8px 12px; border-radius: 10px;
  background: rgba(29, 95, 74, .06); border-inline-start: 3px solid rgba(29, 95, 74, .35);
  font-family: var(--qr-hi-font); font-size: calc(var(--qr-tr-size) * 1.12); line-height: 1.9; color: #1d5f4a;
}
.qr-reader.show-deva .qr-deva { display: block; }
.qr-reader.show-deva .qr-deva[hidden] { display: none; }
.qr-deva-bism { text-align: center; border-inline-start: 0; background: none; margin-top: -6px; }

.qr-juz-mark { display: flex; align-items: center; gap: 12px; margin: 22px 0 4px; color: var(--qr-gold); font-size: 13px; font-weight: 600; }
.qr-juz-mark::before, .qr-juz-mark::after { content: ""; flex: 1; height: 1px; background: var(--qr-line); }

.qr-pager { max-width: 920px; display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 40px; }
.qr-pager-link {
  display: flex; flex-direction: column; padding: 12px 18px; border: 1px solid var(--qr-line);
  border-radius: 14px; color: inherit; text-decoration: none; min-width: 0;
}
.qr-pager-link:hover { border-color: var(--qr-blue); color: var(--qr-blue); }
.qr-pager-link small { color: var(--qr-muted); }
.qr-pager-next { text-align: right; margin-left: auto; }

.qr-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--qr-ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

/* ---------- admin ---------- */
.qr-step {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: #eef2f6; color: #4a5866; font-weight: 700; font-size: 14px; flex: none;
}
.qr-step.is-done { background: #1f8a5b; color: #fff; }
.qr-admin .is-busy { pointer-events: none; opacity: .6; }

/* ---------- small screens ---------- */
@media (max-width: 575.98px) {
  .qr-page { --qr-ar-size: 28px; }
  .qr-bar-inner { gap: 8px; }
  .qr-toggle { padding: 6px 11px; font-size: 13px; min-height: 34px; }
  .qr-select { min-height: 34px; font-size: 13px; }
  .qr-btn { padding: 7px 11px; font-size: 13px; }
  .qr-jump input { width: 74px; }
  .qr-grid { grid-template-columns: 1fr; }
  .qr-surah-ar { font-size: 32px; }
  .qr-range input { width: 120px; }
  #qrPlayAll span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .qr-card, .qr-ayah { transition: none; }
}
