/* ==========================================================================
   3D INTERACTIVE QURAN STYLESHEET
   Realistic 3D Book Physics, Rehal Wooden Stand, Tazhib Illumination, Audio Bar
   ========================================================================== */

.quran-interactive-section {
  background: radial-gradient(circle at 50% 30%, #0d213f 0%, #060f1c 70%, #03070e 100%);
  color: #FFFFFF;
  padding: 80px 0 100px;
  position: relative;
  overflow: hidden;
  border-top: 2px solid rgba(212, 175, 55, 0.35);
  border-bottom: 2px solid rgba(212, 175, 55, 0.35);
}

.quran-interactive-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4af37' fill-opacity='0.03' fill-rule='evenodd'%3E%3Cpath d='M40 40L20 20H0v20l20 20 20-20zm0 0l20 20h20V40L60 20 40 40zM0 60h20l20 20H0V60zm60 20l20-20v20H60zM20 0L0 20V0h20zm40 0l20 20V0H60z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* 3D Scene Viewport */
.quran-3d-viewport {
  perspective: 1800px;
  perspective-origin: 50% 45%;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

/* Glowing Aura behind Quran */
.quran-aura-glow {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 350px;
  background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.22) 0%, rgba(212, 175, 55, 0.05) 50%, transparent 80%);
  filter: blur(35px);
  pointer-events: none;
  z-index: 1;
}

/* 3D Quran Main Stage */
.quran-stage {
  position: relative;
  width: 860px;
  height: 520px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 20px;
  z-index: 5;
}

/* The Open Book Structure */
.quran-book {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
}

/* Book Cover Underlay / Leather Thickness */
.quran-book-cover {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(135deg, #091a32 0%, #051020 50%, #030a14 100%);
  border-radius: 12px;
  border: 3px solid #D4AF37;
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.3), 0 20px 50px rgba(0, 0, 0, 0.8);
  z-index: 1;
}

/* Pages Spread Container */
.quran-pages-spread {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  background: #FCF9EE;
  border-radius: 6px;
  overflow: hidden;
  z-index: 2;
  box-shadow: inset 0 0 30px rgba(184, 150, 70, 0.25);
}

/* Book Central Spine Shadow & Crease */
.quran-spine {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.5) 45%, rgba(212,175,55,0.4) 50%, rgba(0,0,0,0.5) 55%, rgba(0,0,0,0.3) 100%);
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Page Sides: Right (Page 1) and Left (Page 2) - In Arabic Tradition RTL */
.quran-page-half {
  width: 50%;
  height: 100%;
  position: relative;
  padding: 24px 28px;
  background: #FCF9F0;
  color: #1A202C;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.quran-page-right {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(90deg, #FBF7EB 0%, #FFFDF5 85%, #EFE7D0 100%);
}

.quran-page-left {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(270deg, #FBF7EB 0%, #FFFDF5 85%, #EFE7D0 100%);
}

/* Gilded Tazhib Illumination Frame */
.tazhib-frame {
  width: 100%;
  height: 100%;
  border: 3px double #D4AF37;
  outline: 1px solid #A9851F;
  outline-offset: -6px;
  padding: 16px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}

.tazhib-frame::before,
.tazhib-frame::after {
  content: '✦';
  position: absolute;
  color: #D4AF37;
  font-size: 0.9rem;
}

.tazhib-frame::before { top: 2px; left: 3px; }
.tazhib-frame::after { bottom: 2px; right: 3px; }

/* Surah Header Unwan */
.surah-unwan-header {
  background: linear-gradient(135deg, #0A192F 0%, #152B4E 100%);
  border: 1.5px solid #D4AF37;
  border-radius: 4px;
  padding: 5px 12px;
  text-align: center;
  color: #F8E7A0;
  margin-bottom: 10px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.surah-unwan-title {
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.surah-unwan-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #D4AF37;
}

/* Bismillah Calligraphy */
.bismillah-text {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: center;
  font-size: 1.55rem;
  color: #0A192F;
  margin: 4px 0 10px;
  line-height: 1.6;
}

/* Quranic Ayahs Area */
.quran-ayahs-flow {
  direction: rtl;
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  line-height: 2.15;
  color: #0A192F;
  text-align: justify;
  text-align-last: center;
  flex-grow: 1;
}

.ayah-end-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #D4AF37;
  color: #A9851F;
  font-size: 0.75rem;
  font-weight: 800;
  margin: 0 4px;
  vertical-align: middle;
  background: rgba(212, 175, 55, 0.1);
}

.highlighted-verse {
  background: rgba(212, 175, 55, 0.25);
  border-radius: 4px;
  padding: 2px 4px;
  transition: background 0.3s ease;
}

/* English Translation Footnote */
.quran-translation-box {
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  padding-top: 8px;
  margin-top: 8px;
  font-size: 0.775rem;
  color: #4A5568;
  line-height: 1.45;
  font-style: italic;
  direction: ltr;
  text-align: left;
}

.quran-page-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: #A9851F;
  text-align: center;
  margin-top: 4px;
}

/* DEDICATION PAGE STYLING (PAGE 5 & 6) */
.academy-dedication-page {
  background: radial-gradient(circle at center, #FFFFFF 0%, #FAF4E4 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10px;
}

.dedication-seal-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid #D4AF37;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
  margin-bottom: 12px;
}

.dedication-academy-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dedication-tagline {
  font-size: 0.85rem;
  color: var(--gold-dark);
  font-weight: 700;
  margin-bottom: 14px;
}

.dedication-dua-arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  font-size: 1.3rem;
  color: var(--primary-navy);
  line-height: 1.8;
  margin-bottom: 10px;
}

.dedication-dua-eng {
  font-size: 0.775rem;
  color: #556B82;
  font-style: italic;
  max-width: 320px;
  margin: 0 auto 12px;
}

/* FLIPPING PAGE 3D ANIMATION LAYER */
.flipping-sheet {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  z-index: 15;
  transition: transform 0.85s cubic-bezier(0.45, 0.05, 0.55, 0.95);
  cursor: pointer;
  pointer-events: none;
}

.flipping-sheet.flip-forward {
  transform: rotateY(-180deg);
}

.flipping-sheet .sheet-front,
.flipping-sheet .sheet-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 24px 28px;
  overflow: hidden;
  background: #FCF9F0;
}

.flipping-sheet .sheet-front {
  background: linear-gradient(90deg, #FBF7EB 0%, #FFFDF5 85%, #EFE7D0 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotateY(0deg);
}

.flipping-sheet .sheet-back {
  background: linear-gradient(270deg, #FBF7EB 0%, #FFFDF5 85%, #EFE7D0 100%);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotateY(180deg);
}

/* Page flipping shadow dynamic overlay */
.page-shadow-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.flipping .page-shadow-overlay {
  opacity: 1;
}

/* REALISTIC WOODEN REHAL (X-STAND) */
.rehal-stand {
  position: relative;
  width: 680px;
  height: 90px;
  margin-top: -35px;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rehal-left-leg,
.rehal-right-leg {
  position: absolute;
  width: 320px;
  height: 24px;
  background: linear-gradient(180deg, #5A3825 0%, #3B2314 60%, #20120A 100%);
  border-radius: 6px;
  border: 1px solid #D4AF37;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), inset 0 2px 6px rgba(212, 175, 55, 0.4);
}

.rehal-left-leg {
  transform: rotate(-12deg) skewX(-15deg);
  left: 60px;
}

.rehal-right-leg {
  transform: rotate(12deg) skewX(15deg);
  right: 60px;
}

.rehal-center-hinge {
  position: absolute;
  width: 45px;
  height: 30px;
  background: linear-gradient(135deg, #ECC875 0%, #D4AF37 50%, #997726 100%);
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
  z-index: 4;
}

/* INTERACTIVE CONTROLS BAR */
.quran-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(10, 25, 47, 0.85);
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-full);
  padding: 10px 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-top: 30px;
  z-index: 10;
  max-width: 820px;
  width: 100%;
}

.quran-nav-btns {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quran-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.quran-ctrl-btn:hover:not(:disabled) {
  background: var(--gold-gradient);
  color: var(--primary-navy-dark);
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.quran-ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Recitation Play Button & Sound Visualizer */
.recitation-ctrl-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recitation-play-btn {
  background: var(--gold-gradient);
  color: var(--primary-navy-dark);
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
  transition: all var(--transition-fast);
}

.recitation-play-btn:hover {
  transform: scale(1.04);
  box-shadow: var(--gold-glow);
}

.audio-visualizer-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.audio-bar {
  width: 3px;
  background: var(--gold-primary);
  border-radius: 2px;
  height: 4px;
  transition: height 0.15s ease;
}

.playing .audio-bar:nth-child(1) { animation: soundWave 0.8s infinite 0.1s; }
.playing .audio-bar:nth-child(2) { animation: soundWave 0.6s infinite 0.25s; }
.playing .audio-bar:nth-child(3) { animation: soundWave 0.9s infinite 0.15s; }
.playing .audio-bar:nth-child(4) { animation: soundWave 0.7s infinite 0.3s; }
.playing .audio-bar:nth-child(5) { animation: soundWave 0.85s infinite 0.05s; }

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

.quran-page-status {
  font-size: 0.85rem;
  color: var(--gold-light);
  font-weight: 600;
}

/* RESPONSIVE SCALING FOR 3D QURAN */
@media (max-width: 992px) {
  .quran-stage {
    width: 720px;
    height: 460px;
  }
  .quran-ayahs-flow {
    font-size: 1.15rem;
    line-height: 1.9;
  }
  .rehal-stand {
    width: 580px;
  }
}

@media (max-width: 768px) {
  .quran-3d-viewport {
    perspective: 1200px;
  }
  .quran-stage {
    width: 100%;
    max-width: 380px;
    height: 520px;
  }
  .quran-pages-spread {
    flex-direction: column;
  }
  .quran-page-half {
    width: 100%;
    height: 100%;
    padding: 18px;
  }
  .quran-page-right {
    display: flex;
  }
  .quran-page-left {
    display: none; /* Mobile switches single page */
  }
  .quran-spine {
    display: none;
  }
  .rehal-stand {
    display: none;
  }
  .quran-controls-bar {
    border-radius: var(--radius-md);
    flex-direction: column;
    padding: 16px;
  }
  .quran-nav-btns {
    width: 100%;
    justify-content: space-between;
  }
}
