@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;700&family=Amiri:wght@400;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;
  --primary-ultra-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --secondary-color: #10b981;
  --secondary-hover: #059669;
  --secondary-light: #d1fae5;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-light: #6b7280;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-secondary: #f1f5f9;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
  --transition: all 0.2s ease-in-out;
}

/* Background Pattern */
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-main);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233b82f6' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: var(--text-secondary);
  line-height: 1.6;
}

.container {
  max-width: 1280px;
}

/* Typography Enhancements */
h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

h1 {
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(120deg, var(--primary-dark), var(--primary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  border-radius: var(--radius-full);
}

.arabic-text {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 1.1rem;
  direction: rtl;
  line-height: 1.8;
}

.surah-arabic-name {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  margin-top: 0.25rem;
  color: var(--primary-dark);
}

/* Main Card Container */
.bg-white {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
}

.bg-white::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

/* Surah List Section */
.surah-list-container {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
  padding-right: 0.5rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-ultra-light);
  padding: 0.5rem;
}

.surah-list-container::-webkit-scrollbar {
  width: 6px;
}

.surah-list-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.surah-list-container::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
  border: 2px solid #f1f5f9;
}

#surah-search {
  transition: var(--transition);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  background-size: 1.25rem;
  padding-left: 2.5rem;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

#surah-search:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.surah-item {
  transition: var(--transition);
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: white;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.surah-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(to bottom, var(--primary-light), var(--primary-color));
  opacity: 0;
  transition: var(--transition);
}

.surah-item:hover {
  background-color: var(--bg-secondary);
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

.surah-item:hover::after {
  opacity: 1;
}

.surah-item.active {
  background: linear-gradient(to right, var(--primary-ultra-light), white);
  color: var(--primary-dark);
  font-weight: 500;
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
}

.surah-item.active::after {
  opacity: 1;
  width: 6px;
  background: linear-gradient(to bottom, var(--primary-color), var(--primary-dark));
}

.surah-item-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.surah-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.surah-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-ultra-light));
  color: var(--primary-dark);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.surah-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.surah-item.active .surah-number {
  background: linear-gradient(145deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}

.surah-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-left: 2.5rem;
}

.surah-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.surah-meta-item i {
  font-size: 0.7rem;
  color: var(--primary-color);
}

/* Duration Indicator */
.duration-indicator {
  height: 3px;
  width: 50px;
  background-color: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.duration-indicator-fill {
  height: 100%;
  width: 0%; /* Will be set dynamically */
  background: linear-gradient(to right, var(--primary-light), var(--primary-color));
  border-radius: var(--radius-full);
}

/* Player Section Styles */
#reciter-select {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  appearance: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

#reciter-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Current Surah Info */
#current-surah-info {
  background: linear-gradient(135deg, var(--primary-ultra-light), var(--primary-light));
  border-radius: var(--radius-lg);
  border-left: 5px solid var(--primary-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

#current-surah-info::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233b82f6' opacity='0.05'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  opacity: 0.1;
  transform: rotate(45deg);
}

#current-surah-name {
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#current-surah-name::before {
  content: "📖";
  font-size: 1.5rem;
}

#current-surah-details {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-left: 2.25rem;
}

/* Player Controls Area */
.bg-gray-100 {
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-top: 1.5rem;
  position: relative;
  overflow: hidden;
}

.bg-gray-100::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%233b82f6' fill-opacity='0.03' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* Waveform Visualization */
.audio-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin-bottom: 1rem;
  padding: 0 1rem;
}

.wave-bar {
  width: 3px;
  height: 3px;
  margin: 0 2px;
  background-color: var(--primary-light);
  border-radius: var(--radius-full);
  transition: height 0.2s ease;
}

.wave-bar.active {
  background-color: var(--primary-color);
}

/* Progress Bar & Time */
#progress-bar {
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease-in-out;
  margin-bottom: 0.5rem;
  position: relative;
  overflow: hidden;
}

#progress-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: var(--progress, 0%);
  height: 100%;
  background: linear-gradient(to right, var(--primary-light), var(--primary-color));
  border-radius: 4px;
  transition: width 0.1s linear;
}

#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  transition: var(--transition);
  position: relative;
  z-index: 2;
}

#progress-bar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  transition: var(--transition);
  position: relative;
  z-index: 2;
}

#progress-bar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#progress-bar::-moz-range-thumb:hover {
  transform: scale(1.2);
}

#current-time, #total-duration {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
}

/* Player Controls */
.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.player-controls button {
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.player-controls button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.player-controls button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

#play-pause-button {
  background: linear-gradient(145deg, var(--secondary-color), var(--secondary-hover));
  width: 60px !important;
  height: 60px !important;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

#play-pause-button::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
  transform: rotate(45deg);
  z-index: -1;
}

#play-pause-button:hover {
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

#play-pause-button:hover::before {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.2;
  }
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}

#prev-button, #next-button {
  background: linear-gradient(145deg, var(--primary-color), var(--primary-hover));
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
}

#rewind-button, #forward-button {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
}

#rewind-button i, #forward-button i {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.8rem;
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#volume-button {
  color: var(--text-secondary);
  transition: var(--transition);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#volume-slider {
  height: 5px;
  background: linear-gradient(to right, var(--primary-color), var(--primary-light));
  border-radius: 2.5px;
}

#volume-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.4);
}

#volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.4);
}

/* Repeat Button */
#repeat-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgb(221, 62, 168);
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

#repeat-button:hover {
  background-color: #ac4032;
  border-color: #648bc5;
}

#repeat-icon {
  font-size: 0.8rem;
}

/* Loading Indicator */
#loading-indicator {
  background-color: rgba(236, 77, 77, 0.9);
  backdrop-filter: blur(4px);
}

.loader {
  border: 3px solid rgba(111, 163, 231, 0.6);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Footer */
footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  color: var(--text-light);
  font-size: 0.9rem;
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  h1 {
    font-size: 1.75rem;
  }
  
  .player-controls {
    gap: 0.5rem;
  }
  
  #play-pause-button {
    width: 50px !important;
    height: 50px !important;
  }
  
  #prev-button, #next-button,
  #rewind-button, #forward-button {
    width: 40px !important;
    height: 40px !important;
  }
}

/* Animation for active elements */
@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.pulse-animation {
  animation: highlight-pulse 2s infinite;
}

/* Currently playing indicator */
.now-playing {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background-color: var(--secondary-light);
  color: var(--secondary-hover);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: auto;
}

.now-playing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--secondary-color);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease infinite;
}

@keyframes pulse-dot {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.8;
  }
}