/* ── Shared parallel reading panel ──
   Used by the reader (base.html) and the crossref admin pages.
   All theme vars carry fallbacks so pages without :root definitions work.
   Pages with a fixed topbar should set --panel-top (base.html: 52px). */

/* This stylesheet is loaded via <link>, so it does NOT see base.html's :root
   block — its own var() fallbacks are the only defaults admin pages get.
   Mirror base.html's dark palette here so panel.css is self-sufficient. */
:root[data-theme="dark"] {
  --primary: #7fa8cc;
  --gold: #d4a017;
  --bg: #1c1a16;
  --surface: #262218;
  --text: #ede6d8;
  --muted: #a69c8c;
  --border: #3a342a;
  --highlight-bg: #5a4a16;
  --divider-light: #3a342a;
  --hover-tint: rgba(127,168,204,0.1);
  --panel-header-bg: #201d18;
}
:root {
  --panel-header-bg: #f9f9f7;
}

#mainWrap { transition: padding-right 0.25s, padding-bottom 0.25s; }

/* Printed-page markers ([p. N]) inserted into ministry chapter text. */
.mpg { font-size: 0.7em; color: var(--muted, #9a8f76); vertical-align: super; font-style: normal; font-family: Arial, sans-serif; white-space: nowrap; opacity: 0.8; margin: 0 1px; text-decoration: none; }
body.panel-active.panel-side   #mainWrap { padding-right: var(--panel-w, 420px); }
body.panel-active.panel-bottom #mainWrap { padding-bottom: var(--panel-h, 42vh); }

#sidePanel {
  position: fixed;
  top: var(--panel-top, 0px); right: 0; bottom: 0;
  width: 0;
  z-index: 600;
  background: var(--surface, #ffffff);
  border-left: 2px solid var(--gold, #b8860b);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  transition: width 0.25s;
  box-shadow: -3px 0 14px rgba(0,0,0,0.12);
}
body.panel-active.panel-side #sidePanel { width: min(var(--panel-w, 420px), 100vw); }

/* Phones: side-by-side can't fit — the panel becomes a full-width overlay
   so every header button stays reachable; bottom layout is the default. */
@media (max-width: 700px) {
  body.panel-active.panel-side #sidePanel { width: 100vw; border-left: none; }
  body.panel-active.panel-side #mainWrap { padding-right: 0; }
}

body.panel-bottom #sidePanel {
  top: auto; left: 0; right: 0; bottom: 0;
  width: 100%; height: 0;
  flex-direction: column;
  border-left: none;
  border-top: 2px solid var(--gold, #b8860b);
  box-shadow: 0 -3px 14px rgba(0,0,0,0.12);
  transition: height 0.25s;
}
body.panel-active.panel-bottom #sidePanel { height: var(--panel-h, 42vh); }

#panelResizer {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
}
#panelResizer:hover, #panelResizer.dragging { background: rgba(184,134,11,0.35); }
body.panel-bottom #panelResizer { width: 100%; height: 6px; cursor: row-resize; }

#panelInner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Stacked panels: primary + a secondary Bible panel ── */
#panelStack { flex: 1; display: flex; min-width: 0; min-height: 0; }
body.panel-side   #panelStack { flex-direction: column; }  /* stack top/bottom */
body.panel-bottom #panelStack { flex-direction: row; }     /* two columns */
#panelInner2 {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
body.panel2-active #panelInner2 { display: flex; }
body.panel-side.panel2-active   #panelInner2 { border-top: 2px solid var(--gold, #b8860b); }
body.panel-bottom.panel2-active #panelInner2 { border-left: 2px solid var(--gold, #b8860b); }
#panelHeader2 {
  background: var(--primary, #1a3a5c);
  color: white;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  font-family: Arial, sans-serif;
  font-size: 13px;
}
#panelTitle2 {
  font-weight: bold;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
#panelBody2 { flex: 1; overflow-y: auto; font-family: Georgia, 'Times New Roman', serif; }
#panelHeader {
  background: var(--primary, #1a3a5c);
  color: white;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  font-family: Arial, sans-serif;
  font-size: 13px;
}
#panelTitle {
  font-weight: bold;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
#panelActions { display: flex; gap: 4px; flex-shrink: 0; }
.panel-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  font-family: Arial, sans-serif;
}
.panel-btn:hover { background: rgba(255,255,255,0.3); }

#panelBody { flex: 1; overflow-y: auto; font-family: Georgia, 'Times New Roman', serif; }

/* Bible in panel */
.panel-bible { padding: 12px 16px 24px; }
.panel-verse {
  display: flex;
  gap: 8px;
  padding: 7px 6px;
  border-bottom: 1px solid var(--divider-light, #f0f0f0);
  line-height: 1.65;
  font-size: 15px;
  border-radius: 3px;
}
.panel-verse.highlighted {
  background: var(--highlight-bg, #fffde7);
  border-left: 3px solid var(--gold, #b8860b);
  padding-left: 10px;
}
.panel-verse-num {
  font-size: 11px;
  color: var(--muted, #6b6b6b);
  font-weight: bold;
  min-width: 22px;
  padding-top: 3px;
  font-family: Arial, sans-serif;
  flex-shrink: 0;
}
.panel-verse-text { flex: 1; }
.panel-verse-missing { color: var(--muted, #6b6b6b); font-style: italic; font-size: 13px; }

/* Book chapter in panel */
.panel-book-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border, #ddd);
  background: var(--panel-header-bg, #f9f9f7);
  flex-shrink: 0;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: var(--muted, #6b6b6b);
}
.panel-nav-btn {
  background: var(--bg, #f7f4ef);
  border: 1px solid var(--border, #ddd);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--primary, #1a3a5c);
  font-family: Arial, sans-serif;
}
.panel-nav-btn:hover { background: var(--primary, #1a3a5c); color: white; }
.panel-nav-btn:disabled { opacity: 0.4; cursor: default; }
.panel-nav-btn:disabled:hover { background: var(--bg, #f7f4ef); color: var(--primary, #1a3a5c); }

.panel-chapter-content {
  padding: 18px 20px 32px;
  font-size: 15px;
  line-height: 1.8;
}
.panel-chapter-title {
  font-size: 17px;
  color: var(--primary, #1a3a5c);
  border-bottom: 1px solid var(--gold, #b8860b);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.panel-chapter-content p { margin-bottom: 12px; }
.panel-chapter-content h1, .panel-chapter-content h2 { font-size: 17px; color: var(--primary, #1a3a5c); margin: 20px 0 8px; }
.panel-chapter-content h3, .panel-chapter-content h4 { font-size: 15px; color: var(--primary, #1a3a5c); margin: 16px 0 6px; }
.panel-chapter-content blockquote { border-left: 3px solid var(--gold, #b8860b); margin: 14px 0; padding: 8px 14px; background: rgba(184,134,11,0.05); font-style: italic; }
mark.panel-highlight { background: var(--highlight-bg, #fffde7); border-bottom: 2px solid var(--gold, #b8860b); padding: 1px 0; border-radius: 2px; }

.panel-loading {
  display: flex; align-items: center; justify-content: center;
  height: 80px; color: var(--muted, #6b6b6b);
  font-family: Arial, sans-serif; font-size: 14px; gap: 8px;
}
.panel-error { padding: 20px; color: var(--muted, #6b6b6b); font-family: Arial, sans-serif; font-size: 14px; }

/* ── "↑ Top" button (injected by panel.js on every page) ── */
#toTopFab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 250;             /* under page modal overlays (300) and the reading panel (600) */
  display: none;
  background: var(--primary, #1a3a5c);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  opacity: 0.92;
}
#toTopFab:hover { opacity: 1; }
#toTopFab.show { display: block; }
@media print { #toTopFab { display: none !important; } }

/* ── One-time toast: tells touch readers about the edge tap zones ──
   (shown by panel.js's showTapHintOnce — reader + Bible pages) */
.tap-hint-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
  background: rgba(26,58,92,0.94); color: #fff; font-family: Arial, sans-serif; font-size: 13.5px;
  padding: 10px 18px; border-radius: 20px; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  opacity: 0; transition: opacity .3s, transform .3s; z-index: 650; pointer-events: none;
  max-width: 90vw; text-align: center;
}
.tap-hint-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Soft outlined button — shared secondary-action look ──
   (hymns "← All hymns", Find "Previously answered" toggle) */
.soft-btn {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  color: var(--primary, #1a3a5c);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 14px;
  padding: 7px 14px;
}
.soft-btn:hover { border-color: var(--primary, #1a3a5c); background: var(--hover-tint, #fcfaf4); }
