/* ── 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). */

#mainWrap { transition: padding-right 0.25s, padding-bottom 0.25s; }
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;
}
#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 #f0f0f0;
  line-height: 1.65;
  font-size: 15px;
  border-radius: 3px;
}
.panel-verse.highlighted {
  background: #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: #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: #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; }
