/* Medina Mushaf Overlay Styles */

.mushaf-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mushaf-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1;
  cursor: pointer;  /* Only backdrop has pointer cursor for closing */
}

.mushaf-content {
  position: relative;
  z-index: 2;
  background: #F5F1E8;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 800px;
  height: 90vh;
  overflow: hidden;
  direction: rtl;
  cursor: text;  /* Text cursor for copying */
}

@media (max-width: 768px) {
  .mushaf-content {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
}

/* Scrollable Mushaf container */
.mushaf-scrollable {
  width: 100%;
  height: 100%;
  overflow-y: auto; /* Enable vertical scrolling */
  overflow-x: hidden;
  padding: 0 60px 40px 60px;  /* No top padding - fixed header will provide spacing */
  position: relative;
}

/* Fixed header showing current Surah */
.mushaf-fixed-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #F5F1E8;
  border-bottom: 2px solid #8B4513;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 15px 0;
  margin-bottom: 20px;
}

/* Close button - top-left corner (Arabic RTL, so left is start) */
.mushaf-close-button {
  position: fixed;
  top: 70px;  /* Below .mushaf-content positioning */
  left: 15px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #8B4513;
  color: #F5F1E8;
  border: 2px solid #F5F1E8;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10000;  /* Above everything including overlay */
  /* Ensure touch target is large enough for mobile */
  min-width: 44px;
  min-height: 44px;
}

.mushaf-close-button:hover {
  background: #6B3513;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mushaf-close-button:active {
  transform: scale(0.95);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .mushaf-close-button {
    top: 15px;  /* Top of screen on mobile */
    left: 15px;
    width: 50px;
    height: 50px;
    font-size: 26px;
  }
}

.fixed-header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.fixed-header-title {
  font-family: 'Lalezar';
  font-size: 24px;
  color: #2C1810;
  font-weight: bold;
}

.fixed-header-meta {
  font-family: 'IBM Plex Sans Arabic', 'Readex Pro';
  font-size: 14px;
  color: #555;
  direction: rtl;
}

/* Verses container */
.mushaf-verses-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Page boundary marker */
.page-boundary {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 30px 0;
  position: relative;
}

.page-boundary-line {
  flex-grow: 1;
  height: 2px;
  background: linear-gradient(to right, transparent, #8B4513, transparent);
}

.page-number-marker {
  position: absolute;
  background: #F5F1E8;
  padding: 5px 20px;
  border: 2px solid #8B4513;
  border-radius: 20px;
  font-family: 'Lalezar';
  font-size: 14px;
  color: #8B4513;
  font-weight: bold;
}

/* Enhanced Surah header with metadata panel */
.surah-header-enhanced {
  margin: 40px 0;
  text-align: center;
}

.surah-header-box {
  border: 3px solid #8B4513;
  border-radius: 15px;
  padding: 25px;
  background: linear-gradient(135deg, #EAE4D8 0%, #F5F1E8 50%, #EAE4D8 100%);
}

.surah-title {
  font-family: 'Lalezar';
  font-size: 32px;
  color: #2C1810;
  font-weight: bold;
  margin-bottom: 15px;
}

.surah-metadata {
  font-family: 'IBM Plex Sans Arabic', 'Readex Pro';
  font-size: 16px;
  color: #555;
  margin-bottom: 15px;
  direction: rtl;
}

.surah-meta-item {
  display: inline-block;
}

.surah-meta-separator {
  display: inline-block;
  margin: 0 8px;
}

.surah-bismillah {
  font-family: 'KFGQPC Uthmanic HAFS', 'me_quran';
  font-size: 26px;
  color: #2C1810;
  direction: rtl;
  margin-top: 15px;
}

/* Verses - continuous text flow with right alignment */
.mushaf-verse {
  font-family: 'KFGQPC Uthmanic HAFS', 'me_quran';
  font-size: 26px;
  line-height: 2.8;
  text-align: right; /* Right-aligned as requested */
  color: #000;
  direction: rtl;
  display: inline;
}

/* Adjust for mobile */
@media (max-width: 768px) {
  .mushaf-verse {
    font-size: 22px;
    line-height: 2.5;
  }
}

.mushaf-verse-highlighted {
  background-color: rgba(255, 235, 59, 0.3);  /* Yellow highlight that works across wrapped lines */
  padding: 4px 6px;
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);  /* Subtle glow effect */
}

/* Verse number - Traditional Mushaf style with decorative circle */
.verse-number {
  display: inline-block;
  font-size: 16px;
  color: #8B4513;
  margin: 0 6px;
  font-weight: bold;
  font-family: 'Lalezar';
  /* Decorative circular border */
  border: 2px solid #8B4513;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  line-height: 28px;
  text-align: center;
  background: linear-gradient(135deg, #FFF9E6 0%, #F5F1E8 100%);
  box-shadow: 0 2px 4px rgba(139, 69, 19, 0.2);
  /* Slight ornamental effect */
  position: relative;
  vertical-align: middle;
}

/* Markers with new symbols */
.sajda-marker {
  display: inline-block;
  font-size: 24px;
  color: #8B4513;
  margin: 0 5px;
}

.juz-marker {
  display: inline-block;
  font-size: 22px;
  color: #8B4513;
  margin: 0 5px;
  font-weight: bold;
}

.quarter-marker {
  display: inline-block;
  font-size: 18px;
  color: #8B4513;
  margin: 0 5px;
}

.ruku-marker {
  display: inline-block;
  font-size: 18px;
  color: #8B4513;
  margin: 0 8px;
  font-family: 'Lalezar';
  font-weight: bold;
  /* Enhanced ornamental styling */
  background: linear-gradient(135deg, #F5F1E8 0%, #EAE4D8 100%);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1.5px solid #8B4513;
  box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
  /* Make it stand out more */
  position: relative;
  vertical-align: middle;
}

/* Loading/Error states */
.mushaf-loading {
  text-align: center;
  padding: 40px;
  font-family: 'Lalezar', serif;
  font-size: 24px;
  color: #8B4513;
}

.mushaf-error {
  text-align: center;
  padding: 40px;
  font-family: 'Lalezar', serif;
  font-size: 20px;
  color: #c33;
}
