/* ── Web Fonts ─────────────────────────────────────────────── */
@font-face {
  font-family: 'Amiri';
  src: url('https://www.islamictimes.net/fonts/Amiri-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   TAFSIR — tafsir.islamictimes.net  v1
   Dark gold theme — matching urduquran/arabicquran/englishquran
   ============================================================ */

:root {
  --bg:          #0a0a00;
  --bg-card:     #111100;
  --bg-card2:    #161600;
  --gold:        #c9a84c;
  --gold-bright: #f0c040;
  --gold-muted:  #7a6a30;
  --gold-dim:    #3a3020;
  --gold-glow:   rgba(201,168,76,0.15);
  --text:        #e8e0c8;
  --text-muted:  #8a8060;
  --text-dim:    #4a4030;
  --radius:      10px;
  --radius-sm:   6px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --header-h:    36px;
  --player-h:    156px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100vh;
  padding-top: calc(var(--safe-top) + var(--header-h) + var(--player-h));
  padding-bottom: 3rem;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; -webkit-text-decoration: none; }
a:visited { color: inherit; }
a:focus   { outline: none; }

/* ── HEADER ────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--safe-top) + var(--header-h));
  background: var(--bg);
  border-bottom: 1px solid var(--gold-dim);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}
.header-inner {
  width: 100%; max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column; flex: 1;
}
.header-row-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; flex: 1;
}
.back-link {
  display: flex; align-items: center; gap: 0.4rem;
  color: var(--gold-muted); text-decoration: none; -webkit-text-decoration: none;
  border: none; outline: none; flex-shrink: 0; padding: 0.25rem 0;
  -webkit-tap-highlight-color: transparent; transition: color 0.2s;
}
.back-link:hover, .back-link:active  { color: var(--gold-bright); }
.back-link:visited { color: var(--gold-muted); }
.back-link:focus   { outline: none; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: 1; user-select: none; }
.logo-top, .logo-bottom {
  font-family: Georgia, serif; font-weight: bold; font-size: 0.58rem;
  letter-spacing: 0.2em; color: var(--gold); display: block;
}
.logo-line { width: 100%; height: 1px; background: var(--gold-muted); opacity: 0.7; margin: 2px 0; display: block; border: none; }
.header-title {
  font-family: Georgia, serif; font-size: 0.82rem; font-weight: bold;
  letter-spacing: 0.06em; color: var(--gold-bright); white-space: nowrap;
  position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
}

/* ── STICKY PLAYER ─────────────────────────────────────────── */
.sticky-player {
  position: fixed;
  top: calc(var(--safe-top) + var(--header-h));
  left: 0; right: 0;
  height: var(--player-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--gold-dim);
  z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  padding: 10px 1.25rem 12px;
  overflow: hidden;
}
.player-info { text-align: center; width: 100%; max-width: 600px; }
.player-surah-name { font-size: 0.92rem; color: var(--gold-bright); font-weight: bold; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-ayat-info { font-size: 0.7rem; color: var(--gold-muted); line-height: 1.25; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 1.25rem; flex-shrink: 0; }
.ctrl-btn {
  background: none; border: none; color: var(--gold-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 50%;
  transition: color 0.2s, background 0.2s; -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover  { color: var(--gold-bright); background: var(--gold-glow); }
.ctrl-btn:active { transform: scale(0.92); }
.play-btn {
  background: var(--gold-dim); color: var(--gold); border-radius: 50%;
  width: 52px; height: 52px; min-width: 52px; min-height: 52px;
  border: 1px solid var(--gold-muted); transition: background 0.2s, color 0.2s, transform 0.15s;
}
.play-btn:hover { background: var(--gold); color: var(--bg); }
.play-btn.playing { background: var(--gold); color: var(--bg); box-shadow: 0 0 20px var(--gold-glow); }
.player-progress-wrap { width: 100%; max-width: 600px; margin-top: 10px; }
.progress-bar { position: relative; height: 3px; background: var(--gold-dim); border-radius: 2px; cursor: pointer; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 2px; width: 0%; transition: width 0.25s linear; pointer-events: none; }
.progress-range { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 100%; height: 28px; opacity: 0; cursor: pointer; margin: 0; z-index: 2; -webkit-appearance: none; }
.progress-times { display: flex; justify-content: space-between; font-size: 0.6rem; color: var(--text-dim); margin-top: 4px; font-family: monospace; }
.playback-bar {
  display: none; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 0 6px; padding: 5px 12px; background: rgba(0,0,0,0.35);
  font-size: 0.72rem; color: var(--gold-muted); letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 26px;
}
.playback-bar.active { display: flex; }
.pb-divider { opacity: 0.45; font-size: 0.65rem; }

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content { max-width: 900px; margin: 0 auto; padding: 1.25rem 1rem 0; }

/* ── TAB NAV ───────────────────────────────────────────────── */
.tab-nav { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--gold-dim); margin-bottom: 1.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn {
  background: none; border-top: none; border-right: none; border-left: none; border-image: initial;
  border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer;
  font-size: 0.78rem; font-family: Georgia, serif; padding: 0.6rem 0.6rem 0.5rem;
  transition: color 0.2s, border-color 0.2s; letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent; white-space: nowrap; margin-bottom: -1px; flex-shrink: 0;
}
.tab-btn:hover { color: var(--gold); }
.tab-btn.active { color: var(--gold-bright); border-bottom-color: var(--gold-bright); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SCHOLAR BANNER ────────────────────────────────────────── */
.scholar-banner {
  text-align: center; margin-bottom: 1rem; padding: 0.75rem 0;
  border-bottom: 1px solid var(--gold-dim);
}
.scholar-name { font-size: 1rem; font-weight: bold; color: var(--gold-bright); letter-spacing: 0.04em; }
.scholar-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── SEARCH ────────────────────────────────────────────────── */
.search-wrap { margin-bottom: 1rem; }
.search-input {
  width: 100%; padding: 0.65rem 1rem; font-size: 0.88rem;
  font-family: Georgia, serif; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  outline: none; transition: border-color 0.2s;
  -webkit-appearance: none;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--gold-muted); }

/* ── SURAH GRID ────────────────────────────────────────────── */
.surah-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.5rem;
}
.surah-card {
  display: flex; align-items: center; gap: 0.65rem;
  background: var(--bg-card); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: 0.65rem 0.75rem; cursor: pointer;
  transition: border-color 0.2s, background 0.2s; position: relative;
  -webkit-tap-highlight-color: transparent; min-height: 60px;
}
.surah-card:hover { border-color: var(--gold-muted); background: var(--bg-card2); }
.surah-card.active { border-color: var(--gold); background: var(--bg-card2); box-shadow: 0 0 0 1px var(--gold-dim) inset, 0 2px 12px var(--gold-glow); }
.surah-card.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gold-bright); border-radius: var(--radius) 0 0 var(--radius);
}
.surah-num {
  width: 32px; height: 32px; border: 1px solid var(--gold-dim); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--gold-muted); flex-shrink: 0; font-family: monospace;
}
.surah-card.active .surah-num { border-color: var(--gold); color: var(--gold-bright); }
.surah-info { flex: 1; min-width: 0; }
.surah-en { font-size: 0.88rem; color: var(--text); font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah-card.active .surah-en { color: var(--gold-bright); }
.surah-meta { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }
.surah-right { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; flex-shrink: 0; min-width: 52px; }
.surah-arabic { font-family: 'Amiri', serif; font-size: 1.05rem; color: var(--gold); direction: rtl; line-height: 1; text-align: center; }
.surah-card.active .surah-arabic { color: var(--gold-bright); }

/* ── SESSION LIST (Full Tafsir) ────────────────────────────── */
.session-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.session-item {
  display: flex; align-items: center; gap: 0.65rem;
  background: var(--bg-card); border: 1px solid var(--gold-dim); border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.session-item:hover { border-color: var(--gold-muted); background: var(--bg-card2); }
.session-item.active { border-color: var(--gold); background: var(--bg-card2); }
.session-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gold-bright); border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.session-num { font-size: 0.7rem; color: var(--gold-muted); font-family: monospace; min-width: 36px; text-align: center; }
.session-item.active .session-num { color: var(--gold-bright); }
.session-name { font-size: 0.82rem; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-item.active .session-name { color: var(--gold-bright); }

/* ── FULL QURAN CARD ───────────────────────────────────────── */
.full-quran-card {
  background: var(--bg-card); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: 2rem 1.5rem; text-align: center; margin-bottom: 1.25rem;
}
.full-quran-arabic { font-family: 'Amiri', serif; font-size: 1.5rem; color: var(--gold-bright); direction: rtl; margin-bottom: 1rem; line-height: 1.6; }
.full-quran-label  { font-size: 1.1rem; font-weight: bold; color: var(--text); margin-bottom: 0.35rem; }
.full-quran-meta   { font-size: 0.78rem; color: var(--text-muted); }
.full-play-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--gold); color: var(--bg); border: none; border-radius: var(--radius);
  padding: 0.75rem 2rem; font-size: 1rem; font-family: Georgia, serif; font-weight: bold;
  cursor: pointer; margin-top: 1.25rem;
  transition: background 0.2s, transform 0.15s; -webkit-tap-highlight-color: transparent;
}
.full-play-btn:hover  { background: var(--gold-bright); }
.full-play-btn:active { transform: scale(0.97); }

/* ── FOOTER ────────────────────────────────────────────────── */
.site-footer { background: var(--bg); border-top: 1px solid rgba(201,168,76,0.2); margin-top: 0; }
.footer-inner { max-width: 720px; margin: 0 auto; padding: 24px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 0; }
.footer-group { width: 100%; text-align: center; padding: 14px 0; }
.footer-group + .footer-group { border-top: 1px solid rgba(120,100,40,0.25); }
.footer-values { padding: 16px 0; }
.no-app-needed {
  display: block; text-align: center; color: #f0c040; font-size: 0.92rem;
  letter-spacing: 0.08em; margin-bottom: 4px;
  text-shadow: 0 0 8px rgba(240,192,64,0.35), 0 0 16px rgba(240,192,64,0.15);
  animation: gentleGlow 3s ease-in-out infinite;
}
.footer-tagline { font-size: 0.76rem; color: #c9a84c; letter-spacing: 0.04em; margin: 0; opacity: 0.9; }
@keyframes gentleGlow {
  0%   { text-shadow: 0 0 6px rgba(240,192,64,0.25), 0 0 12px rgba(240,192,64,0.1); }
  50%  { text-shadow: 0 0 10px rgba(240,192,64,0.5), 0 0 20px rgba(240,192,64,0.25); }
  100% { text-shadow: 0 0 6px rgba(240,192,64,0.25), 0 0 12px rgba(240,192,64,0.1); }
}
.footer-micro { font-size: 0.72rem; color: #7a6a30; opacity: 1; line-height: 1.9; }
.footer-contact { color: inherit; font-size: inherit; }
.footer-dua { font-style: italic; font-size: 0.72rem; color: inherit; }
.footer-version { font-size: 0.7rem; color: inherit; margin-top: 2px; }
.footer-link { color: #7a6a30; text-decoration: none; }
.footer-link:hover { color: #c9a84c; }
.footer-reset { padding: 18px 0 4px; }
.reset-btn {
  background: none; border: 1px solid rgba(201,168,76,0.35); color: #7a6a30;
  font-family: Georgia, serif; font-size: 0.75rem; letter-spacing: 0.06em;
  padding: 8px 20px; border-radius: 4px; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s; -webkit-tap-highlight-color: transparent;
}
.reset-btn:hover { border-color: rgba(201,168,76,0.7); color: #c9a84c; background: rgba(201,168,76,0.06); }
.reset-btn:active { background: rgba(201,168,76,0.12); transform: scale(0.97); }
.reset-hint { font-size: 0.66rem; color: #5a4e22; margin-top: 6px; opacity: 0.8; }

/* ── LOADING ───────────────────────────────────────────────── */
.loading-msg { text-align: center; color: var(--text-dim); font-size: 0.82rem; padding: 2rem; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --player-h: 152px; }
  .sticky-player { padding: 8px 1rem 10px; }
  .surah-grid { grid-template-columns: 1fr; }
  .tab-btn { font-size: 0.72rem; padding: 0.55rem 0.45rem 0.45rem; }
}
@media (max-width: 430px) {
  :root { --player-h: 148px; }
  .sticky-player { padding: 7px 0.875rem 9px; }
  .player-surah-name { font-size: 0.85rem; }
  .player-ayat-info  { font-size: 0.67rem; }
  .play-btn { width: 48px; height: 48px; min-width: 48px; min-height: 48px; }
  .full-quran-card { padding: 1.25rem 1rem; }
  .tab-btn { font-size: 0.68rem; padding: 0.55rem 0.35rem 0.45rem; }
  .header-title { font-size: 0.76rem; }
}
@media (max-width: 360px) {
  :root { --player-h: 144px; }
  .sticky-player { padding: 6px 0.75rem 8px; }
  .player-controls { gap: 0.75rem; }
}
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
}
