/* Combined Legacy Styles from Quran DB v7 for Visual Fidelity */

/* --- From v7/style.css --- */
/* Minimal horizontal padding from the player downward; header remains full-bleed */
.quran-db-container:root,
:root {
  /* Height of sticky header + player; tweak or override via JS */
  --qdb-sticky-offset: 140px;
  /* Global defaults for typography controls */
  --qdb-ar-line: 2.05;
}

/* Ensure all sura headers (blue or default) stick to the top */
/* Parent page wrapper may exist (template or seamless wrap) */
.qdb-page-wrap {
  overflow: visible;
}

/* Quran DB v5 styles (uses Hafs 18 font) */
/* Fallback @font-face in addition to the registered CDN stylesheet */
@font-face {
  font-family: 'hafs18';
  font-style: normal;
  font-weight: 400;
  src: url('../font/hafs18.woff2') format('woff2');
  font-display: swap;
}

/* Local font faces (drop files into plugins/quran-db-v5/font/) */
@font-face {
  font-family: 'me_quran_new';
  font-style: normal;
  font-weight: 400;
  src: url('../font/me_quran_new.ttf') format('truetype');
  font-display: swap;
}

.quran-db-container {
  --qdb-text: #333;
}

/* --- Quran Search Form (qdb_search) --- */
.qdb-form {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.qdb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 10px;
}

.qdb-row.qdb-row-toggles {
  justify-content: flex-start;
}

.qdb-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.qdb-field.qdb-submit {
  margin-left: auto;
}

.qdb-label {
  font-weight: 600;
  color: #111827;
}

.qdb-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-width: 260px;
  font-size: 14px;
}

.qdb-check input {
  margin-right: 6px;
}

/* Toggle switch */
.qdb-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.qdb-switch input {
  display: none;
}

.qdb-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  transition: background .2s ease, box-shadow .2s ease;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}

.qdb-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.qdb-switch input:checked+.qdb-slider {
  background: #0b61a4;
}

.qdb-switch input:checked+.qdb-slider:before {
  transform: translateX(24px);
}

.qdb-toggle-label {
  font-weight: 600;
  margin-right: 8px;
  min-width: max-content;
}

/* View toggle specific styling */
.qdb-view-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.qdb-view-toggle-wrapper .qdb-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  cursor: pointer;
}

.qdb-view-toggle-wrapper .qdb-toggle-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  user-select: none;
}

/* Search summary spacing */
.qdb-search-summary {
  margin: 12px 0 8px;
  font-size: 1rem;
}

.qdb-search-results {
  display: block;
  margin-top: 8px;
}

/* Highlight and per-verse chips */
mark.qdb-hl {
  background: #fff3a3;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.qdb-occ-chip {
  margin-left: 6px;
  font-size: .85em;
  background: #fff3a3;
  color: #333;
  padding: 1px 6px;
  border-radius: 10px;
  display: inline-block;
  vertical-align: baseline;
}

/* Verse topline (when stats are hidden - integrated into SSOT below) */
:where(.qdb-verse-topline) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  padding: .25rem 0 .1rem;
  border-bottom: 1px solid #b5b5b5;
  margin-bottom: .35rem;
}

/* Controls row (global, used outside Sura block too) */
.qdb-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin: .75rem 0;
  font-family: inherit;
  background: #f6f7f7;
  border: 1px solid #e3e5e8;
  padding: .5rem .75rem;
  border-radius: 6px;
}

.qdb-controls-row .qdb-font-controls {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}

.qdb-controls-row .qdb-label {
  margin-right: .25rem;
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1;
}

.qdb-controls-row .qdb-div {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #ddd;
  margin: 0 .5rem;
}

/* Font control buttons styling (global) */
.qdb-controls-row .qdb-font-controls .button {
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  border-radius: 6px;
  border: 2px solid #0b61a4;
  background: #ffffff;
  color: #0b61a4;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.qdb-controls-row .qdb-font-controls .button:hover {
  background: #0b61a4;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(11, 97, 164, 0.3);
}

.qdb-controls-row .qdb-font-controls .button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .qdb-controls-row {
    gap: .5rem .75rem;
  }
}

/* ========================================
   QURAN VERSE STYLES - SINGLE SOURCE OF TRUTH
   All verse rendering contexts inherit from these base styles.
   Uses :where() for zero specificity to allow easy overrides.
   ======================================== */

/* Base verse container - semantic wrapper for single ayah */
:where(.quran_aya) {
  padding: 0 0 .6rem;
}

/* Zero-verse (Bismillah intro) styling */
:where(.quran_aya--intro) {
  padding: .8rem 0;
}

/* Align play button to the left for intro verse */
:where(.quran_aya--intro .qdb-verse-stat-ribbon) {
  justify-content: flex-start;
  margin-bottom: 0.5rem;
  border: none;
  padding-top: 0;
}

/* Arabic text container */
:where(.quran_ar) {
  direction: rtl;
  text-align: right;
  line-height: inherit;
  unicode-bidi: isolate;
}

/* English text typography */
:where(.quran_en .ayah_en_text) {
  font-family: 'Merriweather', Georgia, serif;
  font-size: var(--qdb-en-size, calc(var(--qdb-en-scale, 1) * 1rem));
  line-height: 1.6;
  color: var(--qdb-text, #333);
}

/* Verse stat ribbon base */
:where(.qdb-verse-stat-ribbon) {
  margin: 0 0 .25rem;
  padding-top: .75rem;
  border-top: 1px solid #b5b5b5;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

/* Stat ribbon chip segments */
:where(.qdb-verse-stat-ribbon .qdb-vsr-seg) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--vsr-chip-h, 16px);
  line-height: var(--vsr-chip-h, 16px);
  padding: 0 .40rem;
  border-radius: 2px;
  font-family: 'Merriweather', Georgia, serif;
  font-size: var(--vsr-chip-fs, 16px);
  font-weight: 400;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  transition: box-shadow .15s ease-in-out, transform .06s ease-in-out;
}

:where(.qdb-verse-stat-ribbon .qdb-vsr-seg > strong) {
  font-weight: 400;
  font-size: var(--vsr-chip-fs, 16px);
  line-height: var(--vsr-chip-h, 16px);
  display: block;
}

:where(.qdb-verse-stat-ribbon .qdb-vsr-seg:hover) {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .22), 0 0 0 1px rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}

/* Stat ribbon chip colors (mirrored from sura block) */
:where(.qdb-verse-stat-ribbon .ComVerNum) {
  --chip-bg: #666666;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .ComIntUnintVerNum) {
  --chip-bg: #834E18;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .RevVerNum) {
  --chip-bg: #9D0600;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .RevVerIntunintVerNum) {
  --chip-bg: #FF791F;
  background: var(--chip-bg);
  color: #111111;
}

:where(.qdb-verse-stat-ribbon .ComVerWG) {
  --chip-bg: #0B5292;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .ComFreqWG) {
  --chip-bg: #115898;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .RevVerWG) {
  --chip-bg: #654DA4;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .RevFreqWG) {
  --chip-bg: #6350A6;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .ComIntUnintWG) {
  --chip-bg: #4A8ECB;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .ComFreqIntUnintWG) {
  --chip-bg: #4488C6;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .RevVerInUninWG) {
  --chip-bg: #ABB2EA;
  background: var(--chip-bg);
  color: #111111;
}

:where(.qdb-verse-stat-ribbon .RevFreqInUninWG) {
  --chip-bg: #9DA6D9;
  background: var(--chip-bg);
  color: #111111;
}

:where(.qdb-verse-stat-ribbon .ComPrimeComposite) {
  --chip-bg: #274E13;
  background: var(--chip-bg);
  color: #ffffff;
}

:where(.qdb-verse-stat-ribbon .SuraVerse) {
  --chip-bg: #ffffff;
  background: var(--chip-bg);
  color: #111;
}

/* Stat ribbon tooltips */
:where(.qdb-verse-stat-ribbon .qdb-vsr-seg) {
  position: relative;
}

:where(.qdb-verse-stat-ribbon .qdb-vsr-seg:hover::after) {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 100%;
  transform: none;
  white-space: nowrap;
  background: var(--chip-bg, rgba(0, 0, 0, .85));
  color: inherit;
  padding: .25rem .4rem;
  border-radius: 3px;
  font-size: .75rem;
  line-height: 1;
  content: '';
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 2px 6px rgba(0, 0, 0, .2);
  z-index: 10;
}

:where(.qdb-verse-stat-ribbon .qdb-vsr-seg[data-tip]:hover::after) {
  content: attr(data-tip);
}

/* Center alignment modifiers */
:where(.quran_ar--center) {
  text-align: center;
}

:where(.quran_ar--center .ayah_text) {
  text-align: center;
  margin-inline: auto;
  display: inline-block;
}

:where(.quran_en--center) {
  text-align: center;
}

:where(.quran_en--center .ayah_en_text) {
  text-align: center;
  margin-inline: auto;
  display: inline-block;
}

/* Scroll margin for anchor positioning */
:where(.quran_aya, .quran_ar .ayah_text, .quran_en .ayah_en_text, .qdb-ayah-anchor, .qdb-verse-stat-ribbon) {
  scroll-margin-top: var(--qdb-sticky-offset, 140px);
}

/* Ayah highlight */
:where(.ayah_highlight) {
  background: rgba(255, 241, 118, .6);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08);
  border-radius: 4px;
}

/* Allah/God word highlighting */
:where(.qdb-allah-word, .qdb-god-word) {
  color: var(--qdb-header-blue, #0b61a4);
  font-weight: 700;
}

/* Simple View: collapse ribbon to Sura:Verse only */
:where(.qdb-view--simple .qdb-verse-stat-ribbon) {
  display: block;
  margin: calc(.25rem + 2px) 0 .35rem;
  padding: .25rem 0 .1rem;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg:not(.SuraVerse)) {
  display: none;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg.SuraVerse) {
  background: transparent;
  box-shadow: none;
  padding: 0;
  height: auto;
  line-height: 1.2;
  border-radius: 0;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg.SuraVerse > strong) {
  display: inline;
  font-weight: 600;
  font-size: var(--vsr-chip-fs, .95rem);
  line-height: 1.3;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg:hover::after) {
  content: none;
}

/* ========================================
   VERSE CONTEXT WRAPPERS
   Minimal styling for different rendering contexts
   ======================================== */

/* Search result card wrapper */
.qdb-verse-card {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e5e5;
}

.qdb-verse-card:last-child {
  border-bottom: none;
}

/* Inline verse reference wrapper (e.g., [003:026]) */
.qdb-inline-verse {
  display: block;
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f9fafb;
  border-left: 3px solid var(--qdb-header-blue, #0b61a4);
  border-radius: 4px;
}

/* Single verse shortcode wrapper */
.qdb-single-verse {
  display: block;
  margin: 1.25rem 0;
  padding: .75rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  background: #fefefe;
}

/* Set font scale variables on all verse contexts */
.qdb-verse-card,
.qdb-inline-verse,
.qdb-single-verse,
.qdb-search,
.quran-db-container {
  --qdb-ar-scale: 1;
  --qdb-en-scale: 1;
  --qdb-ar-size: calc(var(--qdb-ar-scale, 1) * 1.35rem);
  --qdb-en-size: calc(var(--qdb-en-scale, 1) * 1rem);
  --vsr-chip-h: 18px;
  --vsr-chip-fs: 18px;
}

/* Editor placeholder */
.qdb-editor-placeholder {
  padding: 1rem;
  border: 1px dashed #ccc;
  background: #fafafa;
}

/* Two-pane Sura Browser layout */
.qdb-sura-browser {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.qdb-sura-browser__nav {
  flex: 0 0 320px;
  min-width: 260px;
  max-width: 360px;
  overflow: auto;
  padding: 6px;
  background: #f7fbff;
  border: 1px solid #e3eaf0;
  border-radius: 8px;
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 16px - 64px);
}

.qdb-sura-browser__nav .qdb-sura-grid {
  gap: 10px;
}

.qdb-sura-browser__main {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 900px) {
  .qdb-sura-browser {
    flex-direction: column;
  }

  .qdb-sura-browser__nav {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (min-width: 900px) {
  .qdb-sura-browser {
    flex-direction: row;
  }
}

/* Utility classes replacing inline styles (admin/tools and UI fallbacks) */
.qdb-prewrap {
  white-space: pre-wrap;
}

.qdb-pre-debug {
  background: #f6f7f7;
  padding: .5rem;
}

.qdb-input-wide {
  width: 40em;
}

.qdb-found {
  color: green;
}

.qdb-notfound {
  color: #cc0000;
}

.qdb-details {
  margin-top: 10px;
}

/* --- From v7/blocks/sura/style.css --- */

/* Seamless: compact header nudge */
.quran-db-container .sura_header--compact .sura-phon {
  transform: translateY(-1px);
}

/* ============================================
   MOBILE-FIRST RESPONSIVE STYLES
   Quran DB v7 - Sura Block
   ============================================ */

/* Local Arabic font: me_quran_new */
@font-face {
  font-family: 'me_quran_new';
  src: url('../font/me_quran_new.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Local Arabic font: hafs18 */
@font-face {
  font-family: 'hafs18';
  src: url('../font/hafs18.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* === BASE STYLES (Mobile 320px+) === */
/* (base .sura_header sticky/margins handled by .sura_header--blue and media queries) */

/* Z-index system for layered elements */
.wp-block-qdb-sura {
  --z-seal: 0;
  --z-content: 1;
  --z-bookmark: 1;
  --z-number: 2;
  --z-initials: 3;
  --z-search-trigger: 40;
  --z-dropdown: 50;
  --z-header: 100;
  --z-search-drawer: 1000;
  --shs-size: clamp(26px, 5.5vw, 32px);
  --seal-size: clamp(22px, 5.2vw, 34px);
  --hdr-pad-block: 0.35rem;
  /* Fixed chip sizing for verse stat ribbon */
  --vsr-chip-h: 18px;
  --vsr-chip-fs: 18px;
}

/* Seamless containers (no block wrapper): provide same variables */
.quran-db-container {
  --z-seal: 0;
  --z-content: 1;
  --z-bookmark: 1;
  --z-number: 2;
  --z-initials: 3;
  --z-search-trigger: 40;
  --z-dropdown: 50;
  --z-header: 100;
  --z-search-drawer: 1000;
  --shs-size: clamp(26px, 5.5vw, 32px);
  --seal-size: clamp(22px, 5.2vw, 34px);
  --hdr-pad-block: 0.35rem;
  --sc-height: 20px;
  --qdb-sticky-offset: calc(60px + var(--sc-height));
  --qdb-ar-size: calc(var(--qdb-ar-scale, 1) * 1.35rem);
  --qdb-en-size: calc(var(--qdb-en-scale, 1) * clamp(18px, 1.6vw, 22px));
}

/* Header number typography */
.wp-block-qdb-sura .sura-num {
  position: relative;
  z-index: 2;
  font-size: 0.9em;
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 500;
  color: #fff;
  line-height: 1;
  transition: font-size .2s ease-in-out;
  display: block;
  text-align: center;
  margin-top: 0;
  padding-top: 0;
}

.wp-block-qdb-sura .sura_header .sura_header-inner {
  display: grid !important;
  grid-template-columns: max-content minmax(var(--seal-size), 1fr) max-content;
  grid-template-areas:
    "left seal right"
    "player player player";
  align-items: center;
  gap: 1px 6px;
  grid-auto-rows: min-content;
  padding: var(--hdr-pad-block, 0.35rem) 0.6rem;
  padding-right: calc(0.6rem + var(--shs-size) + 8px);
  transition: all 0.3s ease;
  position: relative;
}

/* Seamless: mirror header grid */
.quran-db-container .sura_header .sura_header-inner {
  display: grid !important;
  grid-template-columns: max-content minmax(var(--seal-size), 1fr) max-content;
  grid-template-areas:
    "left seal right"
    "player player player";
  align-items: center;
  gap: 1px 6px;
  grid-auto-rows: min-content;
  padding: var(--hdr-pad-block, 0.35rem) 0.6rem;
  padding-right: calc(0.6rem + var(--shs-size) + 8px);
  position: relative;
}

/* Explicit header area placement */
.wp-block-qdb-sura .sura_header-center {
  grid-area: left;
  display: grid;
  grid-template-columns: max-content 1fr;
  grid-auto-rows: min-content;
  column-gap: 10px;
  align-items: center;
}

.wp-block-qdb-sura .sura_header-center .qdb-sura-numwrap {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  margin-top: calc(var(--hdr-pad-block, 0.35rem) * -1);
  margin-right: 4px;
}

.wp-block-qdb-sura .sura_header-center .sura-phon {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  padding-left: 2px;
}

.wp-block-qdb-sura .sura_header-center .sura-en {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding-left: 2px;
}

.wp-block-qdb-sura .sura_header-right {
  grid-area: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Keep the right header cluster vertically centered and aligned to the search trigger */
.wp-block-qdb-sura .sura_header-right {
  align-self: center;
}

.wp-block-qdb-sura .sura_header-right .sura_name_ar_fallback {
  direction: rtl;
  text-align: right;
  white-space: nowrap;
}

.wp-block-qdb-sura .sura-en {
  font-size: var(--qdb-en-size);
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.wp-block-qdb-sura .sura-phon {
  font-size: clamp(16px, 1.3vw, 20px);
  color: #e8f4f8;
  opacity: 0.95;
}

.wp-block-qdb-sura .sura_header-center .sura-phon {
  transform: translateY(-1px);
}

/* Seamless: mirror header placements */
.quran-db-container .sura_header-center {
  grid-area: left;
  display: grid;
  grid-template-columns: max-content 1fr;
  grid-auto-rows: min-content;
  column-gap: 10px;
  align-items: center;
}

.quran-db-container .sura_header-center .qdb-sura-numwrap {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  margin-top: calc(var(--hdr-pad-block, 0.35rem) * -1);
  margin-right: 4px;
}

.quran-db-container .sura_header-center .sura-phon {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  padding-left: 2px;
}

.quran-db-container .sura_header-center .sura-en {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding-left: 2px;
}

.quran-db-container .sura_header-right {
  grid-area: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-self: center;
}

.quran-db-container .sura_header-right .sura_name_ar_fallback {
  direction: rtl;
  text-align: right;
  white-space: nowrap;
}

.quran-db-container .sura-en {
  font-size: var(--qdb-en-size);
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.quran-db-container .sura-phon {
  font-size: clamp(16px, 1.3vw, 20px);
  color: #e8f4f8;
  opacity: 0.95;
}

.quran-db-container .sura_header-center .sura-phon {
  transform: translateY(-1px);
}

/* Allow grid items to shrink within header on narrow screens */
.wp-block-qdb-sura .sura_header-center,
.wp-block-qdb-sura .sura_header-right {
  min-width: 0;
}

.quran-db-container .sura_header-center,
.quran-db-container .sura_header-right {
  min-width: 0;
}

/* Arabic fallback may need breaks on tiny widths */
.wp-block-qdb-sura .sura_header-right .sura_name_ar_fallback,
.quran-db-container .sura_header-right .sura_name_ar_fallback {
  overflow-wrap: anywhere;
}

/* Ensure header wrappers are full-width and use border-box sizing */
.wp-block-qdb-sura .sura_header,
.wp-block-qdb-sura .sura_header .sura_header-inner,
.wp-block-qdb-sura .sura_header-player {
  width: 100%;
  box-sizing: border-box;
}

.wp-block-qdb-sura .sura_header-player {
  grid-area: player;
}

.wp-block-qdb-sura .sura_header-player {
  margin-top: .25rem;
}

/* Seamless: ensure player occupies the player row */
.quran-db-container .sura_header-player {
  grid-area: player;
  width: 100%;
  box-sizing: border-box;
  margin-top: .25rem;
}

/* SoundCloud Player (Header) */
.wp-block-qdb-sura .sura_header-player iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  height: var(--sc-height);
  min-height: var(--sc-height);
  background: transparent;
}

/* Constrain sura name image to prevent header overflow */
.wp-block-qdb-sura .sura_name_img {
  display: block;
  height: auto;
  width: auto;
  max-height: clamp(60px, 9vw, 96px);
  max-width: min(50vw, 340px);
}

.wp-block-qdb-sura .sura_name_img img {
  display: block;
  height: auto;
  width: auto;
  max-height: inherit;
  max-width: inherit;
}

/* Shortcode/seamless pages (no block wrapper) */
.quran-db-container .sura_name_img {
  display: block;
  height: auto;
  width: auto;
  max-height: clamp(60px, 9vw, 96px);
  max-width: min(50vw, 340px);
}

.quran-db-container .sura_name_img img {
  display: block;
  height: auto;
  width: auto;
  max-height: inherit;
  max-width: inherit;
}

/* Sticky header behavior when search drawer is open */
.sura_header--shifted-for-drawer {
  position: sticky !important;
  top: var(--drawer-height, 80px) !important;
  z-index: 99 !important;
  /* Below drawer (1000) but above content */
  transition: top 0.3s ease;
}

/* Smooth transition back to normal */
.sura_header {
  transition: top 0.3s ease;
}

/* Responsive content container: SSOT widths and margins */
.wp-block-qdb-sura .quran-db-container {
  margin-left: auto;
  margin-right: auto;
  /* Mobile 320–767px: 94% width with min 16px side padding */
  --qdb-side-pad: max(16px, 3vw);
  padding-inline: var(--qdb-side-pad);
  width: 100%;
  /* Cap extreme ultra-wide layouts */
  max-width: 2560px;
  box-sizing: border-box;
  min-width: 0;
}

/* Tablet 768–1023px: 92% width */
@media (min-width: 768px) {
  .wp-block-qdb-sura .quran-db-container {
    --qdb-side-pad: 4vw;
    padding-inline: var(--qdb-side-pad);
  }
}

/* Mobile refinements (<=600px and <=400px) placed near other breakpoints for readability */
@media (max-width: 600px) {
  .wp-block-qdb-sura .sura-en {
    font-size: clamp(18px, 4.5vw, 24px);
  }

  .wp-block-qdb-sura .sura-phon {
    font-size: clamp(.75rem, 2.2vw, .95rem);
  }

  .wp-block-qdb-sura .sura_header-inner {
    gap: 2px;
    --hdr-pad-block: .2rem;
    padding-block: .2rem;
    grid-template-columns: max-content minmax(var(--seal-size), 1fr) auto;
    grid-template-areas: "left seal right" "player player player";
    align-items: center;
  }

  /* Seamless: allow right column to shrink */
  .quran-db-container .sura_header .sura_header-inner {
    gap: 2px;
    padding-block: .2rem;
    grid-template-columns: max-content minmax(var(--seal-size), 1fr) auto;
  }

  .wp-block-qdb-sura .sura_header-right {
    justify-content: flex-end;
    margin-top: 0;
  }

  .wp-block-qdb-sura .sura_name_img {
    max-height: 50px;
    max-width: min(45vw, 180px);
  }

  .quran-db-container .sura_name_img {
    max-height: 50px;
    max-width: min(45vw, 180px);
  }

  .wp-block-qdb-sura .qdb-sura-numwrap,
  .quran-db-container .qdb-sura-numwrap {
    transform: scale(0.9);
    transform-origin: center;
  }

  .wp-block-qdb-sura .sura_header-initials {
    margin: 0;
  }

  .wp-block-qdb-sura .quran_ar .ayah_text {
    line-height: 1.9;
  }

  .wp-block-qdb-sura .quran_en .ayah_en_text {
    line-height: 1.55;
  }

  .wp-block-qdb-sura .sura_meta {
    margin: .3rem 0 .5rem;
  }

  .wp-block-qdb-sura .sura_meta-line span {
    font-size: .875rem;
    padding: .2rem .4rem;
  }
}

@media (max-width: 400px) {

  /* Ensure SoundCloud fits narrow portrait viewports (e.g., iPhone SE) */
  .quran-db-container .sura_header-player iframe {
    width: 100%;
    max-width: 100%;
  }

  .wp-block-qdb-sura .sura-en {
    font-size: clamp(16px, 4.8vw, 20px);
  }

  .quran-db-container .sura-en {
    font-size: clamp(16px, 4.8vw, 20px);
  }

  .wp-block-qdb-sura .sura-phon {
    font-size: clamp(.75rem, 2.2vw, .95rem);
  }

  .wp-block-qdb-sura .sura_header-inner {
    --hdr-pad-block: .15rem;
    padding-block: .15rem;
    gap: 2px;
    grid-template-columns: max-content minmax(var(--seal-size), 1fr) auto;
    grid-template-areas: "left seal right" "player player player";
  }

  .quran-db-container .sura_header .sura_header-inner {
    padding-block: .15rem;
    gap: 2px;
    grid-template-columns: max-content minmax(var(--seal-size), 1fr) auto;
  }

  .wp-block-qdb-sura .sura_header .qdb-sura-numwrap {
    font-size: clamp(.9rem, 2.8vw, 1rem);
  }

  .wp-block-qdb-sura .sura_name_img {
    max-height: 45px;
  }

  .quran-db-container .sura_name_img {
    max-height: 45px;
  }

  .wp-block-qdb-sura .qdb-sura-numwrap,
  .quran-db-container .qdb-sura-numwrap {
    transform: scale(0.85);
  }

  .wp-block-qdb-sura .sura_meta {
    margin: .25rem 0 .4rem;
  }

  .wp-block-qdb-sura .sura_meta-line span {
    font-size: .75rem;
    padding: .15rem .3rem;
  }
}

@media (max-width: 480px) {
  .wp-block-qdb-sura .sura-en {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28) !important;
  }

  .wp-block-qdb-sura .sura_header-right {
    flex-wrap: wrap;
    overflow: visible;
    white-space: normal;
  }

  .quran-db-container .sura_header-right {
    flex-wrap: wrap;
    overflow: visible;
    white-space: normal;
  }

  .wp-block-qdb-sura .sura-en {
    font-size: clamp(16px, 5vw, 20px);
  }

  .quran-db-container .sura-en {
    font-size: clamp(16px, 5vw, 20px);
  }

  /* Let Arabic fallback wrap and scale on very small screens */
  .wp-block-qdb-sura .sura_header-right .sura_name_ar_fallback,
  .quran-db-container .sura_header-right .sura_name_ar_fallback {
    white-space: normal;
    font-size: clamp(16px, 4.2vw, 18px);
  }

  /* Increase mini SoundCloud height slightly for small screens */
  .wp-block-qdb-sura .quran-db-container {
    --sc-height: 24px;
    --qdb-sticky-offset: calc(60px + var(--sc-height));
  }

  .quran-db-container {
    --sc-height: 24px;
    --qdb-sticky-offset: calc(60px + var(--sc-height));
  }
}

/* iPad Landscape/Small Laptops 1024–1366px: 1–2 flexible columns */
@media (min-width: 1024px) {
  .wp-block-qdb-sura .quran-db-container {
    --qdb-side-pad: 5vw;
    padding-inline: var(--qdb-side-pad);
    display: grid;
    /* Auto-fit 65ch min columns to maintain readable line length */
    grid-template-columns: repeat(auto-fit, minmax(65ch, 1fr));
    gap: 0 24px;
    grid-auto-flow: row;
  }

  /* Header/meta/controls span full width; verses flow into columns */
  .wp-block-qdb-sura :is(.sura_header, .sura_meta, .qdb-controls-row, .sura_header-player) {
    grid-column: 1 / -1;
  }

  .wp-block-qdb-sura .quran_aya {
    width: 100%;
  }

  .wp-block-qdb-sura .quran_aya .ayah_text,
  .wp-block-qdb-sura .quran_aya .ayah_en_text {
    max-inline-size: 85ch;
  }
}

/* Make header full-bleed across the viewport to ensure 100% width visually */
.wp-block-qdb-sura .sura_header--blue {
  width: 100%;
  max-width: 100%;
  margin-inline-start: 0;
  margin-inline-end: 0;
  background: var(--qdb-header-blue, #0b61a4);
  color: #fff;
  border-radius: 4px;
  border-bottom: 0;
  padding: 0;
  position: sticky;
  top: max(env(safe-area-inset-top), 0px);
  z-index: var(--z-header, 100);
}

body.admin-bar .wp-block-qdb-sura .sura_header--blue {
  top: calc(max(env(safe-area-inset-top), 0px) + 32px);
}

@media (max-width: 782px) {
  body.admin-bar .wp-block-qdb-sura .sura_header--blue {
    top: calc(max(env(safe-area-inset-top), 0px) + 46px);
  }
}

/* Container-level variables for Sura pages */
.wp-block-qdb-sura .quran-db-container {
  /* SoundCloud height tuned for iOS */
  --sc-height: 20px;
  --qdb-sticky-offset: calc(60px + var(--sc-height));
  --qdb-ar-size: calc(var(--qdb-ar-scale, 1) * 1.35rem);
  --qdb-en-size: calc(var(--qdb-en-scale, 1) * clamp(18px, 1.6vw, 22px));
}

/* Shortcode/seamless pages: ensure sticky works without block wrapper */
.quran-db-container .sura_header--blue {
  position: sticky;
  top: max(env(safe-area-inset-top), 0px);
  z-index: var(--z-header, 100);
}

body.admin-bar .quran-db-container .sura_header--blue {
  top: calc(max(env(safe-area-inset-top), 0px) + 32px);
}

/* Fixed fallback when native sticky is neutralized by theme containers; keep fixed header above others */
.wp-block-qdb-sura .sura_header--fixed {
  position: fixed;
  top: max(env(safe-area-inset-top), 0px);
  z-index: var(--z-header-fixed, 120);
}

body.admin-bar .wp-block-qdb-sura .sura_header--fixed {
  top: calc(max(env(safe-area-inset-top), 0px) + 32px);
}

@media (max-width: 782px) {
  body.admin-bar .wp-block-qdb-sura .sura_header--fixed {
    top: calc(max(env(safe-area-inset-top), 0px) + 46px);
  }
}

/* Shortcode/seamless fixed */
.quran-db-container .sura_header--fixed {
  position: fixed;
  top: max(env(safe-area-inset-top), 0px);
  z-index: var(--z-header-fixed, 120);
}

body.admin-bar .quran-db-container .sura_header--fixed {
  top: calc(max(env(safe-area-inset-top), 0px) + 32px);
}

@media (max-width: 782px) {
  body.admin-bar .quran-db-container .sura_header--fixed {
    top: calc(max(env(safe-area-inset-top), 0px) + 46px);
  }
}

.wp-block-qdb-sura .quran-db-container.qdb-header-fixed-mode {
  padding-top: var(--qdb-sticky-offset);
}

/* Shortcode pages (no block wrapper) */
.quran-db-container.qdb-header-fixed-mode {
  padding-top: var(--qdb-sticky-offset);
}

/* Remove legacy flex header overrides in favor of grid-based header layout */
.wp-block-qdb-sura .sura_header .qdb-sura-numwrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: top;
  font-size: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 0;
  margin-top: calc(var(--hdr-pad-block, 0.35rem) * -1);
  padding-top: 0;
  margin-inline-end: 4px;
}

.wp-block-qdb-sura .sura_header .qdb-sura-bookmark {
  display: block;
  color: #000;
  line-height: 1;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  font-size: 2em;
  top: -0.35em;
  opacity: 1;
  pointer-events: none;
}

.wp-block-qdb-sura .sura_header .qdb-sura-bookmark svg {
  display: block;
  width: 1em;
  height: 1em;
}

.wp-block-qdb-sura .sura_header-initials {
  position: relative;
  margin: 0;
  grid-area: seal;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  --seal-size: clamp(22px, 5.2vw, 34px);
  width: var(--seal-size);
  height: var(--seal-size);
  padding: 0;
  border-radius: 999px;
  background: none;
  background-image: var(--wax-url);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #4a3700;
  font-weight: 700;
  font-size: clamp(.52rem, 1.55vw, .68rem);
  line-height: 1;
  direction: rtl;
  font-family: 'hafs18', serif;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  box-sizing: border-box;
  padding-inline: 0.18em;
  border: none;
  box-shadow: none;
  z-index: var(--z-initials, 3);
  pointer-events: none;
}

.wp-block-qdb-sura .sura_meta,
.wp-block-qdb-sura .sura_meta-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  white-space: normal;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.wp-block-qdb-sura .sura_meta {
  margin: .5rem 0 1rem;
  color: #1a3a4a;
  font-weight: 600;
}

.wp-block-qdb-sura .sura_meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  white-space: normal;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.wp-block-qdb-sura .sura_meta-line span {
  background: #eef5fb;
  padding: .25rem .5rem;
  border-radius: 4px;
  font-size: .95rem;
  color: #1a3a4a;
  font-weight: 600;
}

.wp-block-qdb-sura .sura_meta-initials {
  margin-top: .35rem;
}

.wp-block-qdb-sura .sura_meta-row>* {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

/* Typography overrides for Sura block (larger sizes for full pages) */
.wp-block-qdb-sura .quran_ar .ayah_text {
  font-size: var(--qdb-ar-size, calc(var(--qdb-ar-scale, 1) * clamp(1.5rem, calc(1rem + 1.2vw), 2.3rem)));
}

.wp-block-qdb-sura .quran_en .ayah_en_text {
  font-size: var(--qdb-en-size, calc(var(--qdb-en-scale, 1) * clamp(1rem, 1.4vw, 1.25rem)));
  color: #000000;
}

/* Urdu exception: restore Nastaliq font, size and line-height inside the sura block */
.wp-block-qdb-sura .quran_en .ayah_en_text[data-lang=ur] {
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif !important;
  line-height: 2.4 !important;
  direction: rtl !important;
  text-align: right !important;
}

/* Farsi exception: restore Scheherazade font and RTL alignment inside the sura block */
.wp-block-qdb-sura .quran_en .ayah_en_text[data-lang=fa] {
  font-family: 'Scheherazade New', serif !important;
  line-height: 2.0 !important;
  direction: rtl !important;
  text-align: right !important;
}

/* Stat ribbon chip colors and tooltips */
.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComVerNum {
  --chip-bg: #666666;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComIntUnintVerNum {
  --chip-bg: #834E18;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevVerNum {
  --chip-bg: #9D0600;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevVerIntunintVerNum {
  --chip-bg: #FF791F;
  background: var(--chip-bg);
  color: #111111;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComVerWG {
  --chip-bg: #0B5292;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComFreqWG {
  --chip-bg: #115898;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevVerWG {
  --chip-bg: #654DA4;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevFreqWG {
  --chip-bg: #6350A6;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComIntUnintWG {
  --chip-bg: #4A8ECB;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComFreqIntUnintWG {
  --chip-bg: #4488C6;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevVerInUninWG {
  --chip-bg: #ABB2EA;
  background: var(--chip-bg);
  color: #111111;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .RevFreqInUninWG {
  --chip-bg: #9DA6D9;
  background: var(--chip-bg);
  color: #111111;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .ComPrimeComposite {
  --chip-bg: #274E13;
  background: var(--chip-bg);
  color: #ffffff;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .qdb-vsr-seg {
  position: relative;
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .qdb-vsr-seg:hover::after {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 100%;
  transform: none;
  white-space: nowrap;
  background: var(--chip-bg, rgba(0, 0, 0, .85));
  color: #ffffff;
  padding: .25rem .4rem;
  border-radius: 3px;
  font-size: .75rem;
  line-height: 1;
  content: '';
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 2px 6px rgba(0, 0, 0, .2);
}

.wp-block-qdb-sura .qdb-verse-stat-ribbon .qdb-vsr-seg[data-tip]:hover::after {
  content: attr(data-tip) !important;
}

.wp-block-qdb-sura .sura_header--compact .sura-num {
  font-size: 1.25rem;
}

.wp-block-qdb-sura .sura_header--compact .sura-phon {
  font-size: .9rem;
  margin-top: .2rem;
  transform: translateY(-1px);
}

.wp-block-qdb-sura .sura_header--compact .sura-en {
  font-size: 26px;
}

.wp-block-qdb-sura .sura_header--compact .sura_name_img {
  max-height: 84px;
  max-width: min(50vw, 340px);
}

.wp-block-qdb-sura .sura_header--compact .qdb-sura-numwrap {
  font-size: clamp(1rem, 3vw, 1.35rem);
  margin-bottom: .15rem;
}

/* Content visibility optimization (Sura pages only) */
@supports (content-visibility: auto) {
  .wp-block-qdb-sura .quran_aya {
    content-visibility: visible;
    contain-intrinsic-size: 0 28rem;
  }
}

/* Responsive line-height adjustments (Sura pages only) */
@media (max-width: 600px) {
  .wp-block-qdb-sura .quran_ar .ayah_text {
    line-height: 1.9;
  }

  .wp-block-qdb-sura .quran_en .ayah_en_text {
    line-height: 1.55;
  }

  /* Urdu: keep Nastaliq line-height on small screens */
  .wp-block-qdb-sura .quran_en .ayah_en_text[data-lang=ur] {
    line-height: 2.4 !important;
  }
}

/* Controls row */
.wp-block-qdb-sura .qdb-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin: .75rem 0;
  font-family: inherit;
  background: var(--qdb-controls-bg, #f6f7f7);
  border: 1px solid var(--qdb-controls-border, #e3e5e8);
  padding: .5rem .75rem;
  border-radius: 6px;
}

.wp-block-qdb-sura .qdb-controls-row :is(.qdb-font-controls, #qdb-view-selector, .qdb-view-toggle-wrapper, .qdb-reciter-select) {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}

.wp-block-qdb-sura .qdb-controls-row #qdb-view-selector label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.wp-block-qdb-sura .qdb-view-toggle-wrapper {
  order: 1;
  flex: 1 1 auto;
}

.wp-block-qdb-sura .qdb-controls-row .qdb-label {
  margin-right: .25rem;
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1;
}

.wp-block-qdb-sura .qdb-view {
  display: inline-flex;
  gap: 1rem;
  align-items: center;
  margin: 0;
}

.wp-block-qdb-sura .qdb-reciter-select {
  margin: 0;
}

.wp-block-qdb-sura .qdb-controls-row .qdb-reciter-select {
  order: 0;
}

.wp-block-qdb-sura .qdb-controls-row #qdb-view-selector {
  order: 1;
  flex: 1 1 auto;
}

.wp-block-qdb-sura .qdb-controls-row .qdb-font-controls {
  order: 2;
  margin-inline-start: auto;
}

/* Font control buttons styling */
.wp-block-qdb-sura .qdb-font-controls .button {
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  border-radius: 6px;
  border: 2px solid #0b61a4;
  background: #ffffff;
  color: #0b61a4;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-block-qdb-sura .qdb-font-controls .button:hover {
  background: #0b61a4;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(11, 97, 164, 0.3);
}

.wp-block-qdb-sura .qdb-font-controls .button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .wp-block-qdb-sura .qdb-controls-row {
    gap: .5rem .75rem;
  }

  .wp-block-qdb-sura .qdb-controls-row #qdb-view-selector {
    flex: 1 1 100%;
    order: 2;
  }

  .wp-block-qdb-sura .qdb-view-toggle-wrapper {
    flex: 1 1 100%;
    order: 2;
  }

  .wp-block-qdb-sura .qdb-controls-row .qdb-font-controls {
    order: 3;
    width: auto;
    margin-left: 0;
  }
}

/* SoundCloud embed (header margin only) */
.wp-block-qdb-sura .sura_header {
  margin-bottom: 0;
}


/* Fallback Arabic name spans */
.wp-block-qdb-sura .sura_name_ar_fallback {
  display: inline-block;
  font-family: 'me_quran_new', 'hafs18', serif;
  font-size: 2rem;
  color: #fff;
}

.wp-block-qdb-sura .qdb-sura-name-fallback {
  display: none;
  font-family: 'me_quran_new', 'hafs18', serif;
  font-size: 1rem;
  color: #fff;
}

/* Shortcode/seamless containers that disable header image */
.quran-db-container[data-no-img] .sura_name_img {
  display: none;
}

.quran-db-container[data-no-img] .sura_name_ar_fallback {
  display: inline-block;
}

/* TEMP: hide sura image across all contexts (block + seamless) */
.wp-block-qdb-sura .sura_name_img,
.quran-db-container .sura_name_img {
  display: none;
}

.wp-block-qdb-sura .sura_name_ar_fallback,
.quran-db-container .sura_name_ar_fallback {
  display: inline-block;
}

/* Header Search Drawer (global overlay; keep selectors global so it applies when injected at body) */
.qdb-shs-trigger {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: var(--shs-size);
  height: var(--shs-size);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .7);
  background: #ffffff;
  color: #124e7f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-search-trigger, 40);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.qdb-shs-trigger:hover {
  background: #f7fbff;
}

.qdb-shs-trigger svg {
  display: block;
  width: calc(var(--shs-size) * 0.62);
  height: calc(var(--shs-size) * 0.62);
}

#qdb-shs-drawer.qdb-shs-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-search-drawer, 1000);
  background: #6b7280;
  border-bottom: 1px solid #4b5563;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  padding: .25rem .375rem;
  display: block;
  /* Ensure visible when not hidden */
}

/* Hide drawer when hidden attribute is present */
#qdb-shs-drawer.qdb-shs-drawer[hidden] {
  display: none !important;
}

.qdb-shs-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap;
}

.qdb-shs-inner .qdb-sura-header-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.qdb-shs-inner .qdb-sura-header-search #qdbps_q {
  flex: 1 1 auto;
  min-width: 160px;
  font-size: 16px;
}

.qdb-shs-inner #qdbps_results {
  white-space: nowrap;
  font-size: .95rem;
  color: #ffffff;
  font-weight: 600;
}

.qdb-shs-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-inline-start: auto;
}

.qdb-shs-actions .button {
  min-width: 58px;
}

@media (max-width: 720px) {
  #qdb-shs-drawer.qdb-shs-drawer {
    padding: .25rem .25rem;
  }

  .qdb-shs-inner {
    flex-wrap: nowrap;
    gap: .35rem;
  }

  .qdb-shs-actions {
    margin-inline-start: 0;
    order: 2;
    width: auto;
    justify-content: flex-end;
    gap: .35rem;
  }

  .qdb-shs-actions .button {
    min-height: 44px;
    padding: .35rem .5rem;
    font-size: 14px;
    min-width: 40px;
  }

  .qdb-shs-inner .qdb-sura-header-search {
    flex: 0 1 auto;
    order: 1;
    max-width: 50%;
  }

  .qdb-shs-inner .qdb-sura-header-search #qdbps_q {
    flex: 1 1 auto;
    min-width: 100px;
    max-width: 100%;
    height: 44px;
    padding: .35rem .5rem;
    border-radius: 8px;
    font-size: 14px;
    color: #000000;
  }

  .qdb-shs-inner .qdb-sura-header-search #qdbps_btn {
    padding: .35rem .5rem;
    font-size: 14px;
  }

  .qdb-shs-inner #qdbps_results {
    white-space: nowrap;
    font-size: .95rem;
    font-weight: 700;
    color: #ffffff;
    max-width: none;
    overflow: visible;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* Small phones: make the search trigger slightly smaller and nudge it up/right */
@media (max-width: 400px) {
  .wp-block-qdb-sura {
    --shs-size: 24px;
  }

  .qdb-shs-trigger {
    top: .35rem;
    right: .35rem;
  }

  #qdb-shs-drawer.qdb-shs-drawer {
    padding: .25rem .2rem;
  }

  .qdb-shs-inner .qdb-sura-header-search #qdbps_q {
    height: 44px;
    color: #000000;
  }

  .qdb-shs-inner #qdbps_results {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* --- From V7 style.css: Simple View Toggle --- */
/* Simple View: collapse ribbon to Sura:Verse only */
:where(.qdb-view--simple .qdb-verse-stat-ribbon) {
  display: block;
  margin: calc(.25rem + 2px) 0 .35rem;
  padding: .25rem 0 .1rem;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg:not(.SuraVerse)) {
  display: none;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg.SuraVerse) {
  background: transparent;
  box-shadow: none;
  padding: 0;
  height: auto;
  line-height: 1.2;
  border-radius: 0;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg.SuraVerse > strong) {
  display: inline;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.3;
}

:where(.qdb-view--simple .qdb-verse-stat-ribbon .qdb-vsr-seg:hover::after) {
  text-overflow: ellipsis;
}

/* GOD WORD TOOLTIPS (Multi-Colored HTML)
============================================ */
.qdb-allah-word,
.qdb-god-word {
  position: relative;
  cursor: pointer;
  /* Removed question mark */
}

/* Hide tooltip by default */
.qdb-god-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  /* Removed black background/shadow/padding */
  background: transparent;
  padding: 0;
  box-shadow: none;
  z-index: 20;
  margin-bottom: 4px;
  white-space: nowrap;
  gap: 2px;
  /* Tighter gap */
  pointer-events: none;
}

/* Show on hover */
.qdb-allah-word:hover .qdb-god-tooltip,
.qdb-god-word:hover .qdb-god-tooltip {
  display: flex;
}

/* Tooltip Chips */
.qdb-tip-chip {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  color: #ffffff;
  font-family: inherit;
  /* Match ribbon font */
  font-size: 0.85rem;
  /* Match ribbon size approx */
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  /* Add shadow to chips since container has none */
}

/* Chip Colors (Matching Stat Ribbon) */
.qdb-tip-com {
  background-color: #115898;
}

/* Compilation Freq */
.qdb-tip-rev {
  background-color: #6350A6;
}

/* Revelation Freq */
.qdb-tip-com-init {
  background-color: #4488C6;
}

/* Comp. Initialed */
.qdb-tip-rev-init {
  background-color: #9DA6D9;
}

.qdb-bg-blue-700 {
  background-color: #1d4ed8;
}

.qdb-hover\:bg-blue-800:hover {
  background-color: #1e40af;
}

.qdb-bg-gray-700 {
  background-color: #374151;
}

.qdb-hover\:bg-gray-800:hover {
  background-color: #1f2937;
}

.qdb-bg-gray-200 {
  background-color: #e5e7eb;
}

/* Fallback */

.qdb-text-white {
  color: #ffffff;
}

.qdb-text-black {
  color: #000000;
}

.qdb-text-gray-600 {
  color: #4b5563;
}

.qdb-text-gray-800 {
  color: #1f2937;
}

.qdb-hover\:text-red-600:hover {
  color: #dc2626;
}

.qdb-border {
  border-width: 1px;
}

.qdb-border-gray-400 {
  border-color: #9ca3af;
}

.qdb-rounded-lg {
  border-radius: 0.5rem;
}

.qdb-rounded-full {
  border-radius: 9999px;
}

.qdb-font-bold {
  font-weight: 700;
}

.qdb-font-semibold {
  font-weight: 600;
}

.qdb-text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.qdb-text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.qdb-whitespace-nowrap {
  white-space: nowrap;
}

.qdb-transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.qdb-disabled\:opacity-50:disabled {
  opacity: 0.5;
}

.qdb-disabled\:cursor-not-allowed:disabled {
  cursor: not-allowed;
}

/* Arbitrary values */
.qdb-max-w-5xl {
  max-width: 64rem;
}

.qdb-min-w-\[200px\] {
  min-width: 200px;
}

.qdb-min-w-\[80px\] {
  min-width: 80px;
}

/* ============================================
   GOD WORD TOOLTIPS (Multi-Colored HTML)
   ============================================ */
.qdb-allah-word,
.qdb-god-word {
  position: relative;
  cursor: pointer;
}

/* Hide tooltip by default */
.qdb-god-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  background: transparent;
  padding: 0;
  box-shadow: none;
  z-index: 20;
  margin-bottom: 4px;
  white-space: nowrap;
  gap: 2px;
  pointer-events: none;
}

/* Show on hover */
.qdb-allah-word:hover .qdb-god-tooltip,
.qdb-god-word:hover .qdb-god-tooltip {
  display: flex;
}

/* Tooltip Chips */
.qdb-tip-chip {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Chip Colors (Matching Stat Ribbon) */
.qdb-tip-com {
  background-color: #115898;
}

/* Compilation Freq */
.qdb-tip-rev {
  background-color: #6350A6;
}

/* Revelation Freq */
.qdb-tip-com-init {
  background-color: #4488C6;
}

/* Comp. Initialed */
.qdb-tip-rev-init {
  background-color: #9DA6D9;
  color: #111;
}

/* ============================================
   SEARCH HIGHLIGHTING
   ============================================ */
mark.qdb-find {
  background-color: #fff9c4;
  /* Light yellow */
  color: inherit;
  padding: 0;
  border-radius: 2px;
}

mark.qdb-find--active {
  background-color: #ffeb3b !important;
  /* Strong Yellow (V7) */
  color: #000 !important;
  outline: 2px solid #f9a825;
  box-shadow: 0 0 8px rgba(255, 235, 59, 0.8);
  font-weight: bold;
  z-index: 10;
  position: relative;
  border-radius: 3px;
}

/* Hide "proudly powered by WordPress" footer text */
p:has-text("proudly powered"),
p:has-text("The Quran is proudly"),
*:has-text("All 114 Suras loaded") {
  display: none !important;
}

/* Alternative: Hide by content matching */
.site-footer p:contains("proudly powered"),
.site-footer p:contains("The Quran is proudly"),
footer p:contains("proudly powered"),
footer p:contains("The Quran is proudly"),
.qdb-seamless-complete {
  display: none !important;
  visibility: hidden !important;
}

/* --- Requested Fixes --- */

/* 1. Fonts */
.ayah_text {
  font-family: 'me_quran_new', 'hafs18', serif !important;
  font-size: 1.6em;
}

.numbering {
  font-family: 'hafs18', serif !important;
  font-size: 1.5em;
  margin-right: 0.25em;
}

/* 2. God Word Highlight */
.qdb-allah-word,
.qdb-god-word {
  color: #0b61a4 !important;
  font-weight: 700 !important;
}

/* 3. Meta Alignment */
.sura_meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}