/**
 * Quran.com-Style Reader CSS
 * Modern, clean Quran reading experience
 */

/* ============================================
   QURAN READER LAYOUT
   ============================================ */

.quran-reader {
  display: flex;
  min-height: calc(100vh - 70px);
  background: var(--bg-primary, #f8f9fa);
  position: relative;
}

/* ============================================
   LEFT SIDEBAR - SURAH NAVIGATION
   ============================================ */

.quran-sidebar {
  width: 280px;
  background: var(--bg-secondary, #ffffff);
  border-right: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow: hidden;
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 100;
}

.quran-sidebar.collapsed {
  transform: translateX(-100%);
  width: 0;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Sidebar Search */
.sidebar-search {
  padding: 1rem;
  position: relative;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.sidebar-search i {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary, #9ca3af);
}

.sidebar-search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-primary, #f8f9fa);
  color: var(--text-primary, #1f2937);
  transition: all 0.2s ease;
}

.sidebar-search input:focus {
  outline: none;
  border-color: var(--primary, #059669);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.tab-btn {
  flex: 1;
  padding: 0.875rem;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--primary, #059669);
  background: var(--bg-primary, #f8f9fa);
}

.tab-btn.active {
  color: var(--primary, #059669);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary, #059669);
}

/* Surah List Container */
.surah-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.surah-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Surah Item */
.surah-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.surah-item:hover {
  background: var(--bg-primary, #f8f9fa);
}

.surah-item.active {
  background: var(--primary, #059669);
  color: white;
}

.surah-item.active .surah-number {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.surah-item.active .surah-meta {
  color: rgba(255, 255, 255, 0.8);
}

.surah-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary, #e5e7eb);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.surah-info {
  flex: 1;
  min-width: 0;
}

.surah-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  display: flex;
  gap: 0.5rem;
}

.surah-arabic-name {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-secondary, #6b7280);
}

.surah-item.active .surah-arabic-name {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.quran-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 80px; /* Space for floating audio player */
}

/* Top Action Bar */
.reader-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary, #ffffff);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  position: sticky;
  top: 70px;
  z-index: 50;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--bg-tertiary, #e5e7eb);
}

.surah-nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--primary, #059669);
  color: white;
  border-color: var(--primary, #059669);
}

.current-surah-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
}

.surah-title {
  font-weight: 600;
  font-size: 1rem;
}

.surah-details {
  font-size: 0.8rem;
  color: var(--text-tertiary, #9ca3af);
}

.reader-settings {
  display: flex;
  gap: 0.5rem;
}

.settings-btn,
.bookmarks-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:hover,
.bookmarks-btn:hover {
  background: var(--primary, #059669);
  color: white;
  border-color: var(--primary, #059669);
}

/* Settings Panel */
.reader-settings-panel {
  display: none;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary, #ffffff);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.reader-settings-panel.show {
  display: flex;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-group select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg-primary, #f8f9fa);
  color: var(--text-primary, #1f2937);
  min-width: 180px;
  cursor: pointer;
}

.settings-group select:focus {
  outline: none;
  border-color: var(--primary, #059669);
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.font-size-control button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.font-size-control button:hover {
  background: var(--primary, #059669);
  color: white;
}

.font-size-control span {
  min-width: 45px;
  text-align: center;
  font-weight: 500;
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-label input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary, #e5e7eb);
  border-radius: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-label input:checked + .toggle-slider {
  background: var(--primary, #059669);
}

.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* ============================================
   SURAH HEADER
   ============================================ */

.surah-header-container {
  padding: 2rem 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-secondary, #ffffff) 0%, var(--bg-primary, #f8f9fa) 100%);
}

.surah-header-content {
  max-width: 800px;
  margin: 0 auto;
}

.surah-title-main {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary, #1f2937);
}

.surah-title-arabic {
  font-family: 'Amiri', serif;
  font-size: 2.5rem;
  color: var(--primary, #059669);
  margin-bottom: 0.5rem;
}

.surah-subtitle {
  font-size: 1rem;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 1rem;
}

.surah-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary, #e5e7eb);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary, #6b7280);
}

.surah-badge i {
  color: var(--primary, #059669);
}

/* Bismillah */
.bismillah {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  text-align: center;
  padding: 1.5rem;
  color: var(--primary, #059669);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  margin-bottom: 1rem;
}

/* ============================================
   VERSES CONTAINER
   ============================================ */

.verses-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  width: 100%;
}

/* Verse Item - Quran.com Style */
.verse-item {
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.verse-item:hover {
  background: var(--bg-secondary, #ffffff);
  border-color: var(--border-color, #e5e7eb);
}

.verse-item.playing {
  background: rgba(5, 150, 105, 0.05);
  border-color: var(--primary, #059669);
}

/* Verse Header */
.verse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.verse-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary, #e5e7eb);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
}

.verse-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.verse-item:hover .verse-actions {
  opacity: 1;
}

.verse-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary, #6b7280);
}

.verse-action-btn:hover {
  background: var(--primary, #059669);
  color: white;
  border-color: var(--primary, #059669);
}

.verse-action-btn.bookmarked {
  background: var(--primary, #059669);
  color: white;
  border-color: var(--primary, #059669);
}

/* Arabic Text */
.verse-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 28px;
  line-height: 2.2;
  text-align: right;
  direction: rtl;
  margin-bottom: 1rem;
  color: var(--text-primary, #1f2937);
}

/* Translation */
.verse-translation {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary, #6b7280);
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.verse-translation.hidden {
  display: none;
}

/* Word by Word Tooltip */
.word-tooltip {
  position: absolute;
  background: var(--bg-secondary, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  max-width: 200px;
}

/* ============================================
   FLOATING AUDIO PLAYER
   ============================================ */

.floating-audio-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary, #ffffff);
  border-top: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.floating-audio-player.show {
  transform: translateY(0);
}

.audio-player-content {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Audio Surah Info */
.audio-surah-info {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.audio-surah-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.audio-verse-info {
  font-size: 0.8rem;
  color: var(--text-tertiary, #9ca3af);
}

/* Main Audio Controls */
.audio-controls-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #f8f9fa);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary, #1f2937);
}

.audio-btn:hover {
  background: var(--bg-tertiary, #e5e7eb);
}

.audio-btn.play-pause {
  width: 48px;
  height: 48px;
  background: var(--primary, #059669);
  color: white;
  border: none;
}

.audio-btn.play-pause:hover {
  background: var(--primary-dark, #047857);
}

.audio-btn.small {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

/* Progress Section */
.audio-progress-section {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.time-current,
.time-total {
  font-size: 0.8rem;
  color: var(--text-tertiary, #9ca3af);
  min-width: 40px;
}

.progress-bar-container {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary, #e5e7eb);
  border-radius: 2px;
  position: relative;
}

.audio-progress-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  position: absolute;
  top: 0;
  left: 0;
}

.audio-progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--primary, #059669);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.audio-progress-slider:hover::-webkit-slider-thumb {
  opacity: 1;
}

.progress-bar-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary, #059669);
  border-radius: 2px;
  width: var(--progress, 0%);
}

/* Extra Controls */
.audio-extra-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-control {
  position: relative;
  display: flex;
  align-items: center;
}

.volume-slider {
  width: 0;
  opacity: 0;
  transition: all 0.2s ease;
  margin-left: 0;
}

.volume-control:hover .volume-slider {
  width: 80px;
  opacity: 1;
  margin-left: 0.5rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
  .quran-sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    height: calc(100vh - 70px);
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  }
  
  .quran-sidebar.collapsed {
    transform: translateX(-100%);
  }
  
  .reader-settings-panel {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .reader-top-bar {
    padding: 0.75rem 1rem;
  }
  
  .current-surah-info {
    min-width: auto;
  }
  
  .surah-details {
    display: none;
  }
  
  .reader-settings-panel {
    padding: 1rem;
    gap: 1rem;
  }
  
  .settings-group select {
    min-width: 140px;
  }
  
  .audio-player-content {
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
  }
  
  .audio-surah-info {
    min-width: auto;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .audio-progress-section {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }
  
  .verse-arabic {
    font-size: 24px;
  }
  
  .surah-header-container {
    padding: 1.5rem 1rem;
  }
  
  .surah-title-main {
    font-size: 1.5rem;
  }
  
  .surah-title-arabic {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .quran-sidebar {
    width: 100%;
  }
  
  .verse-item {
    padding: 1rem;
  }
  
  .verse-arabic {
    font-size: 22px;
  }
  
  .verse-translation {
    font-size: 14px;
  }
  
  .audio-extra-controls {
    display: none;
  }
  
  .settings-btn {
    display: none;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

[data-theme="dark"] .quran-reader {
  background: var(--bg-primary, #111827);
}

[data-theme="dark"] .quran-sidebar {
  background: var(--bg-secondary, #1f2937);
  border-color: var(--border-color, #374151);
}

[data-theme="dark"] .sidebar-search input {
  background: var(--bg-primary, #111827);
  border-color: var(--border-color, #374151);
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .surah-item:hover {
  background: var(--bg-primary, #111827);
}

[data-theme="dark"] .surah-number {
  background: var(--bg-tertiary, #374151);
}

[data-theme="dark"] .reader-top-bar,
[data-theme="dark"] .reader-settings-panel {
  background: var(--bg-secondary, #1f2937);
  border-color: var(--border-color, #374151);
}

[data-theme="dark"] .sidebar-toggle,
[data-theme="dark"] .settings-btn,
[data-theme="dark"] .bookmarks-btn,
[data-theme="dark"] .nav-btn {
  background: var(--bg-primary, #111827);
  border-color: var(--border-color, #374151);
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .verse-item:hover {
  background: var(--bg-secondary, #1f2937);
  border-color: var(--border-color, #374151);
}

[data-theme="dark"] .floating-audio-player {
  background: var(--bg-secondary, #1f2937);
  border-color: var(--border-color, #374151);
}

[data-theme="dark"] .audio-btn {
  background: var(--bg-primary, #111827);
  border-color: var(--border-color, #374151);
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .progress-bar-container {
  background: var(--bg-tertiary, #374151);
}

[data-theme="dark"] .surah-header-container {
  background: linear-gradient(180deg, var(--bg-secondary, #1f2937) 0%, var(--bg-primary, #111827) 100%);
}

[data-theme="dark"] .surah-badge {
  background: var(--bg-tertiary, #374151);
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-tertiary, #9ca3af);
}

.loading-spinner i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary, #059669);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.surah-list-container::-webkit-scrollbar {
  width: 6px;
}

.surah-list-container::-webkit-scrollbar-track {
  background: transparent;
}

.surah-list-container::-webkit-scrollbar-thumb {
  background: var(--border-color, #e5e7eb);
  border-radius: 3px;
}

.surah-list-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary, #9ca3af);
}
