/* =============================================================
   SalatiPal — Quran reader: dark-mode readability + control polish
   Scope: body[data-sp-route="quran"].  Night flag: body[data-sp-qnight]
          (set by quran-darkfix.js when verse text renders white).
   Tasks:
     #1 selected verse readable in night mode
     #3 per-verse play button contrast (both modes)
     #4 top-bar reader buttons + download buttons polish
   ( #2 offline-always-light is handled by a bundle edit, not here. )
   Safe to remove: drop the <link>/<script> from index.html.
   ============================================================= */

/* ---- #1 Verse-highlight readability in night mode ---------------
   Both the currently-RECITING verse (theme highlightBg — green/mint)
   and the TAP-SELECTED verse (buttonAccent — light blue) get a LIGHT
   inline background on their ayah row, while the Arabic text is forced
   white → white-on-light = unreadable. quran-darkfix.js measures each
   highlighted row against the dark page and tags the unreadable ones
   with .sp-hl-night, plus .sp-hl-sel (selected) / .sp-hl-play (reciting)
   to keep the hue. Repaint each with a readable translucent highlight.
   (Light mode keeps the light highlight + dark text, which is fine.) */
body[data-sp-route="quran"][data-sp-qnight] .sp-hl-night {
  border-radius: 6px !important;
}
/* currently-reciting verse → readable translucent green */
body[data-sp-route="quran"][data-sp-qnight] .sp-hl-night.sp-hl-play {
  background-color: rgba(16, 185, 129, 0.30) !important;
  box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.55) !important;
}
/* tap-selected verse → golden, legible on dark */
body[data-sp-route="quran"][data-sp-qnight] .sp-hl-night.sp-hl-sel {
  background-color: rgba(212, 175, 55, 0.34) !important;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.60) !important;
}

/* ---- #3 Per-verse play button contrast (both light & dark) ------
   The idle button used linear-gradient(primary, accent) but `accent`
   is undefined in the theme → the gradient is invalid → no fill, just
   a faint blue-bordered glyph (hard to see in both modes). Give the
   IDLE (Play) button a solid high-contrast green fill with a white
   icon. The PLAYING (Pause) button keeps its amber gradient; we only
   guarantee its glyph is white. */
body[data-sp-route="quran"] button[title="Play Verse Recitation"] {
  background: #16a34a !important;
  border-color: #15803d !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
  opacity: 1 !important;
}
body[data-sp-route="quran"] button[title="Play Verse Recitation"]:hover {
  background: #15893f !important;
}
body[data-sp-route="quran"] button[title="Play Verse Recitation"] svg,
body[data-sp-route="quran"] button[title="Pause Verse Recitation"] svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
  opacity: 1 !important;
}

/* ---- #4 Top-bar reader buttons ----------------------------------
   `.sp-reader-glass-btn` (Chapters, close, etc.) shipped with NO CSS
   at all, so they rendered as bare outline buttons. Give them a real
   pill style with a comfortable 40px touch target, in both modes. */
body[data-sp-route="quran"] .sp-reader-glass-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 40px !important;
  min-width: 40px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  background: rgba(0, 102, 204, 0.10) !important;
  border: 1px solid rgba(0, 102, 204, 0.28) !important;
  color: #0b63c4 !important;
  transition: background-color .15s ease, transform .08s ease,
              box-shadow .15s ease !important;
}
body[data-sp-route="quran"] .sp-reader-glass-btn:hover {
  background: rgba(0, 102, 204, 0.18) !important;
}
body[data-sp-route="quran"] .sp-reader-glass-btn:active {
  transform: scale(0.94) !important;
}
body[data-sp-route="quran"] .sp-reader-glass-btn svg {
  width: 18px !important;
  height: 18px !important;
}
/* night-mode variant for the glass buttons (white-on-dark) */
body[data-sp-route="quran"][data-sp-qnight] .sp-reader-glass-btn {
  background: rgba(255, 255, 255, 0.10) !important;
  border-color: rgba(255, 255, 255, 0.24) !important;
  color: #e8eefc !important;
}

/* ---- #4 Download buttons in the reader top bar ------------------ */
body[data-sp-route="quran"] button[title="Download offline translations"],
body[data-sp-route="quran"] button[title="Download offline recitations"] {
  height: 40px !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16) !important;
  font-weight: 600 !important;
}
body[data-sp-route="quran"] button[title="Download offline translations"]:active,
body[data-sp-route="quran"] button[title="Download offline recitations"]:active {
  transform: scale(0.96) !important;
}

/* ---- #2 Offline Downloads modal: always light --------------------
   The reader's night mode also darkens the Offline Downloads modal,
   which the user wants kept light. The JS tags the modal panel with
   .sp-offline-modal; here we force the Tailwind dark utilities the
   bundle applies inside it back to their light equivalents. Scoped to
   the modal only, so the reader page is unaffected. */
.sp-offline-modal,
.sp-offline-modal .bg-gray-900,
.sp-offline-modal .bg-gray-800 {
  background-color: #ffffff !important;
}
.sp-offline-modal .bg-gray-700 {
  background-color: #f3f4f6 !important;
}
.sp-offline-modal .bg-blue-900\/50 {
  background-color: #eff6ff !important;
}
.sp-offline-modal,
.sp-offline-modal .text-white,
.sp-offline-modal .text-gray-100,
.sp-offline-modal .text-gray-200 {
  color: #111827 !important;
}
.sp-offline-modal .text-gray-400,
.sp-offline-modal .text-gray-300 {
  color: #4b5563 !important;
}
.sp-offline-modal .border-gray-700,
.sp-offline-modal .border-gray-600 {
  border-color: #e5e7eb !important;
}
/* keep the blue "Back" link and colored badges legible on white */
.sp-offline-modal .text-blue-400 { color: #2563eb !important; }
