/* ===== Font Face Declarations ===== */
@font-face {
  font-family: 'Vazirmatn';
  font-display: swap;
}

@font-face {
  font-family: 'Amiri';
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans Arabic';
  font-display: swap;
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

#app-content {
  width: 100%;
  min-width: 0;
}

#footer {
  background: #022c22;
}

img,
video,
canvas {
  max-width: 100%;
}

/* ===== Hero Section ===== */
.hero-section {
  background: #064e3b;
}

/* ===== Tafsir Reviews (Simple Library) ===== */
.tafsir-library {
  background: #ffffff;
}

.tafsir-hero {
  background: #064e3b;
  border-bottom: 1px solid rgba(212, 169, 86, 0.25);
}

.tafsir-hero-inner {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 169, 86, 0.2);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 50px rgba(2, 32, 24, 0.35);
}

.tafsir-hero-title {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: #fef3c7;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.tafsir-hero-subtitle {
  color: #e5e7eb;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
  font-size: 1rem;
}

.tafsir-grid-simple {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.6rem;
  margin-top: 5rem;
}

@media (min-width: 1024px) {
  .tafsir-grid-simple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tafsir-card {
  background: #ffffff;
  border: 1px solid rgba(6, 78, 59, 0.12);
  border-radius: 18px;
  padding: 1rem;
  text-align: right;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 30px rgba(6, 78, 59, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: tafsir-rise 0.45s ease both;
  animation-delay: var(--delay, 0ms);
}

.tafsir-card:hover {
  transform: translateY(-6px);
  border-color: rgba(212, 169, 86, 0.5);
  box-shadow: 0 16px 40px rgba(6, 78, 59, 0.18);
}

.tafsir-card.tafsir-card-highlight {
  border-color: rgba(212, 169, 86, 0.85);
  box-shadow: 0 0 0 3px rgba(212, 169, 86, 0.2), 0 18px 40px rgba(6, 78, 59, 0.22);
  transform: translateY(-4px);
}

.search-highlight-text {
  background: rgba(212, 169, 86, 0.35);
  border-radius: 6px;
  padding: 0 0.2em;
}

.tafsir-card:focus-visible {
  outline: 2px solid rgba(212, 169, 86, 0.7);
  outline-offset: 2px;
}

.tafsir-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 14px;
  background-color: transparent;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  box-shadow: none;
}

.tafsir-card[data-book-id="Nukat"] .tafsir-cover {
  aspect-ratio: 4 / 3;
  height: 240px;
}

.tafsir-card[data-book-id="Samarkandi"] .tafsir-cover {
  aspect-ratio: 4 / 3;
  height: 240px;
}

.tafsir-card[data-book-id="tafsir-007"] .tafsir-cover {
  aspect-ratio: 16 / 9;
  height: 320px;
}

.tafsir-card[data-book-id="tafsir-008"] .tafsir-cover {
  aspect-ratio: 16 / 9;
  height: 260px;
}

.tafsir-card[data-book-id="tafsir-009"] .tafsir-cover {
  aspect-ratio: 16 / 9;
  height: 260px;
  min-height: 260px;
}

.tafsir-card[data-book-id="tafsir-010"] .tafsir-cover {
  aspect-ratio: 16 / 9;
  height: 290px;
  min-height: 290px;
}

.tafsir-card[data-book-id="Tabari"] .tafsir-cover,
.tafsir-card[data-book-id="Razi"] .tafsir-cover,
.tafsir-card[data-book-id="Jasas"] .tafsir-cover,
.tafsir-card[data-book-id="Maturidi"] .tafsir-cover {
  height: 260px;
}

.tafsir-cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 0;
}


.tafsir-cover::after {
  content: none;
}

.tafsir-cover-shine {
  display: none;
}

.tafsir-cover-mark {
  display: none;
}

.tafsir-meta {
  margin-top: auto;
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 4.5rem;
}

.tafsir-book-title {
  font-family: 'Amiri', serif;
  font-size: 1.4rem;
  color: #064e3b;
  font-weight: 700;
  line-height: 1.6;
}

.tafsir-book-author {
  font-size: 1rem;
  color: #047857;
}

.tafsir-modal {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1200;
}

.tafsir-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tafsir-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(1, 20, 16, 0.7);
  backdrop-filter: blur(6px);
}

.tafsir-modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  padding: 0;
  width: min(720px, 94vw);
  margin: 8vh auto 0;
  box-shadow: 0 24px 60px rgba(2, 32, 24, 0.4);
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-height: calc(100vh - 16vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tafsir-modal-body {
  padding: 3.25rem 2.5rem 2.75rem;
  overflow-y: auto;
  direction: ltr;
  scrollbar-width: thin;
  scrollbar-color: #d4a956 rgba(6, 78, 59, 0.12);
}

.tafsir-modal-body::-webkit-scrollbar {
  width: 10px;
}

.tafsir-modal-body::-webkit-scrollbar-track {
  background: rgba(6, 78, 59, 0.08);
  border-radius: 999px;
}

.tafsir-modal-body::-webkit-scrollbar-thumb {
  background: #d4a956;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.tafsir-modal-content {
  direction: rtl;
  text-align: right;
}

.tafsir-modal.open .tafsir-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.tafsir-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #064e3b;
  color: #fef3c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}

.tafsir-modal-close:hover {
  background: #047857;
}

.tafsir-modal-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 16px;
  background-color: transparent;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 1.4rem;
  box-shadow: none;
  overflow: hidden;
}

.tafsir-modal-title {
  font-family: 'Amiri', serif;
  font-size: 2.1rem;
  color: #064e3b;
  margin-bottom: 0.35rem;
}

.tafsir-modal-author {
  color: #047857;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.tafsir-modal-divider {
  height: 1px;
  background: rgba(6, 78, 59, 0.15);
  margin-bottom: 1rem;
}

.tafsir-modal-description {
  color: #334155;
  line-height: 1.9;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

body.modal-open {
  overflow: hidden;
}

@keyframes tafsir-rise {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Quranic Text Styling ===== */
.quran-text {
  font-family: 'Amiri', serif;
  word-spacing: 0.15em;
  letter-spacing: 0.02em;
}

.verse-item .quran-text {
  margin-top: 0.25rem;
  line-height: 2.4;
}

.verse-item .tafsir-text {
  margin-top: 0.75rem;
}

/* ===== Verse Container ===== */
.verse-container {
  background: #faf6f0;
  border: 1px solid #f0e4cf;
}

/* ===== Verse Item ===== */
.verse-item {
  transition: all 0.3s ease-out;
  transform: translateZ(0);
  padding: 1.4rem 1.8rem;
}

@media (min-width: 768px) {
  .verse-item {
    padding: 1.8rem 2.4rem;
  }
}

/* Disable hover on mobile (touchscreen devices) */
@media (hover: hover) and (pointer: fine) {
  .verse-item:hover {
    background-color: rgba(6, 78, 59, 0.05);
  }

  .verse-item:not(.verse-disabled):hover {
    background-color: rgba(6, 78, 59, 0.03);
  }
}

.verse-item.highlighted {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.3) !important;
  border-color: #fbbf24 !important;
  transform: translateZ(0) !important;
  overflow: visible !important;
  margin: 8px 0 !important;
}

.verse-item.search-highlight {
  border-color: rgba(212, 169, 86, 0.85) !important;
  box-shadow: 0 0 0 3px rgba(212, 169, 86, 0.25), 0 8px 20px rgba(6, 78, 59, 0.18) !important;
  background: rgba(253, 242, 204, 0.6);
}

.surah-header.search-highlight {
  background: rgba(253, 242, 204, 0.6);
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow: 0 0 0 2px rgba(212, 169, 86, 0.35);
}

.verse-item.highlighted .verse-number {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(6, 78, 59, 0.25);
}

.verse-item.verse-disabled {
  pointer-events: none;
  cursor: default !important;
}

.verse-item:not(.verse-disabled) {
  cursor: pointer !important;
}

.lecture-accordion.is-active .lecture-header-card {
  border-color: #d4a956;
  box-shadow: 0 8px 20px rgba(6, 78, 59, 0.15);
}

/* ===== Lecture Accordions ===== */
.lecture-accordion {
  transition: all 0.3s ease;
}

.lecture-header-card {
  transition: all 0.25s ease;
}

.lecture-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(250, 246, 240, 0.9));
  border: 1px solid rgba(6, 78, 59, 0.08);
  box-shadow: 0 12px 28px rgba(6, 78, 59, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.lecture-header::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4px;
  background: #d4a956;
  opacity: 0.7;
  transition: opacity 0.25s ease;
}

.lecture-accordion:hover .lecture-header-card {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(6, 78, 59, 0.12);
}

.lecture-accordion.is-open .lecture-header::before {
  opacity: 0.9;
}

.lecture-title {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.lecture-range {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(6, 78, 59, 0.08);
  color: #065f46;
  font-size: 0.85rem;
  font-weight: 600;
}

.lecture-header {
  cursor: pointer;
}

 

.lecture-play {
  box-shadow: 0 8px 18px rgba(212, 169, 86, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lecture-play:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 22px rgba(212, 169, 86, 0.45);
}

.lecture-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
  will-change: max-height, opacity, transform;
}

.lecture-accordion.is-open .lecture-body {
  opacity: 1;
  transform: translateY(0);
}

.lecture-body-inner {
  padding-top: 1rem;
}

/* ===== 3D Book Card ===== */
.book-card {
  perspective: 1000px;
}

.book-cover {
  transform-style: preserve-3d;
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.4s ease;
  box-shadow:
    10px 10px 30px rgba(0, 0, 0, 0.25),
    1px 1px 3px rgba(0, 0, 0, 0.15);
}

.book-card:hover .book-cover {
  transform: rotateY(-5deg) rotateX(2deg) translateY(-10px);
}

.book-spine {
  position: absolute;
  right: 100%;
  top: 0;
  bottom: 0;
  width: 20px;
  transform: rotateY(90deg);
  transform-origin: right center;
}

.book-edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
  transform: rotateX(-90deg);
  transform-origin: top center;
  background: linear-gradient(to right, #e5e7eb, #f3f4f6, #e5e7eb);
}

/* ===== Audio Player Bar ===== */
.audio-bar {
  background: linear-gradient(180deg, #064e3b 0%, #022c22 100%);
  border-top: 3px solid #d4a956;
  will-change: transform;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  --audio-time-width: 72px;
}

.audio-bar.visible {
  transform: translateY(0);
}

.audio-bar.is-swiping {
  transition: none;
}

/* ===== Progress Bar ===== */
.progress-track {
  cursor: pointer;
  touch-action: none;
  position: relative;
}

.audio-progress-row {
  min-width: 0;
}

.audio-progress-row .progress-track {
  min-width: 0;
}

.audio-progress-row .audio-window-controls {
  margin-inline-start: 0.25rem;
}

.progress-track::before {
  content: '';
  position: absolute;
  inset: -6px 0;
}

.progress-fill {
  transition: width 0.1s linear;
}

.audio-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--audio-time-width);
  height: 22px;
}

.audio-left-controls {
  margin-left: 0;
  padding-left: 0;
}

.audio-right-controls {
  margin-right: 0;
  padding-right: 0;
  min-width: 0;
}

.audio-left-slot,
.audio-right-slot {
  width: var(--audio-time-width);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.progress-handle {
  opacity: 0;
  transition: opacity 0.2s, box-shadow 0.2s;
}

.progress-track:hover .progress-handle {
  opacity: 1;
}

.progress-track.is-dragging .progress-fill {
  transition: none;
}

.progress-track.is-dragging .progress-handle {
  opacity: 1;
}

.progress-track.snap-active .progress-handle {
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(212, 169, 86, 0.45),
              0 0 12px rgba(212, 169, 86, 0.35);
}

.progress-track.snap-active .progress-fill {
  box-shadow: 0 0 8px rgba(212, 169, 86, 0.35);
}

/* ===== Navigation Tab ===== */
.nav-tab {
  position: relative;
  transition: all 0.2s ease;
}

.nav-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  right: 50%;
  height: 2px;
  background-color: #d4a956;
  transition: all 0.2s ease;
}

.nav-tab:hover::after,
.nav-tab.active::after {
  left: 0;
  right: 0;
}

.nav-tab.active {
  color: #d4a956;
}

.nav-desktop {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-desktop::-webkit-scrollbar {
  display: none;
}

.desktop-search-wrap {
  width: clamp(11rem, 18vw, 16rem);
}

.desktop-search-input {
  width: 100%;
}

.search-results-desktop-panel {
  width: min(22rem, calc(100vw - 2rem));
}

@media (min-width: 768px) and (max-width: 1180px) {
  .nav-tab {
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
  }

  .desktop-search-wrap {
    width: clamp(10rem, 17vw, 12.5rem);
  }
}

/* ===== Search Input ===== */
.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(212, 169, 86, 0.5);
}

/* ===== Button Styles ===== */
.btn-primary {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #faf6f0 0%, #f5ede0 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  border: 2px solid #d4a956;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: rgba(212, 169, 86, 0.1);
}

/* ===== Social Buttons ===== */
.social-btn {
  transition: all 0.2s ease;
}

.social-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.social-btn.telegram {
  background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
}

.social-btn.youtube {
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
}

/* ===== Surah Card ===== */
.surah-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.surah-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 35px rgba(6, 78, 59, 0.15);
}

.surah-card.is-playing {
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35),
              0 10px 24px rgba(212, 175, 55, 0.18);
}

.surah-time-icon {
  width: 16px;
  height: 16px;
  color: #047857;
  flex-shrink: 0;
}

.ayah-badge {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ayah-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ayah-count {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  color: #065f46;
  line-height: 1;
}

.surah-number-badge {
  background-color: #059669;
  transition: background-color 0.25s ease;
}

.surah-number-text,
.surah-play-icon,
.surah-eq {
  transition: opacity 0.25s ease;
}

.surah-play-icon {
  opacity: 0;
}

.surah-eq {
  opacity: 0;
}

.surah-card:hover .surah-number-badge {
  background-color: #d4af37;
}

.surah-card.is-playing .surah-number-badge {
  background-color: #d4af37;
}

.surah-card:hover .surah-number-text {
  opacity: 0;
}

.surah-card:hover .surah-play-icon {
  opacity: 1;
}

.surah-card.is-playing .surah-number-text {
  opacity: 0;
}

.surah-card.is-playing .surah-play-icon {
  opacity: 0;
}

.surah-card.is-playing .surah-eq {
  opacity: 1;
}

.surah-info-row {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.duration-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

/* ===== Teacher Card ===== */
.teacher-card {
  transition: all 0.3s ease;
}

.teacher-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ===== Speed Dropdown ===== */
.speed-dropdown {
  position: relative;
}

.speed-options {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #022c22;
  border-radius: 0.5rem;
  padding: 0.5rem 0;
  min-width: 80px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.speed-options.open,
.speed-options.speed-options-visible {
  opacity: 1;
  visibility: visible;
}

.speed-option {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.speed-option:hover {
  background-color: rgba(212, 169, 86, 0.2);
}

.speed-option.active {
  color: #d4a956;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #faf6f0;
}

::-webkit-scrollbar-thumb {
  background: #d4a956;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #c49a4b;
}

/* ===== Animation Keyframes ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse-highlight {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(6, 78, 59, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(6, 78, 59, 0);
  }
}

@keyframes playing-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.4s ease-out forwards;
}

.animate-pulse-highlight {
  animation: pulse-highlight 1s ease-in-out;
}

/* Audio Visualizer */
.audio-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
}

.audio-visualizer .bar {
  width: 3px;
  background: currentColor;
  border-radius: 2px;
  animation: visualizer 0.8s ease-in-out infinite;
  transform-origin: bottom;
}

.audio-visualizer .bar:nth-child(1) {
  animation-delay: 0s;
  animation-duration: 0.6s;
}

.audio-visualizer .bar:nth-child(2) {
  animation-delay: 0.15s;
  animation-duration: 0.8s;
}

.audio-visualizer .bar:nth-child(3) {
  animation-delay: 0.3s;
  animation-duration: 0.7s;
}

.audio-visualizer .bar:nth-child(4) {
  animation-delay: 0.45s;
  animation-duration: 0.9s;
}

@keyframes visualizer {
  0%, 100% {
    height: 4px;
  }
  50% {
    height: 18px;
  }
}


/* ===== Hero Content Fade In ===== */
.hero-content-fade {
  animation: fadeIn 0.6s ease-out;
}

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

/* ===== Hardware Acceleration ===== */
.gpu {
  transform: translateZ(0);
  will-change: transform;
}

/* ===== Mobile Menu ===== */
.mobile-menu {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.mobile-menu.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===== Coming Soon Badge ===== */
.coming-soon-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ===== Loading Spinner ===== */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #d4a956;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== RTL Fixes ===== */
[dir="rtl"] input[type="range"] {
  direction: ltr;
}

/* ===== Safe Area Padding for iOS ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .audio-bar {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* ===== Print Styles ===== */
@media print {
  .audio-bar,
  #header,
  #audio-player {
    display: none !important;
  }
}

/* ===== Logo Effects ===== */
.logo-glow {
  filter: none;
}

.logo-glow-subtle {
  filter: none;
}

/* Hero Logo Effect */
.hero-logo {
  filter: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PERSISTENT AUDIO PLAYER STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   Full Audio Bar (Docked Bottom)
   ───────────────────────────────────────────────────────────────────────── */
.audio-bar-full {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, #064e3b, #022c22);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
  border-top: 2px solid #d4a956;
  padding: 1rem 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  will-change: transform;
}

.audio-bar-full.audio-bar-visible {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────────
   Progress Bar with Verse Markers
   ───────────────────────────────────────────────────────────────────────── */
.progress-bar-wrapper {
  position: relative;
}

.progress-fill {
  pointer-events: none;
}

/* Verse Markers */
.verse-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: pointer;
  z-index: 10;
  transform: translateX(-50%);
  pointer-events: auto;
}

.verse-marker-line {
  width: 2px;
  height: 100%;
  margin: 0 auto;
  background: rgba(212, 169, 86, 0.55);
  transition: all 0.15s ease;
}

.verse-marker:hover .verse-marker-line {
  background: #d4a956;
  width: 2px;
  margin: 0 auto;
}

.verse-marker-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #022c22;
  color: white;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  min-width: 68px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.4rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  pointer-events: none;
  border: 1px solid rgba(212, 169, 86, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.verse-marker:hover .verse-marker-tooltip {
  opacity: 1;
  visibility: visible;
}

.verse-marker.is-snap .verse-marker-tooltip {
  opacity: 1;
  visibility: visible;
}

.verse-marker.is-snap .verse-marker-line {
  background: #d4a956;
}

/* Volume Control */
.volume-control {
  position: relative;
}

.volume-panel {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);
  background: #022c22;
  border: 1px solid rgba(212, 169, 86, 0.35);
  border-radius: 0.6rem;
  padding: 0.4rem;
  width: 32px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 50;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.volume-control:hover .volume-panel,
.volume-panel:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%);
}

.volume-panel .volume-slider {
  width: 90px;
  height: 6px;
  transform: rotate(-90deg);
  margin: 0;
  --volume-fill: 100%;
}

@media (min-width: 768px) and (max-width: 1200px) {
  .audio-bar {
    --audio-time-width: 56px;
  }

  .audio-bar .audio-progress-row {
    gap: 0.45rem;
  }

  .audio-bar .audio-left-controls {
    gap: 0.5rem;
  }
}

@media (min-width: 1201px) and (max-width: 1400px) {
  .audio-bar {
    --audio-time-width: 58px;
  }

  .audio-bar .audio-progress-row {
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .audio-bar {
    padding: 1rem 0.75rem 1.25rem !important;
    --audio-time-width: 44px;
  }

  .audio-progress-row {
    gap: 0.3rem;
  }

  .audio-bar #progress-track {
    height: 0.5rem !important;
  }

  .audio-bar #progress-handle {
    width: 1rem;
    height: 1rem;
  }

  .audio-bar #play-pause {
    width: 3rem;
    height: 3rem;
  }

  .audio-bar #skip-forward,
  .audio-bar #skip-backward {
    padding: 0.5rem;
  }

  /* Smaller timestamps on mobile for more seekbar room */
  .audio-bar .audio-time {
    font-size: 0.7rem;
    height: 16px;
  }

  .audio-left-controls {
    margin-left: 0;
    padding-left: 0;
  }

  .audio-right-controls {
    margin-right: 0;
    padding-right: 0;
  }

  /* Adjust speed button position on mobile */
  .audio-right-controls .speed-dropdown {
    margin-right: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Floating Action Button (FAB) - Minimized Mode
   ───────────────────────────────────────────────────────────────────────── */
.audio-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  left: auto;
  z-index: 1000;
}

@media (max-width: 768px) {
  .audio-fab {
    bottom: 1rem;
    right: 1rem;
    left: auto;
  }
}

/* FAB Pulse Ring Animation (when playing) */
.audio-fab.fab-playing .fab-ring {
  animation: fab-pulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes fab-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.3;
  }
}

/* FAB Tooltip */
.fab-tooltip {
  z-index: 1001;
}

/* ─────────────────────────────────────────────────────────────────────────
   Speed Dropdown
   ───────────────────────────────────────────────────────────────────────── */
.speed-options {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: #022c22;
  border: 1px solid rgba(212, 169, 86, 0.3);
  border-radius: 0.75rem;
  padding: 0.5rem 0;
  min-width: 80px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
}

.speed-options.speed-options-visible {
  opacity: 1;
  visibility: visible;
}

.speed-option {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-align: center;
  color: #f5ede0;
}

.speed-option:hover {
  background-color: rgba(212, 169, 86, 0.2);
  color: #d4a956;
}

.speed-option.active {
  color: #d4a956;
  font-weight: bold;
}

/* ─────────────────────────────────────────────────────────────────────────
   Volume Slider (Custom styling)
   ───────────────────────────────────────────────────────────────────────── */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  outline: none;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.volume-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    #d4a956 0%,
    #d4a956 var(--volume-fill, 50%),
    #0b3f31 var(--volume-fill, 50%),
    #0b3f31 100%);
  box-shadow: inset 0 0 0 1px rgba(6, 95, 70, 0.65);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  background: #d4a956;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 2px solid #022c22;
}

.volume-slider::-webkit-slider-thumb:hover {
  background: #e8c895;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(212, 169, 86, 0.5);
}

/* Firefox */
.volume-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    #d4a956 0%,
    #d4a956 var(--volume-fill, 50%),
    #0b3f31 var(--volume-fill, 50%),
    #0b3f31 100%);
  box-shadow: inset 0 0 0 1px rgba(6, 95, 70, 0.65);
}

.volume-slider::-moz-range-progress {
  background: #d4a956;
  height: 6px;
  border-radius: 999px;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #d4a956;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 2px solid #022c22;
}

.volume-slider::-moz-range-thumb:hover {
  background: #e8c895;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(212, 169, 86, 0.5);
}

/* ─────────────────────────────────────────────────────────────────────────
   Active Ayah Highlighting (Reading View)
   ───────────────────────────────────────────────────────────────────────── */

/* ===== Methodology Section Spacing ===== */
/* Increase line-height for methodology section paragraphs only */
section p.text-gray-700.text-lg.leading-relaxed {
  line-height: 2.4 !important;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* ===== Methodology and Lesson Style Spacing ===== */
section:has(h2:contains("مەنهەجمان")) p,
section:has(h2:contains("شێوازی وانەکان")) p {
  line-height: 1.95;
}

section:has(h2:contains("شێوازی وانەکان")) ul {
  space-y-gap: 1.5rem;
}

section:has(h2:contains("شێوازی وانەکان")) li {
  margin-bottom: 1.5rem;
}
.active-ayah {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  box-shadow: 0 4px 20px rgba(212, 169, 86, 0.3) !important;
  transform: translateZ(0) scale(1.01);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: ayah-glow 1.5s ease-in-out;
  border-right: 4px solid #d4a956;
}

@keyframes ayah-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(212, 169, 86, 0.3);
  }
  50% {
    box-shadow: 0 8px 30px rgba(212, 169, 86, 0.5);
  }
}

.active-ayah .verse-number {
  background-color: #064e3b !important;
  color: white !important;
  border-color: #d4a956 !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   Responsive Adjustments
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .audio-bar-full {
    padding: 0.75rem 0;
  }
  
  .progress-bar-wrapper {
    margin-bottom: 0.75rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Print Styles
   ───────────────────────────────────────────────────────────────────────── */
@media print {
  .audio-bar-full,
  .audio-fab {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Accessibility
   ───────────────────────────────────────────────────────────────────────── */
.audio-bar-full button:focus,
.audio-fab button:focus,
.verse-marker:focus {
  outline: 2px solid #d4a956;
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Hardware Acceleration
   ───────────────────────────────────────────────────────────────────────── */
.audio-bar-full,
.audio-fab,
.progress-fill,
.active-ayah {
  will-change: transform;
  transform: translateZ(0);
}
/* Using Amiri from Google Fonts (loaded in index.html) for Quran text */

/* ─────────────────────────────────────────────────────────────────────────
   Tafsir Reviews Page - Library Grid
   ───────────────────────────────────────────────────────────────────────── */
.tafsir-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .tafsir-grid {
    gap: 2rem;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .tafsir-grid {
    gap: 2.5rem;
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Tafsir Book Card (Vertical)
   ───────────────────────────────────────────────────────────────────────── */
.tafsir-book-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: white;
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid #f0e4cf;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tafsir-book-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 35px rgba(6, 78, 59, 0.15);
  border-color: rgba(212, 169, 86, 0.5);
}

.tafsir-book-card:focus-visible {
  outline: 2px solid #d4a956;
  outline-offset: 2px;
}

.tafsir-book-card .book-cover {
  aspect-ratio: 3/4;
  width: 100%;
  margin-bottom: 0;
}

.tafsir-book-card .book-card {
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────
   Category Filter Chips
   ───────────────────────────────────────────────────────────────────────── */
.category-filter {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 2px solid #f0e4cf;
  background: white;
  color: #065f46;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-chip:hover {
  border-color: #d4a956;
  background: #fef3c7;
}

.category-chip:focus-visible {
  outline: 2px solid #d4a956;
  outline-offset: 2px;
}

.category-chip.active {
  background: #064e3b;
  color: white;
  border-color: #064e3b;
}

.category-chip:active {
  transform: scale(0.95);
}

/* ─────────────────────────────────────────────────────────────────────────
   Book Detail Drawer
   ───────────────────────────────────────────────────────────────────────── */
.book-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 44, 34, 0.6);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.book-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.book-drawer {
  position: fixed;
  inset-y: 0;
  right: 0;
  width: 100%;
  max-width: 32rem;
  background: linear-gradient(180deg, #fdfbf7 0%, #faf6f0 100%);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.book-drawer.open {
  transform: translateX(0);
}

@media (max-width: 640px) {
  .book-drawer {
    max-width: 100%;
  }
}

/* Drawer content stagger animation */
.book-drawer.open .drawer-content > * {
  animation: slideUp 0.4s ease-out forwards;
  opacity: 0;
}

.book-drawer.open .drawer-content > *:nth-child(1) { animation-delay: 0.05s; }
.book-drawer.open .drawer-content > *:nth-child(2) { animation-delay: 0.1s; }
.book-drawer.open .drawer-content > *:nth-child(3) { animation-delay: 0.15s; }
.book-drawer.open .drawer-content > *:nth-child(4) { animation-delay: 0.2s; }
.book-drawer.open .drawer-content > *:nth-child(5) { animation-delay: 0.25s; }
.book-drawer.open .drawer-content > *:nth-child(6) { animation-delay: 0.3s; }
.book-drawer.open .drawer-content > *:nth-child(7) { animation-delay: 0.35s; }
.book-drawer.open .drawer-content > *:nth-child(8) { animation-delay: 0.4s; }

/* Drawer close button */
.book-drawer .close-drawer {
  position: sticky;
  top: 1rem;
  z-index: 10;
}

/* Drawer description prose */
.book-drawer .prose p {
  margin-bottom: 1rem;
  line-height: 2;
}

.book-drawer .prose p:last-child {
  margin-bottom: 0;
}

/* Highlight list styling */
.book-drawer .highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.book-drawer .highlight-bullet {
  width: 0.5rem;
  height: 0.5rem;
  background: #d4a956;
  border-radius: 50%;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

/* Drawer book cover special sizing */
.book-drawer .book-card {
  perspective: 1000px;
}

.book-drawer .book-cover {
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.4s ease;
}

.book-drawer .book-card:hover .book-cover {
  transform: rotateY(-5deg) rotateX(2deg) translateY(-5px);
}


