/* ===== Font Imports ===== */
@import url('https://fonts.googleapis.com/css2?family=Scheherazade+New:wght@400;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables - Dark Mode (Default) ===== */
:root {
  --bg-primary: #0a0f0d;
  --bg-secondary: #111916;
  --bg-card: #151d19;
  --bg-card-hover: #1a2520;
  --accent-gold: #c9a227;
  --accent-gold-light: #e8c547;
  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --text-primary: #f0f7f4;
  --text-secondary: #a3b8b0;
  --text-muted: #6b7d76;
  --border-color: #243029;
  --border-glow: rgba(201, 162, 39, 0.3);
}

/* ===== Light Mode ===== */
[data-theme="light"] {
  --bg-primary: #f8faf9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f5f3;
  --accent-gold: #b8860b;
  --accent-gold-light: #d4a017;
  --accent-emerald: #059669;
  --accent-emerald-dark: #047857;
  --text-primary: #1a2e25;
  --text-secondary: #4a5f56;
  --text-muted: #7a8f86;
  --border-color: #d4ddd9;
  --border-glow: rgba(184, 134, 11, 0.2);
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Arabic Text ===== */
.arabic {
  font-family: 'Scheherazade New', 'Traditional Arabic', 'Amiri', Tahoma, serif;
  font-size: 2rem;
  line-height: 2.4;
  text-align: right;
  direction: rtl;
  font-weight: 400;
  letter-spacing: 0;
}

.arabic-small {
  font-size: 1.5rem;
  line-height: 1.8;
}

.arabic-large {
  font-size: 2.5rem;
  line-height: 2.4;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Header/Navigation ===== */
.navbar {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--accent-gold);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ===== Hero Section ===== */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  background: radial-gradient(ellipse at top, rgba(201, 162, 39, 0.08) 0%, transparent 60%);
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-arabic {
  font-family: 'Scheherazade New', 'Traditional Arabic', Tahoma, serif;
  font-size: 2.25rem;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
  direction: rtl;
}

/* ===== Search Box ===== */
.search-container {
  max-width: 500px;
  margin: 0 auto 3rem;
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px var(--border-glow);
}

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

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ===== Surah Grid ===== */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  padding-bottom: 4rem;
}

.surah-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.surah-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.15);
  transform: translateY(-2px);
}

.surah-number {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-emerald-dark) 0%, var(--accent-emerald) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: white;
  flex-shrink: 0;
}

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

.surah-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.surah-latin {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.surah-arabic {
  font-family: 'Scheherazade New', 'Traditional Arabic', Tahoma, serif;
  font-size: 1.5rem;
  color: var(--accent-gold);
  direction: rtl;
}

.surah-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

.meta-dot {
  opacity: 0.5;
}

.surah-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-mekah {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-madinah {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* ===== Detail Page ===== */
.surah-detail-header {
  text-align: center;
  padding: 3rem 0;
  background: radial-gradient(ellipse at top, rgba(201, 162, 39, 0.1) 0%, transparent 60%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.surah-detail-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 100%);
  border-radius: 16px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bg-primary);
  margin-bottom: 1rem;
}

.surah-detail-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.surah-detail-arabic {
  font-family: 'Scheherazade New', 'Traditional Arabic', Tahoma, serif;
  font-size: 2.75rem;
  color: var(--accent-gold);
  direction: rtl;
  margin-bottom: 1rem;
}

.surah-detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.meta-divider {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
}

.surah-description-wrapper {
  margin-top: 1.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.surah-description-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.surah-description-toggle:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.surah-description-toggle svg {
  transition: transform 0.3s ease;
}

.surah-description-toggle svg.rotate {
  transform: rotate(180deg);
}

.surah-description {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: left;
}

.surah-description i {
  font-style: italic;
  color: var(--accent-gold);
}

/* ===== Audio Player ===== */
.audio-player {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.audio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.audio-title {
  font-weight: 600;
  color: var(--text-primary);
}

.qari-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
}

.qari-select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-element {
  flex: 1;
  height: 40px;
}

audio {
  width: 100%;
  border-radius: 8px;
}

audio::-webkit-media-controls-panel {
  background: var(--bg-secondary);
}

/* ===== Ayat List ===== */
.ayat-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 4rem;
}

.ayat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  transition: all 0.3s ease;
}

.ayat-card:hover {
  border-color: rgba(201, 162, 39, 0.3);
}

.ayat-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ayat-number {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-emerald-dark) 0%, var(--accent-emerald) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  flex-shrink: 0;
}

.ayat-arabic {
  flex: 1;
  font-family: 'Scheherazade New', 'Traditional Arabic', Tahoma, serif;
  font-size: 2.25rem;
  line-height: 2.6;
  text-align: right;
  direction: rtl;
  color: var(--text-primary);
}

.ayat-latin {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--accent-gold-light);
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

.ayat-translation {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.ayat-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-emerald-dark) 0%, var(--accent-emerald) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--accent-gold);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--accent-gold);
}

.modal-body {
  padding: 2rem;
}

.tafsir-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.footer-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-text a {
  color: var(--accent-gold);
  text-decoration: none;
}

.footer-text a:hover {
  text-decoration: underline;
}

/* ===== Loading State ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* ===== Back Button ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--accent-gold);
}

/* ===== Bismillah ===== */
.bismillah {
  text-align: center;
  padding: 2rem 0;
  font-family: 'Scheherazade New', 'Traditional Arabic', Tahoma, serif;
  font-size: 2.75rem;
  color: var(--accent-gold);
  direction: rtl;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .surah-grid {
    grid-template-columns: 1fr;
  }
  
  .surah-detail-title {
    font-size: 1.75rem;
  }
  
  .surah-detail-arabic {
    font-size: 2rem;
  }
  
  .ayat-card {
    padding: 1.5rem;
  }
  
  .ayat-arabic {
    font-size: 1.5rem;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .nav-links {
    display: none;
  }

  .surah-detail-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .meta-divider {
    display: none;
  }
}

