/* ======================================================
   ROOT VARIABLES — RAMADAN READING ENGINE
====================================================== */
:root {
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f2f2f7;

  --text-main: #1c1c1e;
  --text-secondary: #6e6e73;

  --gold: #bfa742;
  --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, system-ui;
  --font-title: -apple-system, BlinkMacSystemFont, system-ui;
  --font-arabic: "Amiri Quran", serif;

  /* JS-controlled */
  --font-scale: 1;
  --line-scale: 1;

  --reading-line-opacity: 0.12;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-ui);
  padding-bottom: 140px;
}

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

/* ======================================================
   TOP BAR
====================================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 14px 16px;
  background: rgba(250,250,250,0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-light);
}

.back-btn {
  position: absolute;
  left: 16px;
  top: 14px;
  font-size: 20px;
  text-decoration: none;
  color: var(--accent);
}


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

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

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

/* ======================================================
   READING SETTINGS BUTTON
====================================================== */
.reading-settings-btn {
  position: absolute;
  right: 16px;
  top: 12px;

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

  font-size: 11px;
  font-weight: 600;

  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-light);

  background: var(--bg-card);
  cursor: pointer;
}

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

/* ======================================================
   SETTINGS PANEL
====================================================== */
.reading-settings-panel {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 300;

  width: 240px;
  padding: 16px;

  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);

  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;

  transition: 0.2s ease;
}

.reading-settings-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ======================================================
   SETTINGS CONTENT
====================================================== */
.settings-section {
  margin-bottom: 16px;
}

.settings-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
}

.settings-controls {
  display: flex;
  gap: 10px;
}

.settings-controls button {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-muted);
  cursor: pointer;
}

.settings-controls button.active {
  background: var(--gold-soft);
  border-color: var(--gold);
}

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

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

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

.lang-btn {
  border-radius: 999px;
  padding: 6px 16px;
  background: var(--bg-muted);
  border: none;
  cursor: pointer;
}

.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;
}

/* ======================================================
   RAMADAN CARD
====================================================== */
.ramadan-item {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px 30px 40px;
  margin-bottom: 28px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.06);
}
/* ======================================================
   BOOKMARK ICON — PROFESSIONAL INTERACTION
====================================================== */

/* Larger invisible tap area (mobile-safe) */
.dua-marker {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  cursor: pointer;

  background: transparent;
  transition:
    background 0.2s ease,
    transform 0.12s ease,
    box-shadow 0.2s ease;
}

/* Visual icon size */
.dua-marker svg {
  width: 22px;
  height: 22px;

  fill: rgba(191,167,66,0.35);
  transition:
    fill 0.2s ease,
    filter 0.2s ease;
}

/* Hover (desktop) */
@media (hover: hover) {
  .dua-marker:hover {
    background: rgba(191,167,66,0.08);
  }
}

/* Active tap feedback */
.dua-marker:active {
  transform: scale(0.92);
}

/* MARKED STATE — feels locked & saved */
.ramadan-item.marked .dua-marker {
  background: rgba(191,167,66,0.15);
  box-shadow:
    inset 0 0 0 1px rgba(191,167,66,0.35),
    0 6px 16px rgba(191,167,66,0.25);
}

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

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

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

  background: var(--gold);
  color: white;

  display: none;
  align-items: center;
  justify-content: center;

  box-shadow:
    0 10px 26px rgba(191,167,66,0.45),
    inset 0 0 0 1px rgba(255,255,255,0.25);

  cursor: pointer;
  z-index: 250;

  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

#scrollToBookmarkBtn:hover {
  transform: translateY(-2px);
}

#scrollToBookmarkBtn:active {
  transform: scale(0.94);
}

/* Optional icon inside button */
#scrollToBookmarkBtn svg {
  width: 22px;
  height: 22px;
  fill: white;
}

/* ======================================================
   DARK / DIM MODE POLISH
====================================================== */
body.dark .dua-marker:hover,
body.dim .dua-marker:hover {
  background: rgba(191,167,66,0.14);
}

body.dark #scrollToBookmarkBtn,
body.dim #scrollToBookmarkBtn {
  box-shadow:
    0 14px 34px rgba(191,167,66,0.6),
    inset 0 0 0 1px rgba(255,255,255,0.18);
}


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

/* ======================================================
   ARABIC TEXT (PRIMARY)
====================================================== */
.arabic {
  direction: rtl;
  text-align: center;
  font-family: var(--font-arabic);

  font-size: calc(1.95rem * var(--font-scale));
  line-height: calc(6rem * var(--line-scale));

  max-width: 46ch;
  margin: auto;
}

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

.urdu {
  direction: rtl;
  font-size: 1.2rem;
  line-height: 2.3rem;
  font-family: "Noto Nastaliq Urdu", serif;
}

.english {
  font-size: 1.05rem;
  line-height: 1.95rem;
}

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

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

  display: none;
  align-items: center;
  justify-content: center;
}

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

  padding: 1rem;
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
}

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





/* 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 ================= */

/* ======================================================
   DARK & DIM MODES
====================================================== */
body.dark {
  --bg-main: #000;
  --bg-card: #0b1020;
  --bg-muted: #050e34;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
}

body.dim {
  --bg-main: #0f141c;
  --bg-card: #161e2f;
  --bg-muted: #141c2d;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
}









/* ======================================================
   RAMADAN VIRTUE SECTION
====================================================== */
.ramadan-virtue {
  max-width: 760px;
  margin: 10px auto 40px;
  padding: 0 16px;
}

/* ======================================================
   VIRTUE CARD
====================================================== */
.virtue-card {
  position: relative;
  background: linear-gradient(
    180deg,
    var(--gold-soft),
    var(--bg-card)
  );

  border-radius: var(--radius-lg);
  padding: 34px 26px 30px;

  text-align: center;

  box-shadow:
    0 12px 30px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(191,167,66,0.18);

  overflow: hidden;
}

/* Soft glow halo */
.virtue-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(
    circle,
    rgba(191,167,66,0.18),
    transparent 60%
  );
  opacity: 0.45;
  pointer-events: none;
}

/* ======================================================
   VIRTUE LABEL (AR / UR)
====================================================== */
.virtue-card::after {
  content: "فضيلة • فضیلت";
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);

  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 600;

  color: var(--gold);
  opacity: 0.85;
}

/* ======================================================
   ICON
====================================================== */
.virtue-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

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

  background: rgba(191,167,66,0.15);
  color: var(--gold);
  font-size: 20px;

  margin: 10px auto 18px;
}

/* ======================================================
   ARABIC VIRTUE TEXT
====================================================== */
.virtue-arabic {
  direction: rtl;
  text-align: center;

  font-family: var(--font-arabic);
  font-size: 1.55rem;
  line-height: 3.1rem;

  max-width: 40ch;
  margin: 0 auto 18px;

  color: var(--text-main);
}

/* ======================================================
   ENGLISH VIRTUE TEXT
====================================================== */
.virtue-english {
  font-size: 1.02rem;
  line-height: 1.9rem;

  max-width: 56ch;
  margin: auto;

  color: var(--text-secondary);
}

/* ======================================================
   AUTO-HIDE ON LONG READS
   (Visually softens virtue when page is long)
====================================================== */
.story-container:has(.ramadan-item:nth-child(5)) + .ramadan-virtue {
  opacity: 0.85;
}

.story-container:has(.ramadan-item:nth-child(8)) + .ramadan-virtue {
  opacity: 0.6;
}

.story-container:has(.ramadan-item:nth-child(12)) + .ramadan-virtue {
  opacity: 0.4;
}

/* ======================================================
   DARK / DIM MODE TUNING
====================================================== */
body.dark .virtue-card,
body.dim .virtue-card {
  background: linear-gradient(
    180deg,
    rgba(191,167,66,0.28),
    var(--bg-card)
  );

  box-shadow:
    0 18px 42px rgba(0,0,0,0.45),
    inset 0 0 0 1px rgba(191,167,66,0.25);
}

body.dark .virtue-card::before,
body.dim .virtue-card::before {
  opacity: 0.65;
}

body.dark .virtue-english,
body.dim .virtue-english {
  color: rgba(255,255,255,0.72);
}


.urdu,
.english {
  transition: opacity 0.25s ease;
}
