/* Surah Ar-Rahman Web App Stylesheet */

:root {
  --primary-emerald: #047857;
  --primary-dark: #064e3b;
  --primary-deep: #022c22;
  --primary-light: #10b981;
  --accent-gold: #d97706;
  --accent-gold-light: #fbbf24;
  --accent-gold-dark: #b45309;
  --bg-page: #f8faf9;
  --bg-card: #ffffff;
  --bg-card-muted: #f1f5f3;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --font-arabic-uthmani: 'Amiri Quran', 'Amiri', serif;
  --font-arabic-simple: 'Scheherazade New', serif;
  --font-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', serif;
  --font-latin: 'Plus Jakarta Sans', sans-serif;
  --arabic-size: 2.15rem;
  --urdu-size: 1.25rem;
  --english-size: 0.98rem;
}

.dark {
  --bg-page: #0a1310;
  --bg-card: #12211b;
  --bg-card-muted: #182e25;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e382c;
}

body {
  font-family: var(--font-latin);
  background-color: var(--bg-page);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Typography Classes */
.font-arabic {
  font-family: var(--font-arabic-uthmani);
  font-size: var(--arabic-size);
  line-height: 2.2;
  direction: rtl;
}

.font-arabic-simple {
  font-family: var(--font-arabic-simple);
  font-size: var(--arabic-size);
  line-height: 2.1;
  direction: rtl;
}

.font-urdu {
  font-family: var(--font-urdu);
  direction: rtl;
  line-height: 2.0;
}

.urdu-text {
  font-family: var(--font-urdu);
  font-size: var(--urdu-size);
  line-height: 2.4;
  direction: rtl;
}

.urdu-heading {
  font-family: var(--font-urdu);
  direction: rtl;
  line-height: 2.1;
}

/* Hero Arabic Calligraphy Specific Line Heights (prevents overlap with tashkeel & descenders) */
.hero-arabic-title {
  line-height: 1.7 !important;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  display: block;
}

.hero-bismillah-arabic {
  line-height: 1.85 !important;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.font-english {
  font-size: var(--english-size);
  line-height: 1.6;
}

/* Islamic Geometric Background Pattern */
.islamic-pattern {
  background-color: var(--primary-deep);
  background-image: radial-gradient(circle at 50% 50%, rgba(217, 119, 6, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(6, 78, 59, 0.3) 0%, transparent 50%);
}

.subtle-pattern {
  background-image: radial-gradient(rgba(4, 120, 87, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}

.dark .subtle-pattern {
  background-image: radial-gradient(rgba(16, 185, 129, 0.07) 1px, transparent 1px);
}

/* Ayah Card Styling */
.ayah-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ayah-card:hover {
  border-color: rgba(4, 120, 87, 0.35);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.dark .ayah-card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Active Audio Playing State */
.ayah-card.playing {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2), 0 12px 28px -4px rgba(5, 150, 105, 0.15) !important;
  background-color: rgba(5, 150, 105, 0.04);
}

.dark .ayah-card.playing {
  background-color: rgba(5, 150, 105, 0.08);
}

/* Refrain "Fabi-Ayyi" Special Highlight */
.refrain-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.dark .refrain-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Quran Mushaf Ayah End Symbol */
.ayah-end-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
  font-family: var(--font-latin);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 8px;
  vertical-align: middle;
  background: rgba(217, 119, 6, 0.08);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Sticky Player Bottom Bar Animation */
.player-slide-up {
  animation: slideUp 0.3s ease-out forwards;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Pulse animation for live audio status */
@keyframes audioPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.audio-pulse-indicator {
  animation: audioPulse 1.8s infinite ease-in-out;
}

/* Modern Segmented Navigation Tabs */
.nav-tabs-wrapper {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}

.dark .nav-tabs-wrapper {
  background-color: #0b1712;
  border-color: #1e3328;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.nav-tab:hover {
  color: #047857;
  background-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dark .nav-tab {
  color: #94a3b8;
}

.dark .nav-tab:hover {
  color: #34d399;
  background-color: rgba(255, 255, 255, 0.07);
}

.nav-tab.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px -2px rgba(4, 120, 87, 0.4), 0 2px 4px -2px rgba(4, 120, 87, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.dark .nav-tab.active {
  background: linear-gradient(135deg, #059669 0%, #065f46 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.35) !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
}

.nav-tab.active i {
  color: #ffffff !important;
}

/* Sleek Filter & Search Controls */
.filter-select, .filter-input {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.5rem 0.65rem;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.filter-select:hover, .filter-input:hover {
  border-color: #94a3b8;
  background-color: #ffffff;
}

.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18);
  background-color: #ffffff;
}

.dark .filter-select, .dark .filter-input {
  background-color: #12211b;
  border-color: #1e3328;
  color: #f1f5f9;
}

.dark .filter-select:hover, .dark .filter-input:hover {
  border-color: #2d4a3b;
  background-color: #162922;
}

.dark .filter-select:focus, .dark .filter-input:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
  background-color: #162922;
}

/* Sunnah Toast Notification */
.sunnah-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  max-width: 440px;
  animation: toastFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastFadeIn {
  from {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Print Friendly Styles */
@media print {
  header, nav, #sticky-player, .action-buttons, #top-toolbar, footer {
    display: none !important;
  }
  body, .ayah-card {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* Feature Images & Banners */
.featured-banner-img {
  width: 100%;
  height: auto;
  border-radius: 1.5rem;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-banner-img:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px -5px rgba(16, 185, 129, 0.2);
}

.img-caption-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.6rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.dark .img-caption-box {
  color: #94a3b8;
}

/* Surah Rahman Quran Pages Gallery (Modeled after surahyaseen.pk) */
.quran-pages-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
}

@media (min-width: 640px) {
  .quran-pages-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .quran-pages-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.quran-page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s ease;
  cursor: pointer;
}

.dark .quran-page-card {
  background: #12211b;
  border-color: rgba(16, 185, 129, 0.2);
}

.quran-page-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

.quran-page-img-wrap {
  position: relative;
  overflow: hidden;
  background-color: #f8fafc;
  aspect-ratio: 1 / 1.55;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark .quran-page-img-wrap {
  background-color: #0c1813;
}

.quran-page-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.quran-page-card:hover .quran-page-img-wrap img {
  transform: scale(1.03);
}

.quran-page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(16, 185, 129, 0.15);
  background: #fafafa;
}

.dark .quran-page-foot {
  background: #0f1c16;
  border-top-color: rgba(16, 185, 129, 0.1);
}

.quran-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.dark .quran-page-badge {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}

/* Lightbox Modal for Quran Page Full View */
.quran-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-color: rgba(5, 15, 10, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  animation: fadeIn 0.25s ease-out;
}

.quran-modal-content {
  position: relative;
  width: 100%;
  max-width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.quran-modal-img {
  max-width: 96vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: max-height 0.2s ease, width 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Sticky Toolbar Positioning below Nav Header */
#top-toolbar {
  top: 61px;
}
@media (min-width: 640px) {
  #top-toolbar {
    top: 65px;
  }
}

.ayah-card {
  scroll-margin-top: 170px;
}

/* ========================================================
   Mobile-First & Touch Device Optimizations (Screens < 640px)
   ======================================================== */
@media (max-width: 639px) {
  :root {
    --arabic-size: 1.75rem;
    --urdu-size: 1.15rem;
    --english-size: 0.92rem;
  }

  html, body {
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-text-size-adjust: 100%;
  }

  /* Compact Sticky Toolbar on mobile */
  #top-toolbar {
    top: 57px;
  }

  .ayah-card {
    padding: 0.95rem !important;
    border-radius: 1rem !important;
    scroll-margin-top: 135px;
  }

  /* Hero Section Mobile Typography */
  .hero-arabic-title {
    font-size: 2.25rem !important;
    line-height: 1.6 !important;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .hero-bismillah-arabic {
    font-size: 1.45rem !important;
    line-height: 1.7 !important;
  }

  .font-arabic, .font-arabic-simple {
    line-height: 2.0;
  }

  .urdu-text {
    line-height: 2.1;
  }

  /* Mobile Touch-Friendly Action Buttons */
  .action-buttons {
    gap: 0.35rem !important;
  }

  .action-buttons button {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.72rem !important;
    border-radius: 0.65rem !important;
    min-height: 32px;
  }

  /* Filter Selects & Inputs for Mobile */
  .filter-select, .filter-input {
    font-size: 0.75rem !important;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
    min-height: 38px;
    border-radius: 0.75rem;
  }

  /* Sticky Player Mobile Compactness */
  #sticky-player {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  #sticky-player .max-w-5xl {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    gap: 0.4rem !important;
  }

  /* Featured Banners on Mobile */
  .featured-banner-img {
    border-radius: 0.85rem !important;
  }

  .img-caption-box {
    font-size: 0.72rem !important;
    padding: 0.45rem 0.65rem !important;
  }

  /* Quran Modal Lightbox on Mobile */
  .quran-modal-content {
    max-height: 82vh;
  }

  .quran-modal-img {
    max-height: 78vh;
    border-radius: 0.5rem;
  }
}



