/* ════════════════════════════════════════════════════════
   SHARE BOTTOM SHEET
════════════════════════════════════════════════════════ */

/* Overlay behind sheet */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.share-overlay.visible { opacity: 1; }
.share-overlay.hidden { display: none; }

/* Sheet container */
.share-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  z-index: 51;
  padding: 12px 20px 28px;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  max-height: 85vh;
  overflow-y: auto;
}
.share-sheet.visible { transform: translateY(0); }
.share-sheet.hidden { display: none; }

/* Sheet header (handle + close) */
.share-sheet-header {
  position: relative;
  padding-bottom: 8px;
}
.share-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto;
}
.share-sheet-close {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.share-sheet-close:active { background: rgba(0,0,0,0.06); }

/* Live preview */
.share-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  gap: 8px;
}
.share-preview-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
}
.share-preview {
  width: 60%;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  overflow: hidden;
  position: relative;
  background: #FFFFFF;
}
.share-preview.ratio-story { width: 40%; }
.share-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Section labels */
.share-section {
  margin-bottom: 16px;
}
.share-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Theme picker pills */
.share-theme-picker {
  display: flex;
  gap: 8px;
}
.theme-pill {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-pill.active {
  background: var(--teal-dark);
  color: #FFFFFF;
  border-color: var(--teal-dark);
}

/* Content toggles */
.share-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--text-mid);
  cursor: pointer;
}
.share-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal-dark);
  cursor: pointer;
}

/* Platform buttons grid */
.share-platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: background 0.15s ease;
}
.share-platform-btn:active {
  background: rgba(0,0,0,0.04);
}
.share-platform-btn svg {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

/* ── Share Panel Structure ── */
.share-panel { /* panels inside share-sheet (A, B-Image, B-Text) */ }

/* ── Panel A — Mode Select ── */
.share-panel-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text-dark);
}
.share-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.share-mode-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.share-mode-btn:active {
  background: rgba(201,168,76,0.06);
  border-color: var(--gold);
}
.share-mode-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}
.share-mode-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  display: block;
}
.share-mode-desc {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Back button (used in Panel B-Image and Panel B-Text) ── */
.share-back-btn {
  background: none;
  border: none;
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.share-back-btn:active { opacity: 0.6; }
.share-back-btn svg { flex-shrink: 0; }

/* ── Panel B-Text — Toggle rows ── */
.share-toggles {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.share-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(226,232,240,0.5);
  gap: 12px;
}
.share-toggle-row:last-child { border-bottom: none; }
.share-toggle-info {
  flex: 1;
  min-width: 0;
}
.share-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  display: block;
}
.share-toggle-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* iOS-style toggle switch */
.share-toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.share-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.share-toggle-switch .toggle-slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.share-toggle-switch .toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.share-toggle-switch input:checked + .toggle-slider {
  background: var(--teal-dark);
}
.share-toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Tafsir sub-radio (visible only when tafsir toggle ON) */
.share-tafsir-sub {
  padding: 4px 0 8px 0;
  display: flex;
  gap: 16px;
}
.share-tafsir-sub label {
  font-size: 12px;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.share-tafsir-sub input[type="radio"] {
  accent-color: var(--teal-dark);
  margin: 0;
  width: 14px;
  height: 14px;
}
.share-tafsir-note {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 0 8px;
  line-height: 1.4;
}

/* ── Panel B-Text — Preview bubble ── */
.share-preview-bubble {
  position: relative;
  background: rgba(10,92,122,0.05);
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
  max-height: 130px;
  overflow: hidden;
}
.share-preview-text {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-mid);
  white-space: pre-wrap;
  direction: auto;
  unicode-bidi: plaintext;
}
.share-preview-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, rgba(10,92,122,0.05));
  pointer-events: none;
}

/* ── Panel B-Text — Send / copy row ── */
.share-send-row {
  display: flex;
  gap: 10px;
}
.share-btn-wa {
  flex: 1;
  background: var(--teal-dark);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.share-btn-wa:active { opacity: 0.8; }
.share-btn-copy {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.share-btn-copy:active {
  background: rgba(0,0,0,0.04);
  border-color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════
   SHARE IMAGE RENDER (off-screen, captured by html2canvas)
════════════════════════════════════════════════════════ */
.share-render {
  position: fixed;
  top: -9999px;
  left: -9999px;
  pointer-events: none;
}

/* Share image template (built dynamically in JS) */
.si-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  padding: 8% 12%;
  position: relative;
}
.si-question {
  font-size: 16px;
  font-style: italic;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6;
  max-width: 85%;
}
.si-arabic {
  font-family: 'Amiri', serif;
  font-size: 32px;
  line-height: 2.1;
  direction: rtl;
  text-align: center;
  width: 100%;
  max-width: 92%;
  margin-bottom: 20px;
}
.si-translation {
  font-size: 15px;
  line-height: 1.85;
  text-align: center;
  font-style: italic;
  margin-bottom: 16px;
  max-width: 90%;
}
.si-ref {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 16px;
  display: inline-block;
}
/* ── Share image header (branding at top) ── */
.si-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  width: 100%;
}
.si-header-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.si-header-sub {
  font-size: 12px;
  font-weight: 400;
  margin-top: 4px;
  letter-spacing: 0.2px;
}
.si-header-divider {
  width: 40px;
  height: 2px;
  border-radius: 1px;
  margin-top: 16px;
}

/* ── Share image theme: Light ── */
.si-theme-light { background: #FFFFFF; }
.si-theme-light .si-header-brand { color: #2A7C6F; }
.si-theme-light .si-header-sub { color: #AAAAAA; }
.si-theme-light .si-header-divider { background: rgba(42,124,111,0.25); }
.si-theme-light .si-question { color: #999999; }
.si-theme-light .si-arabic { color: #1A1A1A; }
.si-theme-light .si-translation { color: #1A1A1A; }
.si-theme-light .si-ref { color: var(--teal-dark); background: rgba(42,124,111,0.08); }

/* ── Share image theme: Dark ── */
.si-theme-dark { background: #1A1D2E; }
.si-theme-dark .si-header-brand { color: #C9A84C; }
.si-theme-dark .si-header-sub { color: rgba(255,255,255,0.4); }
.si-theme-dark .si-header-divider { background: rgba(201,168,76,0.3); }
.si-theme-dark .si-question { color: #808090; }
.si-theme-dark .si-arabic { color: #FFFFFF; }
.si-theme-dark .si-translation { color: #F0F0F0; }
.si-theme-dark .si-ref { color: #C9A84C; background: rgba(196,152,59,0.12); }

/* ── Share image theme: Classic ── */
.si-theme-classic { background: #F5EFE0; }
.si-theme-classic .si-header-brand { color: #8B6F47; }
.si-theme-classic .si-header-sub { color: rgba(61,50,37,0.4); }
.si-theme-classic .si-header-divider { background: rgba(139,111,71,0.25); }
.si-theme-classic .si-question { color: #A89880; }
.si-theme-classic .si-arabic { color: #2A1F14; }
.si-theme-classic .si-translation { color: #3D3225; }
.si-theme-classic .si-ref { color: #8B6F47; background: rgba(139,111,71,0.10); }

/* ════════════════════════════════════════════════════════
   VERSE ACTION ROW — side-by-side share + audio buttons
════════════════════════════════════════════════════════ */
.vc-action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.vc-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.vc-action-btn:active { transform: scale(0.97); background: rgba(0,0,0,0.03); }
.vc-action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.vc-action-btn.playing { color: var(--teal-dark); border-color: var(--teal-dark); background: rgba(10,92,122,0.06); }

/* ════════════════════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }
