/* Design Tokens and CSS Variables */
:root {
  /* Colors */
  --bg-dark: #051a15;
  --bg-deep: #06231c;
  --bg-card: rgba(10, 38, 30, 0.5);
  --bg-hover: rgba(197, 160, 89, 0.08);
  --bg-active: rgba(197, 160, 89, 0.15);
  --bg-accent: #0c3c31;
  
  --gold-color: #c5a059;
  --gold-light: #f5e4c3;
  --gold-glow: rgba(197, 160, 89, 0.4);
  
  --text-white: #f5f7f6;
  --text-muted: #9bb0a6;
  --text-dark: #051c16;
  --accent-red: #d9534f;
  
  /* Fonts */
  --font-arabic: 'Amiri', serif;
  --font-latin: 'Inter', sans-serif;
  
  /* Borders & Shadows */
  --border-glass: 1px solid rgba(197, 160, 89, 0.15);
  --border-glass-light: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 15px rgba(197, 160, 89, 0.2);
  
  /* Scaling (Default Values, updated by JS) */
  --arabic-font-size: 28px;
  --trans-font-size: 16px;
  --header-height: 72px;
  --player-height: 80px;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-latin);
  background-color: var(--bg-dark);
  color: var(--text-white);
  height: 100vh;
  overflow: hidden;
  direction: rtl; /* RTL by default for Arabic */
}

/* Premium Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-accent);
  border-radius: 4px;
  border: 2px solid var(--bg-dark);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-color);
}

/* App Container Layout */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(12, 60, 49, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(197, 160, 89, 0.05) 0%, transparent 40%);
}

/* Glassmorphism Common Class */
.glass-effect {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: var(--border-glass);
  box-shadow: var(--shadow-premium);
}

/* Top Header Styles */
#main-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  border-top: none;
  border-left: none;
  border-right: none;
}

.header-right, .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#sidebar-toggle {
  display: none; /* Hidden on desktop */
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 36px;
  width: 36px;
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

#app-title {
  font-family: var(--font-arabic);
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Buttons Styling */
.icon-btn {
  background: transparent;
  border: var(--border-glass-light);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  border-color: var(--gold-color);
  background: var(--bg-hover);
  color: var(--gold-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.15);
}

.icon-btn:active {
  transform: translateY(0);
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: var(--border-glass-light);
  background: rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.online .status-dot {
  background-color: #4cd964;
  box-shadow: 0 0 8px #4cd964;
}

.status-badge.offline .status-dot {
  background-color: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

/* Action Button Styles */
.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-latin);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.outline-btn {
  background: transparent;
  border: var(--border-glass);
  color: var(--gold-color);
}

.outline-btn:hover {
  background: var(--gold-color);
  color: var(--bg-dark);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.gold-btn {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-color));
  border: none;
  color: var(--bg-dark);
  box-shadow: var(--shadow-glow);
}

.gold-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(197, 160, 89, 0.4);
}

.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Workspace Layout */
#app-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height) - var(--player-height));
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Layout */
#sidebar {
  width: 380px;
  border-top: none;
  border-bottom: none;
  border-right: none;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-tabs {
  display: flex;
  border-bottom: var(--border-glass-light);
}

.tab-btn {
  flex: 1;
  padding: 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: var(--text-white);
}

.tab-btn.active {
  color: var(--gold-color);
  border-bottom-color: var(--gold-color);
  background: rgba(197, 160, 89, 0.03);
}

.tab-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
}

/* Sidebar Search Box */
.search-box {
  padding: 16px;
  position: relative;
}

#surah-search {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border-radius: 24px;
  border: var(--border-glass);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-white);
  font-size: 14px;
  font-family: var(--font-latin);
  outline: none;
  transition: all 0.3s ease;
}

#surah-search:focus {
  border-color: var(--gold-color);
  box-shadow: var(--shadow-glow);
  background: rgba(0, 0, 0, 0.3);
}

.search-icon {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
  pointer-events: none;
  transition: fill 0.3s ease;
}

#surah-search:focus + .search-icon {
  fill: var(--gold-color);
}

/* Lists and Scrollers */
.scrollable-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px 16px;
}

/* Surah Row styling */
.surah-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: all 0.25s ease;
}

.surah-card:hover {
  border-color: rgba(197, 160, 89, 0.3);
  background: var(--bg-hover);
  transform: scale(1.02);
}

.surah-card.active {
  background: var(--bg-active);
  border-color: var(--gold-color);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.1);
}

.surah-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Surah Number Islamic Star Decoration */
.surah-num-badge {
  width: 36px;
  height: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23c5a059' opacity='0.7'%3E%3Cpath d='M12 2l2.4 4.9L19.7 7.7l-3.9 3.8.9 5.4-4.7-2.5-4.7 2.5.9-5.4-3.9-3.8 5.3-.8L12 2zm0 4.4L10.7 9.1l-2.9.4 2.1 2-.5 2.9 2.6-1.4 2.6 1.4-.5-2.9 2.1-2-2.9-.4L12 6.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-light);
}

.surah-card.active .surah-num-badge {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffe699'%3E%3Cpath d='M12 2l2.4 4.9L19.7 7.7l-3.9 3.8.9 5.4-4.7-2.5-4.7 2.5.9-5.4-3.9-3.8 5.3-.8L12 2z'/%3E%3C/svg%3E");
  color: var(--bg-dark);
}

.surah-title-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.surah-name-ar {
  font-family: var(--font-arabic);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
}

.surah-name-en {
  font-size: 12px;
  color: var(--text-muted);
}

.surah-left {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.surah-type-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.surah-card.active .surah-type-tag {
  background: rgba(197, 160, 89, 0.2);
  color: var(--gold-light);
  border-color: rgba(197, 160, 89, 0.3);
}

.surah-ayah-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* Offline Downloaded Check Indicator */
.offline-cached-indicator {
  width: 14px;
  height: 14px;
  fill: var(--gold-color);
  opacity: 0.8;
  display: none; /* dynamically visible via JS */
}

/* Bookmarks styling */
.bookmark-card {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: var(--border-glass-light);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.bookmark-card:hover {
  border-color: var(--gold-color);
  background: var(--bg-hover);
}

.bookmark-header-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bookmark-meta {
  font-weight: 600;
  font-size: 12px;
  color: var(--gold-color);
}

.bookmark-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.bookmark-remove-btn:hover {
  color: var(--accent-red);
}

.bookmark-snippet {
  font-family: var(--font-arabic);
  font-size: 16px;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}

/* Main Reader Styling */
#reader-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* Header Card for Surah Info */
#surah-details-card {
  padding: 24px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.card-hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  display: none !important;
}

.surah-meta-details h2 {
  font-family: var(--font-arabic);
  font-size: 36px;
  color: var(--gold-color);
  margin-bottom: 4px;
}

.surah-submeta {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
}

.meta-dot {
  font-size: 10px;
  color: var(--gold-color);
}

/* Basmala Display */
#basmala-container {
  font-family: var(--font-arabic);
  font-size: 32px;
  text-align: center;
  margin: 16px 0 32px 0;
  color: var(--text-white);
  text-shadow: 0 0 10px rgba(197, 160, 89, 0.15);
  transition: all 0.3s ease;
}

.basmala-hidden {
  display: none !important;
}

/* Empty State / Welcome Screen */
#reader-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
  color: var(--text-muted);
}

#reader-empty-state h3 {
  color: var(--gold-color);
  font-size: 20px;
}

.empty-vector {
  animation: floatEffect 4s ease-in-out infinite;
}

@keyframes floatEffect {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Verses List / Reader Core */
#verses-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 40px;
}

/* Ayah Card row */
.ayah-row {
  padding: 24px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.ayah-row:hover {
  border-color: rgba(197, 160, 89, 0.2);
  background: rgba(10, 38, 30, 0.25);
}

/* Highlighting Active Playback Ayah */
.ayah-row.active-playing {
  border-color: var(--gold-color);
  background: rgba(197, 160, 89, 0.1);
  box-shadow: 0 4px 20px rgba(197, 160, 89, 0.1);
}

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

.ayah-badge-star {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ayah-index-badge {
  width: 32px;
  height: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23c5a059' opacity='0.8'%3E%3Cpath d='M12 2l2.4 4.9L19.7 7.7l-3.9 3.8.9 5.4-4.7-2.5-4.7 2.5.9-5.4-3.9-3.8 5.3-.8L12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg-dark);
}

.ayah-reference {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.last-read-indicator {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(197, 160, 89, 0.15);
  color: var(--gold-color);
  border: 1px solid rgba(197, 160, 89, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  vertical-align: middle;
  margin-right: 8px;
}

.action-stop-point-btn.active {
  color: var(--gold-color) !important;
  border-color: var(--gold-color) !important;
  background: var(--bg-hover) !important;
}

.ayah-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ayah-row:hover .ayah-actions,
.ayah-row.active-playing .ayah-actions {
  opacity: 1;
}

/* Arabic Text */
.ayah-arabic {
  font-family: var(--font-arabic);
  font-size: var(--arabic-font-size);
  line-height: 2;
  color: var(--text-white);
  text-align: right;
  word-spacing: 2px;
}

/* Translation Text */
.ayah-translation {
  font-size: var(--trans-font-size);
  line-height: 1.6;
  color: var(--text-muted);
  text-align: right;
  direction: ltr; /* English translation is LTR */
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.ayah-translation.rtl-lang {
  direction: rtl; /* For Arabic tafsir or translations in Urdu/Farsi */
  text-align: right;
}

/* Settings Drawer (Right Side on Screen) */
.settings-drawer {
  position: fixed;
  top: 0;
  left: 0; /* Align settings drawer to the left */
  height: 100vh;
  width: 360px;
  z-index: 150;
  transform: translateX(-100%); /* slide-out to left */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: var(--border-glass);
}

.settings-drawer.drawer-open {
  transform: translateX(0); /* slide-in */
}

.drawer-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--border-glass-light);
}

.drawer-header h3 {
  font-size: 16px;
  color: var(--gold-color);
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.settings-group select {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: var(--border-glass);
  color: var(--text-white);
  outline: none;
  font-size: 14px;
  font-family: var(--font-latin);
  cursor: pointer;
}

.settings-group select option {
  background: var(--bg-dark);
  color: var(--text-white);
}

.setting-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

/* Sliders */
.settings-group input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-accent);
  outline: none;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-color);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.settings-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: relative;
  width: 44px;
  height: 22px;
  background-color: var(--bg-accent);
  border-radius: 34px;
  transition: .4s;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 4px;
  bottom: 3px;
  background-color: var(--text-white);
  border-radius: 50%;
  transition: .4s;
}

.toggle-switch input:checked + .slider {
  background-color: var(--gold-color);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--bg-dark);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-white) !important;
}

/* Backdrop */
#drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 140;
  transition: opacity 0.3s ease;
}

.backdrop-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Sticky Bottom Audio Player Styling */
#audio-player-bar {
  height: var(--player-height);
  width: 100vw;
  border-bottom: none;
  border-left: none;
  border-right: none;
  z-index: 100;
  padding: 0 32px;
  display: flex;
  align-items: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-hidden {
  transform: translateY(100%);
  pointer-events: none;
}

.player-grid {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1.2fr;
  align-items: center;
  width: 100%;
  height: 100%;
}

/* Right Section: Details */
.player-track-details {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  direction: ltr; /* English aligned details in footer */
}

.track-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-accent);
  border: var(--border-glass-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-color);
}

.avatar-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.track-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

#player-track-surah {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-track-info {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center Section: Core Playback */
.player-main-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.buttons-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
  border-radius: 50%;
}

.player-icon-btn:hover {
  color: var(--gold-color);
  background: rgba(255, 255, 255, 0.05);
}

.player-icon-btn:active {
  transform: scale(0.9);
}

.player-icon-btn .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Badge for repeat single ayah */
.player-icon-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--gold-color);
  color: var(--bg-dark);
  font-size: 8px;
  font-weight: 800;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.repeat-badge-hidden {
  display: none !important;
}

.player-icon-btn.btn-active {
  color: var(--gold-color);
  text-shadow: var(--shadow-glow);
}

/* Circular Play Button */
.player-action-btn {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-color));
  border: none;
  color: var(--bg-dark);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

.player-action-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 18px rgba(197, 160, 89, 0.4);
}

.player-action-btn:active {
  transform: scale(0.95);
}

.action-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-hidden {
  display: none !important;
}

/* Progress Bar slider */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  font-size: 11px;
  color: var(--text-muted);
}

.timeline-slider {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.timeline-fill {
  height: 100%;
  background: var(--gold-color);
  border-radius: 2px;
  width: 0; /* updated by JS */
}

.timeline-handle {
  position: absolute;
  top: 50%;
  left: 0; /* updated by JS */
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.timeline-slider:hover .timeline-handle {
  opacity: 1;
}

/* Left Section: Extra settings */
.player-settings {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  direction: ltr; /* Align controls LTR */
}

.text-badge-btn {
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glass-light);
  border-radius: 12px;
  padding: 4px 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.text-badge-btn:hover {
  border-color: var(--gold-color);
  color: var(--gold-color);
}

.speed-control-container {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  border: var(--border-glass);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-premium);
  z-index: 110;
  min-width: 70px;
}

.dropdown-menu button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 100%;
}

.dropdown-menu button:hover,
.dropdown-menu button.active {
  background: var(--bg-accent);
  color: var(--gold-color);
}

.dropdown-hidden {
  display: none !important;
}

/* Volume Slider */
.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

#volume-slider {
  -webkit-appearance: none;
  width: 70px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  border-radius: 2px;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-color);
  cursor: pointer;
}

/* Toast alert notification styling */
#toast-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.toast-hidden {
  opacity: 0;
  pointer-events: none;
}

.toast-content {
  background: rgba(5, 26, 21, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--gold-color);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  padding: 24px 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 320px;
}

.toast-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(197, 160, 89, 0.2);
  border-left-color: var(--gold-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.toast-text-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#toast-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--gold-color);
}

#toast-message {
  font-size: 12px;
  color: var(--text-muted);
}

/* Loading indicators inside dynamic panes */
.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}

.loading-placeholder:before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(197, 160, 89, 0.2);
  border-left-color: var(--gold-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Responsive CSS breakpoints */
@media (max-width: 900px) {
  /* Toggle Sidebar and overlay */
  #sidebar-toggle {
    display: flex;
  }
  
  #sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    height: calc(100vh - var(--header-height) - var(--player-height));
    transform: translateX(100%); /* Hidden by default offscreen right */
    border-left: var(--border-glass);
    background: var(--bg-deep);
  }
  
  #sidebar.sidebar-open {
    transform: translateX(0); /* Opened */
  }

  /* Shift workspace grid content */
  #app-workspace {
    flex-direction: column;
  }
  
  #reader-container {
    padding: 16px;
  }

  /* Bottom Player adjusts column layout */
  .player-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 10px 0;
    gap: 8px;
  }
  
  #audio-player-bar {
    height: 100px;
    padding: 0 16px;
  }
  
  #app-workspace {
    height: calc(100vh - var(--header-height) - 100px);
  }
  
  .player-settings {
    display: none; /* hide speed/volume on small mobile bars to keep UI clean */
  }
  
  .player-track-details {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  #app-title {
    font-size: 18px;
  }
  
  .header-left {
    gap: 6px;
  }
  
  #download-quran-btn .btn-label {
    display: none; /* icon only on small screens */
  }
  
  #download-quran-btn {
    padding: 8px;
    border-radius: 50%;
  }
  
  .surah-meta-details h2 {
    font-size: 28px;
  }
  
  #basmala-container {
    font-size: 24px;
  }
  
  .ayah-arabic {
    font-size: calc(var(--arabic-font-size) - 4px);
  }
}
