/* ============================================================
   QURAN AUDIO SITES — islamictimes.net  v4
   Dark gold theme · 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;

  /* Two-row header: top row ~36px + switcher row ~36px = 72px total */
  --header-h:    72px;
  --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(--header-h) + var(--player-h));
  padding-bottom: 3rem;
  -webkit-font-smoothing: antialiased;
}

/* ── GLOBAL LINK RESET ───────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
  -webkit-text-decoration: none;
}
a:visited { color: inherit; }
a:focus   { outline: none; }

/* ── HEADER — two rows stacked ──────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--gold-dim);
  z-index: 100;
  display: flex;
  align-items: stretch;
}

.header-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;   /* stack two rows vertically */
}

/* ── Row 1: back+logo LEFT · site title RIGHT ── */
.header-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex: 1;
  border-bottom: 1px solid var(--gold-dim);
}

/* Back link = arrow + ISLAMIC TIMES logo, no underline */
.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;
}

/* Centre-ish title: "Urdu Quran" / "Arabic Quran" / "English Quran" */
.header-title {
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  white-space: nowrap;
  /* absolute centre within the top row */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ── Row 2: language switcher — full width of header ── */
.lang-switcher {
  display: flex;
  align-items: stretch;
  width: 100%;
  /* No border-radius — flush against header edges */
  background: var(--bg);
}

.lang-btn {
  flex: 1;                  /* each pill takes equal share of full width */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;         /* row 2 is 36px; full row = full tap target */
  font-family: Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--gold-muted);
  background: transparent;
  border-right: 1px solid var(--gold-dim);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, color 0.18s;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.lang-btn:last-child { border-right: none; }
.lang-btn:hover  { background: var(--gold-glow); color: var(--gold); }
.lang-btn:active { background: var(--gold-dim);  color: var(--gold-bright); }

/* Active pill */
.lang-btn--active {
  background: var(--gold-dim);
  color: var(--gold-bright);
  font-weight: bold;
  cursor: default;
  pointer-events: none;
}
/* Gold accent bar across top of active pill */
.lang-btn--active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
}

/* ── STICKY PLAYER ──────────────────────────────────────── */
.sticky-player {
  position: fixed;
  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;
}
.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;
}

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

/* ── TABS ───────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--gold-dim);
  margin-bottom: 1.25rem;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: Georgia, serif;
  padding: 0.6rem 1rem 0.5rem;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.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; }

/* ── SEARCH ─────────────────────────────────────────────── */
.search-wrap { margin-bottom: 1rem; }
.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: Georgia, serif;
  padding: 0.6rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.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.6rem;
}

/*
  Surah card layout:
    [ num ] [ name / meta ]  [ arabic · resume-pip ]

  The right column (.surah-right) stacks the Arabic name on top
  and the resume pip centred below it — no more overlap.
*/
.surah-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  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);
}

/* Number circle */
.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); }

/* Name + meta */
.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-meta .type-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--gold-dim);
  color: var(--gold-muted);
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/*
  Right column — Arabic name on top, resume pip below.
  Flex column keeps them stacked and centred, no overlap.
*/
.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); }

/* Resume pip — now lives inside .surah-right, not absolute positioned */
.resume-pip {
  font-size: 0.6rem;
  background: var(--gold-dim);
  color: var(--gold);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  display: none;          /* shown only when .has-progress is set */
  border: 1px solid var(--gold-muted);
}
.surah-card.has-progress .resume-pip { display: block; }
.surah-card.active .resume-pip {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold-bright);
}

/* ── JUZ GRID ───────────────────────────────────────────── */
.section-intro { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }
.juz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
}
.juz-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  cursor: pointer; text-align: center;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.juz-card:hover { border-color: var(--gold-muted); background: var(--bg-card2); }
.juz-card.active { border-color: var(--gold); background: var(--bg-card2); }
.juz-number { font-size: 1.6rem; font-weight: bold; color: var(--gold); line-height: 1; font-family: Georgia, serif; }
.juz-card.active .juz-number { color: var(--gold-bright); }
.juz-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.juz-starts { font-size: 0.72rem; color: var(--gold-muted); margin-top: 6px; line-height: 1.4; }

/* ── FULL QURAN ─────────────────────────────────────────── */
.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-resume-info  { font-size: 0.78rem; color: var(--gold-bright); margin-top: 0.5rem; min-height: 1.2em; }
.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); }
.full-restart-btn {
  display: block; background: none;
  border: 1px solid var(--gold-dim); color: var(--gold-muted);
  border-radius: var(--radius); padding: 0.5rem 1rem;
  font-size: 0.8rem; font-family: Georgia, serif;
  cursor: pointer; margin: 0.75rem auto 0;
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.full-restart-btn:hover { border-color: var(--gold-muted); color: var(--gold); }
.full-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.stat-item {
  background: var(--bg-card); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 1rem 0.5rem; text-align: center;
}
.stat-value { font-size: 1.3rem; font-weight: bold; color: var(--gold-bright); font-family: Georgia, serif; }
.stat-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  margin-top: 2rem;
  border-top: 1px solid var(--gold-dim);
  max-width: 900px;
  margin-left: auto; margin-right: auto;
}
.footer-arabic { font-family: 'Amiri', serif; font-size: 1.2rem; color: var(--gold); direction: rtl; margin-bottom: 0.4rem; }
.footer-trans  { font-size: 0.78rem; color: var(--gold-muted); font-style: italic; margin-bottom: 1rem; }
.footer-meta   { font-size: 0.72rem; color: var(--text-dim); line-height: 1.8; }
.footer-meta a { color: var(--gold-muted); text-decoration: none; }
.footer-meta a:hover { color: var(--gold); }

/* ── 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; }
  .juz-grid   { grid-template-columns: repeat(3, 1fr); }
  .tab-btn    { font-size: 0.8rem; padding: 0.55rem 0.75rem 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.76rem; padding: 0.55rem 0.5rem 0.45rem; }
  .lang-btn { font-size: 0.72rem; }
  .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; }
  .juz-grid { grid-template-columns: repeat(2, 1fr); }
  .lang-btn { font-size: 0.66rem; }
}

/* Safe area — notch / Dynamic Island / home bar */
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
}
