/* ============================================================
   HOLY QURAN — Luxury Islamic Aesthetic
   Palette: Deep midnight navy · Antique gold · Ivory parchment
   Fonts: Cormorant Garamond (display) · Amiri (Arabic) · Outfit (UI)
   ============================================================ */

:root {
  --gold:        #D4AF37;
  --gold-light:  #F0D060;
  --gold-dim:    #8B6914;
  --navy:        #0A0E1A;
  --navy-mid:    #111827;
  --navy-card:   #0D1525;
  --navy-hover:  #162035;
  --ivory:       #F5F0E8;
  --ivory-dim:   #C8BFA8;
  --white:       #FFFFFF;
  --text-muted:  #7A8499;
  --meccan:      #C9A84C;
  --medinan:     #5B9BD5;
  --radius:      14px;
  --radius-sm:   8px;
  --player-h:    90px;
  --header-h:    70px;
  --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--navy);
  color: var(--ivory);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(var(--player-h) + 20px);
}

/* ============================================================
   3D CANVAS BACKGROUND
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212,175,55,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 100% 100%, rgba(91,155,213,0.06) 0%, transparent 50%),
    linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.75) 40%, rgba(10,14,26,0.92) 100%);
  pointer-events: none;
}

/* All content above canvas */
header, section, main, .player, .loading-overlay { position: relative; z-index: 2; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(212,175,55,0.15);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.logo-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1;
}

.logo-divider {
  color: rgba(212,175,55,0.3);
  font-size: 1.2rem;
}

.logo-english {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ivory-dim);
  letter-spacing: 0.05em;
}

.header-nav {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-btn {
  background: transparent;
  border: 1px solid rgba(212,175,55,0.2);
  color: var(--ivory-dim);
  padding: 0.45rem 1.2rem;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.03em;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(212,175,55,0.12);
  border-color: var(--gold);
  color: var(--gold);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: 50px;
  padding: 0.45rem 1rem;
  transition: var(--transition);
}

.header-search:focus-within {
  border-color: rgba(212,175,55,0.5);
  background: rgba(212,175,55,0.05);
}

.header-search svg { color: var(--text-muted); flex-shrink: 0; }

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--ivory);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  width: 180px;
}

.header-search input::placeholder { color: var(--text-muted); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  text-align: center;
  padding: 5rem 2rem 3rem;
  position: relative;
}

.hero-bismillah {
  font-family: 'Amiri', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--gold);
  margin-bottom: 1.5rem;
  text-shadow: 0 0 40px rgba(212,175,55,0.4);
  animation: fadeDown 1s ease both;
  direction: rtl;
}

.hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 300;
  color: var(--ivory);
  letter-spacing: 0.08em;
  line-height: 1.1;
  animation: fadeDown 1s 0.15s ease both;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadeDown 1s 0.3s ease both;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 2.5rem;
  animation: fadeDown 1s 0.45s ease both;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(212,175,55,0.2);
}

/* ============================================================
   RECITER BAR
   ============================================================ */
.reciter-bar {
  background: rgba(13,21,37,0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(212,175,55,0.1);
  border-bottom: 1px solid rgba(212,175,55,0.1);
  padding: 0.85rem 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.reciter-bar::-webkit-scrollbar { display: none; }

.reciter-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reciter-bar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.reciter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.reciter-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: 50px;
  padding: 0.35rem 0.9rem 0.35rem 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.reciter-chip:hover {
  background: rgba(212,175,55,0.08);
  border-color: rgba(212,175,55,0.4);
}

.reciter-chip.active {
  background: rgba(212,175,55,0.15);
  border-color: var(--gold);
}

.reciter-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.reciter-chip-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ivory-dim);
}

.reciter-chip.active .reciter-chip-name { color: var(--gold); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.view { display: none; }
.view.active { display: block; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  background: transparent;
  border: 1px solid rgba(212,175,55,0.2);
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.04em;
}

.filter-btn:hover { color: var(--ivory); border-color: rgba(212,175,55,0.4); }

.filter-btn.active {
  background: rgba(212,175,55,0.12);
  border-color: var(--gold);
  color: var(--gold);
}

/* ============================================================
   SURAH GRID
   ============================================================ */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.surah-card {
  background: rgba(13,21,37,0.7);
  border: 1px solid rgba(212,175,55,0.1);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  animation: cardIn 0.4s ease both;
}

.surah-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212,175,55,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.surah-card:hover {
  border-color: rgba(212,175,55,0.4);
  background: rgba(22,32,53,0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(212,175,55,0.1);
}

.surah-card:hover::before { opacity: 1; }

.surah-card.playing {
  border-color: var(--gold);
  background: rgba(212,175,55,0.08);
  box-shadow: 0 0 24px rgba(212,175,55,0.15), 0 8px 32px rgba(0,0,0,0.4);
}

.surah-card.playing .surah-num { color: var(--gold); }

.surah-num-wrap {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.surah-num-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(212,175,55,0.25);
}

.surah-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ivory-dim);
  position: relative;
  z-index: 1;
  line-height: 1;
}

.surah-info { flex: 1; min-width: 0; }

.surah-name-en {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-meaning {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.surah-verses {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.surah-type {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
}

.surah-type.Meccan {
  background: rgba(201,168,76,0.12);
  color: var(--meccan);
  border: 1px solid rgba(201,168,76,0.25);
}

.surah-type.Medinan {
  background: rgba(91,155,213,0.12);
  color: var(--medinan);
  border: 1px solid rgba(91,155,213,0.25);
}

.surah-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.4rem;
  color: var(--gold);
  direction: rtl;
  line-height: 1;
  flex-shrink: 0;
}

.surah-play-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  color: var(--gold);
}

.surah-card:hover .surah-play-icon {
  background: rgba(212,175,55,0.2);
  border-color: var(--gold);
}

.surah-card.playing .surah-play-icon {
  background: var(--gold);
  color: var(--navy);
}

/* ============================================================
   RECITERS GRID
   ============================================================ */
.reciters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding-top: 0.5rem;
}

.reciter-card {
  background: rgba(13,21,37,0.8);
  border: 1px solid rgba(212,175,55,0.12);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.reciter-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: scaleX(0);
  transition: var(--transition);
}

.reciter-card:hover {
  border-color: rgba(212,175,55,0.35);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.reciter-card:hover::after { transform: scaleX(1); }

.reciter-card.active {
  border-color: var(--gold);
  background: rgba(212,175,55,0.07);
}

.reciter-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  border: 2px solid rgba(212,175,55,0.3);
  overflow: hidden;
  background: rgba(212,175,55,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: var(--gold);
}

.reciter-avatar img { width: 100%; height: 100%; object-fit: cover; }

.reciter-name-en {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ivory);
  margin-bottom: 0.3rem;
}

.reciter-name-ar {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--gold);
  direction: rtl;
  margin-bottom: 0.75rem;
}

.reciter-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reciter-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.2);
  color: var(--ivory-dim);
  letter-spacing: 0.05em;
}

.reciter-select-btn {
  margin-top: 1.2rem;
  width: 100%;
  padding: 0.6rem;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.05em;
}

.reciter-select-btn:hover,
.reciter-card.active .reciter-select-btn {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

/* ============================================================
   AUDIO PLAYER
   ============================================================ */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(8, 12, 22, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(212,175,55,0.2);
  height: var(--player-h);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
}

.player-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 0 0 280px;
}

.player-surah-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  min-width: 2rem;
  text-align: center;
}

.player-details { min-width: 0; flex: 1; }

.player-surah-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-reciter-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
  color: var(--gold);
  direction: rtl;
  flex-shrink: 0;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--ivory-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ctrl-btn:hover { color: var(--gold); background: rgba(212,175,55,0.1); }

.play-btn {
  width: 48px;
  height: 48px;
  background: var(--gold) !important;
  color: var(--navy) !important;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(212,175,55,0.3);
}

.play-btn:hover {
  background: var(--gold-light) !important;
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(212,175,55,0.5);
}

.hidden { display: none !important; }

.player-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.time-current, .time-total {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
}

.time-total { text-align: right; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s;
}

.progress-bar:hover { height: 6px; }

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.progress-bar:hover .progress-thumb { opacity: 1; }

.player-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-overlay.visible { display: flex; }

.loading-content { text-align: center; }

.loading-arabic {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
  animation: pulse 2s ease infinite;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(212,175,55,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.loading-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(212,175,55,0.3); }
  50%       { box-shadow: 0 0 24px rgba(212,175,55,0.7); }
}

.surah-card.playing { animation: glow 2s ease infinite; }

/* Stagger card animations */
.surah-card:nth-child(1)  { animation-delay: 0.02s; }
.surah-card:nth-child(2)  { animation-delay: 0.04s; }
.surah-card:nth-child(3)  { animation-delay: 0.06s; }
.surah-card:nth-child(4)  { animation-delay: 0.08s; }
.surah-card:nth-child(5)  { animation-delay: 0.10s; }
.surah-card:nth-child(6)  { animation-delay: 0.12s; }
.surah-card:nth-child(7)  { animation-delay: 0.14s; }
.surah-card:nth-child(8)  { animation-delay: 0.16s; }
.surah-card:nth-child(9)  { animation-delay: 0.18s; }
.surah-card:nth-child(10) { animation-delay: 0.20s; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.5); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .player-info { flex: 0 0 200px; }
  .player-arabic { display: none; }
  .player-volume { display: none; }
  .header-search input { width: 120px; }
}

@media (max-width: 640px) {
  .header-inner { padding: 0 1rem; gap: 0.75rem; }
  .logo-english { display: none; }
  .hero { padding: 3rem 1rem 2rem; }
  .main-content { padding: 1rem; }
  .surah-grid { grid-template-columns: 1fr; }
  .player-inner { padding: 0 1rem; gap: 0.75rem; }
  .player-info { flex: 0 0 160px; }
  .player-surah-num { display: none; }
  .reciter-bar { padding: 0.75rem 1rem; }
}

/* ============================================================
   ORNAMENTAL DIVIDER
   ============================================================ */
.ornament {
  text-align: center;
  color: rgba(212,175,55,0.3);
  font-size: 1.2rem;
  letter-spacing: 0.5em;
  margin: 1rem 0;
  user-select: none;
}