/* ===== BASE RESET + FULL RESPONSIVE FIXES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family:
    "Tajawal",
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  height: 100vh;
  overflow: hidden;
  transition:
    background 0.4s ease,
    color 0.4s ease;
}

/* DARK MODE */
body.dark {
  --bg-base: #0a0c12;
  --bg-surface: #141821;
  --bg-sidebar: #0d0f17;
  --border: #242933;
  --text-primary: #edeff2;
  --text-secondary: #9ca3af;
  --accent: #06d6a0;
  --accent-glow: rgba(6, 214, 160, 0.15);
  --hover-bg: #1e2430;
  --card-bg: #11151e;
  --progress-track: #2a2f3c;
  --success: #10b981;
  background: linear-gradient(135deg, #0a0c12 0%, #141821 100%);
}

body:not(.dark) {
  --bg-base: #ffffff;
  --bg-surface: #f8fafb;
  --bg-sidebar: #ffffffeb;
  --border: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent: #06d6a0;
  --accent-glow: rgba(6, 214, 160, 0.12);
  --hover-bg: #f1f5f9;
  --card-bg: #ffffff;
  --progress-track: #e2e8f0;
  --success: #059669;
}

/* ===== ANIMATIONS LIBRARY ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse-border {
  0%,
  100% {
    border-color: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  50% {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px transparent;
  }
}

@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 8px var(--accent-glow);
  }
  50% {
    box-shadow:
      0 0 20px var(--accent-glow),
      0 0 40px var(--accent-glow);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes numberPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* ===== LOGO ===== */
.logo img {
  width: 100%;
  max-width: 110px;
  height: 60px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
}

.logo {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 800;
  background: linear-gradient(
    135deg,
    var(--accent),
    #06d6a0,
    #00b4d8,
    var(--accent)
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -1px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  animation: gradientShift 4s ease infinite;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: relative; /* Added to contain absolute close button */
  width: 300px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 1000;
  box-shadow: inset -1px 0 0 var(--border);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInLeft 0.5s ease both;
}

.search-box {
  padding: 14px 12px 10px;
}

#searchInput {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 48px;
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: scaleX(1.01);
}

.surah-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 24px;
}

.surah-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  margin-bottom: 5px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  animation: fadeInLeft 0.4s ease both;
}

.surah-item:hover {
  background: var(--hover-bg);
  transform: translateX(6px);
  box-shadow: 2px 0 12px var(--accent-glow);
}

.surah-item.active {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  animation: glowPulse 2s ease-in-out infinite;
}

.surah-num {
  background: var(--accent);
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.surah-item:hover .surah-num {
  transform: rotate(-8deg) scale(1.1);
}

.surah-name {
  font-weight: 500;
  flex: 1;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.surah-item:hover .surah-name {
  color: var(--accent);
}

.surah-arabic {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ===== FAVORITES ===== */
.favorites-section {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  font-weight: 500;
}

.favorites-header:hover {
  background: var(--hover-bg);
  padding-left: 20px;
}

.favorites-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
}

.favorites-list.open {
  max-height: 300px;
  overflow-y: auto;
}

.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  animation: fadeInUp 0.3s ease both;
}

.favorite-item:hover {
  background: var(--accent-glow);
  padding-left: 20px;
}

.favorite-info {
  flex: 1;
  color: var(--text-primary);
}

.remove-fav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  transition: all 0.2s;
  border-radius: 50%;
}

.remove-fav-btn:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
  transform: rotate(90deg) scale(1.2);
}

/* ===== PROGRESS STATS ===== */
.progress-stats {
  padding: 3px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.stats-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 8px;
}

.progress-bar-container {
  background: var(--progress-track);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}

.progress-stats-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00b4d8);
  background-size: 200% 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 10px;
  animation: shimmer 2s linear infinite;
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  overflow: hidden;
  animation: fadeInDown 0.5s ease both;
}

.top-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.surah-title-area {
  flex: 1;
  min-width: 180px;
}

.surah-title-area h2 {
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  transition: all 0.3s ease;
}

.surah-title-area p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  position: relative; /* ama absolute/fixed */
  z-index: 600;
}

.reciter-select,
.play-mode-select,
.speed-select,
.theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 40px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.reciter-select:hover,
.play-mode-select:hover,
.speed-select:hover,
.theme-toggle:hover {
  background: var(--hover-bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ===== AYAH CARDS ===== */
.ayah-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  scroll-behavior: smooth;
}

.ayah-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 24px;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  animation: fadeInUp 0.4s ease both;
  overflow: hidden;
}

.ayah-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.ayah-card:hover::before {
  transform: scaleX(1);
}

.ayah-card:hover {
  border-color: var(--accent);
  box-shadow:
    0 8px 32px rgba(6, 214, 160, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-3px);
}

.ayah-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.ayah-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 32px;
  transition: all 0.2s;
}

.ayah-card:hover .ayah-number {
  animation: numberPop 0.4s ease;
}

.ayah-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 28px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.small-btn:hover {
  background: var(--hover-bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px var(--accent-glow);
}

.small-btn:active {
  transform: scale(0.95);
}

.favorite-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 28px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: #ffc107;
}

.favorite-btn:hover {
  transform: scale(1.2) rotate(-5deg);
}

.favorite-btn.active {
  background: #ffc107;
  color: white;
  border-color: #ffc107;
  animation: bounceIn 0.4s ease;
}

.arabic-text {
  font-size: clamp(1.3rem, 5vw, 2rem);
  line-height: 1.6;
  text-align: right;
  font-family: "Scheherazade New", "Amiri", serif;
  font-weight: 500;
  color: var(--text-primary);
  margin: 16px 0 18px;
  direction: rtl;
  word-break: break-word;
  transition: color 0.3s ease;
}

.translation-en {
  font-size: 1.2rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 12px 0;
  line-height: 1.6;
  transition: all 0.2s;
}

.ayah-card:hover .translation-en {
  border-left-color: var(--accent);
  padding-left: 18px;
}

.tafsir-somali {
  font-size: 1.3rem;
  background: var(--accent-glow);
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--text-secondary);
  margin: 14px 0;
  line-height: 1.6;
  border-left: 3px solid var(--accent);
  transition: all 0.3s ease;
  word-break: break-word;
}

.ayah-card:hover .tafsir-somali {
  background: rgba(6, 214, 160, 0.12);
}

/* ===== VERSE PLAYING ===== */
.verse-playing {
  border-color: var(--accent) !important;
  animation:
    pulse-border 1.5s ease-in-out infinite,
    glowPulse 1.5s ease-in-out infinite;
  background: rgba(6, 214, 160, 0.04) !important;
}

/* ===== PLAYER ===== */
.player-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  animation: fadeInUp 0.5s ease both;
}

.player-card {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.time-progress-area {
  flex: 2;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.time-stamp {
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 32px;
  white-space: nowrap;
  transition: all 0.2s;
}

.progress-slider {
  flex: 1;
  height: 4px;
  background: var(--progress-track);
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s ease;
  min-width: 100px;
  overflow: hidden;
}

.progress-slider:hover {
  height: 8px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00b4d8);
  border-radius: 20px;
  transition: width 0.1s linear;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 4px var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.progress-slider:hover .progress-fill::after {
  opacity: 1;
}

/* ===== DARK MODE BUTTON ===== */
#globalThemeBtn,
#mobileThemeBtn {
  background: none;
  border: none;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#globalThemeBtn:hover {
  background: var(--hover-bg);
  transform: scale(1.15);
  color: var(--accent);
}

#globalThemeBtn i,
#mobileThemeBtn i {
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#dhageysi {
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  padding: 9px 11px;
  text-decoration: none;
  transition: all 0.25s ease;
}

#dhageysi:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.ctrl-btn {
  background: var(--bg-base);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.ctrl-btn:active {
  transform: scale(0.92);
}

.ctrl-btn.play-pause {
  background: var(--accent);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  font-size: 1.3rem;
  box-shadow: 0 4px 15px var(--accent-glow);
  animation: glowPulse 2s ease-in-out infinite;
}

.ctrl-btn.play-pause:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.ctrl-btn.play-pause:active {
  transform: scale(0.95);
}

.repeat-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  animation: glowPulse 1.5s ease-in-out infinite;
}

/* ===== PDF BUTTON ===== */
#pdfBtn {
  padding: 8px 25px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#pdfBtn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

#pdfBtn:active {
  transform: scale(0.96);
}

/* ===== TOAST ===== */
.toast-message {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 2000;
  animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px var(--accent-glow);
}

/* ===== LOADING ===== */
.loading,
.error-container {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  animation: fadeInUp 0.4s ease both;
}

.retry-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s;
}

.retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ===== RECITER PORTRAIT ===== */
.reciter-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-surface);
  border-radius: 60px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--border);
  color: #06d6a0;
  transition: all 0.25s ease;
}

.reciter-portrait:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
  transform: translateY(-1px);
}

.reciter-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--card-bg);
  transition: all 0.3s ease;
  animation: glowPulse 3s ease-in-out infinite;
}

.reciter-avatar:hover {
  transform: scale(1.1) rotate(5deg);
}

/* ===== MOBILE MENU ===== */
.menu-mobile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 40px;
  display: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.menu-mobile:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.close-sidebar-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  position: absolute;
  right: 12px;
  top: 12px;
  transition: all 0.2s;
  border-radius: 50%;
  z-index: 1101;
}

.close-sidebar-btn:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
  transform: rotate(90deg);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--progress-track);
  border-radius: 10px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ===== RESPONSIVE FIXES ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    height: 100%;
    width: 85%;
    max-width: 300px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 1100;
  }
  .sidebar.open {
    transform: translateX(0);
    animation: fadeInLeft 0.3s ease both;
  }
  .menu-mobile {
    display: inline-flex;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1150;
  }
  .close-sidebar-btn {
    display: block;
  }
  .ayah-container {
    padding: 14px 16px;
  }
  .top-bar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .controls-row {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }
  /* Fix for select elements on mobile */
  .reciter-select,
  .play-mode-select,
  .speed-select,
  .theme-toggle {
    font-size: 0.7rem;
    padding: 6px 12px;
    flex: 1 0 auto;
  }
  /* Fixed overlapping theme button and menu */
  #globalThemeBtn {
    position: fixed;
    top: 12px;
    right: 60px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
  }
  /* Remove problematic margin-left for speed select */
  .speed-select {
    margin-left: 0;
    width: auto;
  }
  .player-card {
    flex-direction: column;
    align-items: stretch;
  }
  .time-progress-area {
    width: 100%;
  }
  .action-buttons {
    justify-content: center;
  }
  .ayah-header {
    flex-direction: column;
    align-items: flex-start;
  }
  /* Fix reciter portrait on mobile */
  .reciter-portrait {
    padding: 2px 10px 2px 4px;
  }
  .reciter-avatar {
    width: 32px;
    height: 32px;
  }
  .reciter-name {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .surah-title-area h2 {
    font-size: 1.4rem;
  }
  .controls-row {
    gap: 8px;
  }
  .ctrl-btn {
    width: 38px;
    height: 38px;
  }
  .ctrl-btn.play-pause {
    width: 44px;
    height: 44px;
  }
  .arabic-text {
    font-size: 1.3rem;
  }
  .ayah-card {
    padding: 16px 18px;
  }
  /* Adjust fixed theme button for very small screens */
  #globalThemeBtn {
    right: 70px;
    top: 12px;
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  .menu-mobile {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* Prevent animation glitches on mobile when sidebar is hidden */
@media (max-width: 768px) {
  .sidebar {
    animation: none;
  }
  .sidebar.open {
    animation: fadeInLeft 0.3s ease both;
  }
}

/* Fix for tafsir text overflow on any device */
.tafsir-somali {
  word-break: break-word;
  white-space: normal;
}

/* Ensure smooth theme transition for all interactive elements */
* {
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

/* ===== VOLUME CONTROLLER ===== */
.volume-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}
.volume-slider {
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  background: var(--progress-track);
  border-radius: 20px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px var(--accent);
}

/* ===== NOTE BOX (inline below ayah) ===== */
.note-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px;
  margin-top: 12px;
  display: none;
}
.note-box textarea {
  width: 100%;
  padding: 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}
.note-save-btn {
  background: var(--accent);
  border: none;
  padding: 6px 16px;
  border-radius: 32px;
  color: white;
  cursor: pointer;
  font-size: 0.75rem;
}
.note-indicator {
  font-size: 0.7rem;
  margin-left: 5px;
  color: var(--accent);
  cursor: pointer;
}
.note-btn.active-note {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ===== SABAB NUZUL ===== */
.sabab-content {
  background: var(--accent-glow);
  padding: 12px;
  border-radius: 16px;
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
  display: none;
}
.sabab-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ===== RECENT SURAHS (SIDEBAR) ===== */
.recent-surahs-section {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.recent-surahs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  transition: background 0.2s;
}
.recent-surahs-header:hover {
  background: var(--hover-bg);
}
.recent-surahs-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
}
.recent-surahs-list.open {
  max-height: 300px;
  overflow-y: auto;
}
.recent-surah-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  transition: 0.2s;
}
.recent-surah-item:hover {
  background: var(--accent-glow);
  padding-left: 20px;
}
.recent-surah-num {
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}
.recent-surah-name {
  flex: 1;
  color: var(--text-primary);
}

/* ===== RECITER DROPDOWN ===== */
.reciter-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px;
  width: 220px;
  z-index: 1200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  gap: 8px;
}
.reciter-dropdown.show {
  display: flex;
}
.reciter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.2s;
}
.reciter-option:hover {
  background: var(--accent-glow);
}
.reciter-option img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.reciter-option span {
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* ===== SPEED SELECT IN PLAYER BAR ===== */
.speed-select.player-speed {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 40px;
  font-size: 0.7rem;
  color: var(--text-primary);
  cursor: pointer;
  margin-left: 8px;
}

/* .reciter-option.selected::after {
  content: "✓";
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
} */

.recent-surah-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.recent-surah-item:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.recent-surah-info {
  flex: 1;
  min-width: 0;
}

.recent-delete-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s;
}

.recent-surah-item:hover .recent-delete-btn {
  opacity: 1;
}

.recent-delete-btn:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

/* ===== JADWALKA AQRINTA ===== */
.schedule-section {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.schedule-header:hover {
  background: var(--hover-bg);
}

.schedule-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
}

.schedule-list.open {
  max-height: 400px;
  overflow-y: auto;
}

.schedule-form {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.schedule-form.open {
  display: flex;
}

.schedule-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: "Tajawal", "Inter", sans-serif;
}

.schedule-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="time"].schedule-select {
  cursor: pointer;
  color-scheme: light;
}

body.dark input[type="time"].schedule-select {
  color-scheme: dark;
}

#scheduleAddBtn {
  background: var(--accent);
  border: none;
  border-radius: 32px;
  padding: 9px 16px;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-family: "Tajawal", "Inter", sans-serif;
}

#scheduleAddBtn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

#scheduleAddBtn:active {
  transform: scale(0.97);
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-primary);
  transition: background 0.15s;
  animation: fadeInUp 0.3s ease both;
}

.schedule-item:hover {
  background: var(--hover-bg);
}

.schedule-item:last-child {
  border-bottom: none;
}

.schedule-icon {
  background: var(--accent-glow);
  color: var(--accent);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.schedule-info {
  flex: 1;
  min-width: 0;
}

.schedule-surah-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-time-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.schedule-day {
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.schedule-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.schedule-delete-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s;
}

.schedule-item:hover .schedule-delete-btn {
  opacity: 1;
}

.schedule-delete-btn:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.schedule-notification-badge {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.schedule-notification-badge.off {
  background: var(--progress-track);
}

@media (max-width: 768px) {
  .schedule-header {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .schedule-item {
    padding: 9px 12px;
  }

  .schedule-form {
    padding: 10px;
  }

  .schedule-select {
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  .schedule-delete-btn {
    opacity: 1;
  }
}

.schedule-close-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  width: 100%;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  justify-content: center;
  transition: background 0.15s;
}

.schedule-close-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}



.delete-progress-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.delete-progress-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.delete-progress-btn svg {
  stroke: currentColor;
}

/* Confirmation popup styles */
.confirm-reset-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  min-width: 200px;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.confirm-reset-popup p {
  margin: 0 0 10px 0;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.confirm-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.confirm-yes, .confirm-no {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
}

.confirm-yes {
  background: #ef4444;
  color: white;
}

.confirm-yes:hover {
  background: #dc2626;
}

.confirm-no {
  background: var(--border);
  color: var(--text-primary);
}

.confirm-no:hover {
  background: var(--hover-bg);
}