/* =========================================
   ROOT VARIABLES (Professional Reading UI)
========================================= */
:root {
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f2f2f7;

  --text-main: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-soft: #8e8e93;

  --gold: #bfa742;
  --accent: var(--gold);
  --gold-soft: rgba(191, 167, 66, 0.15);

  --border-light: rgba(0, 0, 0, 0.08);

  --radius-lg: 20px;
  --radius-md: 14px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui;
  --font-title: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui;
  --font-arabic: "Amiri Quran", serif;

  --line-height-ar: 4.1rem;
  --line-height-text: 1.85;
}

/* --- font size and spacing ---- */

:root {
  /* USER READING CONTROLS */
  --arabic-font-size: 1.9rem;
  --arabic-line-height: 4.1rem;

  --translation-font-size: 1.05rem;
  --translation-line-height: 1.9rem;
}


/* =========================================
   GLOBAL RESET
========================================= */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-ui);
}

.no-copy {
  user-select: none;
}

/* =========================================
   TOP BAR
========================================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  font-size: 20px;
  text-decoration: none;
  color: var(--text-main);
  opacity: 0.8;
}

.story-title-wrap {
  flex: 1;
  text-align: center;
}

.dua-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--gold);
}

.story-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* =========================================
   META INFO
========================================= */
.story-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  flex-wrap: wrap;
}

.meta-chip {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
}

/* =========================================
   LANGUAGE SWITCH
========================================= */
.lang-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 22px;
}

.lang-btn {
  background: var(--bg-muted);
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}

.lang-btn.active {
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 600;
}

/* =========================================
   MAIN CONTAINER
========================================= */
.story-container {
  max-width: 760px;
  margin: auto;
  padding: 0 16px 140px;
}

/* =========================================
   DUA CARD
========================================= */
.dua-item {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 34px 30px 38px;
  margin-bottom: 26px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  scroll-margin-top: 120px;
}

.dua-item:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.dua-item.marked {
  background: linear-gradient(
    0deg,
    var(--gold-soft),
    var(--bg-card)
  );
}

/* =========================================
   BOOKMARK ICON
========================================= */
.dua-marker {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 26px;
  height: 26px;
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dua-marker svg {
  width: 100%;
  height: 100%;
  fill: rgba(191,167,66,0.35);
  transition: all 0.25s ease;
}

.dua-item.marked .dua-marker svg {
  fill: var(--gold);
  filter: drop-shadow(0 0 6px rgba(191,167,66,0.5));
}

/* =========================================
   SECTION TITLE
========================================= */
.section-title {
  font-family: var(--font-title);
  font-size: 22px;
  text-align: center;
  margin-bottom: 22px;
  color: var(--gold);
  letter-spacing: 0.4px;
}

/* =========================================
   ARABIC TEXT (MUSHAF STYLE)
========================================= */
.arabic {
  direction: rtl;
  text-align: center;
  font-family: var(--font-arabic);
  font-size: var(--arabic-font-size);
  line-height: var(--arabic-line-height);
  font-weight: 400;
  max-width: 46ch;
  margin: 0 auto;
  display: block;

  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--line-height-ar) - 2.5px),
    rgba(191, 167, 66, 0.08) calc(var(--line-height-ar) - 2.5px),
    rgba(0, 0, 0, 0.12) var(--line-height-ar)
  );
  background-size: 100% var(--line-height-ar);
}

/* =========================================
   TRANSLATIONS
========================================= */
.urdu,
.english {
  display: none;
  text-align: center;
  margin-top: 22px;
  opacity: 0.95;
}

.urdu {
  direction: rtl;
  font-size: var(--translation-font-size);
  line-height: var(--translation-line-height);
  font-family: "Noto Nastaliq Urdu", serif;
}

.english {
  font-size: var(--translation-font-size);
  line-height: var(--translation-line-height);
}

/* =========================================
   FLOATING BOOKMARK BUTTON
========================================= */
#scrollToBookmarkBtn {
  position: fixed;
  right: 22px;
  bottom: 90px;

  width: 50px;
  height: 50px;
  border-radius: 50%;


  cursor: pointer;
  display: none; /* JS controls visibility */
  z-index: 50;

  /* ✅ CENTER SVG PERFECTLY */
  display: flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.25s ease;
}

#scrollToBookmarkBtn:hover {
  transform: scale(1.1);
}

/* SVG styling */
#scrollToBookmarkBtn svg {
  width: 22px;
  height: 22px;
  stroke: #000000;
  flex-shrink: 0; /* prevents odd scaling */
}
body.dim 
    #scrollToBookmarkBtn svg {
        stroke: #fff;
    } 

body.dark 
    #scrollToBookmarkBtn svg {
        stroke: #fff;
    }     

/* =========================================
   DARK MODE
========================================= */
body.dark {
  --bg-main: #000;
  --bg-card: #0b1020;
  --bg-muted: #050e34d6;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
  --border-light: rgba(255, 255, 255, 0.08);
  --gold-soft: rgba(191, 167, 66, 0.25);
}

/* =========================================
   DIM MODE
========================================= */
body.dim {
  --bg-main: #0f141c;
  --bg-card: #161e2f;
  --bg-muted: #141c2d;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
  --border-light: rgba(255, 255, 255, 0.08);
  --gold-soft: rgba(191, 167, 66, 0.25);
}

/* =========================================
   SMOOTH TRANSITIONS
========================================= */
body,
.dua-item,
.lang-btn,
.section-title,
.arabic,
.urdu,
.english {
  transition: all 0.25s ease;
}





/* =========================================
   AUDIO BAR
========================================= */
#audioBar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
  z-index: 40;
}

#audioBar audio {
  width: 100%;
  max-width: 680px;
  margin: auto;
  border-radius: var(--radius-md);
}


/* ================= AUDIO BAR ================= */
#audioBar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem 1.2rem;

  backdrop-filter: blur(10px);
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;

  background: var(--audio-bg);
  transition: background 0.25s ease;
}

#audioBar audio {
  width: 100%;
  max-width: 640px;
  margin: auto;
}


/* ================= AUDIO BAR ================= */



/* ================= AUDIO PLAYER ================= */

audio {
  width: 100%;
  border-radius: 0.75rem;
  background: transparent;
}

/* DIM MODE → darker professional gray/blue (#0e1520 feel) */
body.dim audio {
  filter:
    invert(0.92)       /* darker base */
    hue-rotate(180deg) /* keep tint natural */
    brightness(0.80)   /* slightly darker */
    contrast(1);       /* maintain clarity */
  opacity: 0.95;       /* subtle polish */
}

/* DARK MODE → deep professional gray/blue (#0e1520 feel) */
body.dark audio {
  filter:
    invert(0.92)       
    hue-rotate(180deg) 
    brightness(0.75)   /* slightly darker than dim mode */
    contrast(1);       
  opacity: 0.95;       
}



/* ================= AUDIO PLAYER ================= */





/* =========================================
   READING SETTINGS BUTTON (APPLE BOOKS)
========================================= */
.reading-settings-btn {
  margin-left: auto; /* critical: pushes to right */

  height: 32px;
  min-width: 36px;

  padding: 0 10px;

  font-family: -apple-system, BlinkMacSystemFont, system-ui;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;

  border-radius: 8px;
  border: 1px solid var(--border-light);

  background: transparent;
  color: var(--text-secondary);

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.1s ease;
}

.reading-settings-btn:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.reading-settings-btn:active {
  transform: scale(0.96);
}



/* =========================================
   READING CONTROLS PANEL
========================================= */
/* ======================================================
   READING CONTROLS (SLIDERS)
====================================================== */
.reading-controls {
  display: none;
  max-width: 760px;
  margin: 14px auto 6px;
  padding: 0 16px;
}

.reading-controls.open {
  display: block;
}

.reading-controls label {
  display: block;
  margin-bottom: 18px;

  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.reading-controls input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}
.reading-controls.open {
  display: block;
}

