@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

/* Color Variables */
:root {
  --font-arabic: 'Amiri', serif;
  --font-sans: 'Cairo', sans-serif;
  
  /* Deep Spiritual Dark Theme (Default) */
  --bg-primary: radial-gradient(circle at top, #064e3b 0%, #022c22 40%, #0b1511 100%);
  --panel-bg: rgba(6, 78, 59, 0.15);
  --panel-border: rgba(251, 191, 36, 0.15);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-accent: #fbbf24; /* Amber Gold */
  --text-accent-hover: #f59e0b;
  --card-bg: rgba(2, 44, 34, 0.4);
  --card-bg-hover: rgba(4, 120, 87, 0.25);
  --card-active: rgba(4, 120, 87, 0.4);
  --glow-color: rgba(251, 191, 36, 0.45);
  --slider-track: rgba(251, 191, 36, 0.2);
  --scrollbar-thumb: #d97706;
  --scrollbar-track: rgba(2, 44, 34, 0.5);
  --input-bg: rgba(11, 21, 17, 0.6);
}

[data-theme="light"] {
  /* Warm Spiritual Sand/Cream Light Theme */
  --bg-primary: linear-gradient(135deg, #fdfbf7 0%, #f5f2eb 100%);
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(4, 120, 87, 0.15);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-accent: #047857; /* Emerald Green */
  --text-accent-hover: #065f46;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-bg-hover: rgba(4, 120, 87, 0.08);
  --card-active: rgba(4, 120, 87, 0.15);
  --glow-color: rgba(4, 120, 87, 0.25);
  --slider-track: rgba(4, 120, 87, 0.2);
  --scrollbar-thumb: #047857;
  --scrollbar-track: rgba(245, 242, 235, 0.8);
  --input-bg: rgba(255, 255, 255, 0.9);
}

/* Global Styles */
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.5s ease, color 0.3s ease;
  overflow-x: hidden;
}

.font-quran {
  font-family: var(--font-arabic);
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(251, 191, 36, 0.25);
}

/* Audio Player Card Glow */
.player-glow {
  box-shadow: 0 0 25px var(--glow-color);
}

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

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
  transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-accent-hover);
}

/* Surah Playlist Scrollbar Specifics */
.playlist-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* Surah Cards */
.surah-card {
  background: var(--card-bg);
  border: 1px solid rgba(251, 191, 36, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.surah-card:hover {
  background: var(--card-bg-hover);
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.surah-card.active {
  background: var(--card-active);
  border-color: var(--text-accent);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.15);
}

/* Animations */
@keyframes bounceWave {
  0%, 100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
  }
}

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

.animate-slide-in {
  animation: slideIn 0.4s ease forwards;
}

.visualizer-bar {
  transform-origin: bottom;
  animation: bounceWave 1.2s ease-in-out infinite;
}

/* Different speeds for visualizer bars for realistic effect */
.visualizer-bar:nth-child(2) { animation-delay: 0.1s; animation-duration: 0.8s; }
.visualizer-bar:nth-child(3) { animation-delay: 0.25s; animation-duration: 1.4s; }
.visualizer-bar:nth-child(4) { animation-delay: 0.05s; animation-duration: 1.1s; }
.visualizer-bar:nth-child(5) { animation-delay: 0.35s; animation-duration: 0.7s; }
.visualizer-bar:nth-child(6) { animation-delay: 0.15s; animation-duration: 1.3s; }
.visualizer-bar:nth-child(7) { animation-delay: 0.2s; animation-duration: 0.9s; }
.visualizer-bar:nth-child(8) { animation-delay: 0.3s; animation-duration: 1.2s; }

.visualizer-paused .visualizer-bar {
  animation-play-state: paused;
  transform: scaleY(0.3) !important;
}

.spin-slow {
  animation: spinSlow 20s linear infinite;
}

.spin-paused {
  animation-play-state: paused;
}

.pulse-glow-active {
  animation: pulseGlow 2s infinite;
}

/* Seek Slider Custom Design */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--slider-track);
  border-radius: 4px;
  outline: none;
  transition: background 0.3s;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  background: var(--text-accent-hover);
}

.range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
}

.range-slider::-moz-range-thumb:hover {
  transform: scale(1.3);
  background: var(--text-accent-hover);
}

/* Inputs and elements */
.custom-input {
  background: var(--input-bg);
  border: 1px solid rgba(251, 191, 36, 0.1);
  color: var(--text-primary);
  transition: all 0.3s;
}

.custom-input:focus {
  border-color: var(--text-accent);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
  outline: none;
}

/* TV specific styling updates */
@media (min-width: 1920px) {
  body {
    font-size: 1.1rem;
  }
  .playlist-scroll {
    max-height: 70vh;
  }
}
