/* ═══════════════════════════════════════════════════════════
   engine/css/overlays.css — Splash, toasts, settings, and modals
═══════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────
   SPLASH OVERLAY
─────────────────────────────────────── */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.splash-overlay--fade {
  opacity: 0;
}

.splash-logo {
  width: 180px;
  height: auto;
}

.splash-logo--dark  { display: none; }

@media (prefers-color-scheme: dark) {
  .splash-logo--light { display: none; }
  .splash-logo--dark  { display: block; }
}

.splash-tagline {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ───────────────────────────────────────
   TOAST
─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 500;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  background: var(--text);
  color: var(--bg-card);
  box-shadow: var(--shadow-modal);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--error   { background: #b91c1c; color: #fff; }
.toast--success { background: var(--accent); color: #fff; }

.toast--loading {
  padding-left: 34px;
}

.toast--loading::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: toast-spin 0.65s linear infinite;
}

@keyframes toast-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ───────────────────────────────────────
   SETTINGS DROPDOWN
─────────────────────────────────────── */
.settings-menu {
  position: relative;
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 200;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.setting-row--wrap {
  flex-wrap: wrap;
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-mini {
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-mini:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-mini--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-mini:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.font-readout {
  font-size: 12px;
  color: var(--text-3);
  min-width: 36px;
  text-align: center;
}

.setting-select {
  font-size: 13px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  min-width: 0;
  max-width: 55%;
}

.setting-pills {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-layer);
  padding: 4px 10px;
  border-radius: 99px;
  width: fit-content;
}

.setting-row--signout {
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
}

.btn-signout {
  width: 100%;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  cursor: pointer;
}

.btn-signout:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ───────────────────────────────────────
   AUTH MODAL
─────────────────────────────────────── */

.auth-logo {
  height: 24px;
  width: auto;
  margin-right: auto;
}

.auth-logo--dark  { display: none; }

@media (prefers-color-scheme: dark) {
  .auth-logo--light { display: none; }
  .auth-logo--dark  { display: block; }
}

.modal-body--auth {
  padding: 16px 18px 20px;
}

.auth-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-instruction {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
  text-align: center;
}

.auth-input {
  width: 100%;
  padding: 9px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
  letter-spacing: 0.03em;
}

.auth-input::placeholder {
  color: var(--text-3);
  letter-spacing: 0;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
  width: 100%;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
  cursor: pointer;
  border: none;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-alt {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

.link-btn {
  color: var(--accent-text);
  font-size: inherit;
  font-family: inherit;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: var(--accent);
}

/* ───────────────────────────────────────
   AUDIO MODAL
─────────────────────────────────────── */
.audio-modal-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0;
}

.audio-modal-controls .chip {
  width: 44px;
  height: 44px;
}

.audio-modal-controls .chip .icon {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

.audio-modal-controls .chip--audio-active .icon { opacity: 1; }

/* ───────────────────────────────────────
   NEWS MODAL
─────────────────────────────────────── */
.modal--news {
  align-items: stretch;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.modal--news .modal-sheet {
  max-height: 100%;
  border-radius: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  .modal--news {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal--news .modal-sheet {
    max-width: 900px;
    max-height: calc(100vh - 48px);
    border-radius: var(--radius, 12px);
    flex: none;
    width: 100%;
  }
}

.news-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  min-height: 0;
}

/* ───────────────────────────────────────
   LIBRARY / CLASSROOM MODALS
─────────────────────────────────────── */
.modal--library,
.modal--classroom {
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

.modal--library .modal-sheet,
.modal--classroom .modal-sheet {
  width: 100%;
  height: 100%;
  max-width: 960px;
  max-height: 90vh;
  border-radius: var(--radius, 12px);
  display: flex;
  flex-direction: column;
}

.app-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  min-height: 0;
}

/* ───────────────────────────────────────
   CAMERA MODAL
─────────────────────────────────────── */
.modal--camera {
  background: #000;
  align-items: stretch;
}

.modal--camera .modal-sheet {
  display: none;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 60px 24px 100px;
  pointer-events: none;
}

.camera-hint {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.viewfinder {
  width: clamp(260px, 72vw, 620px);
  aspect-ratio: 3 / 1.2;
  position: relative;
}

.vf-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #fff;
  border-style: solid;
  opacity: 0.9;
}

.vf-corner--tl { top: 0; left: 0;  border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.vf-corner--tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.vf-corner--bl { bottom: 0; left: 0;  border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.vf-corner--br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

.modal-close--overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.camera-shutter {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 3px solid rgba(255,255,255,0.8);
  transition: background 0.12s, transform 0.1s;
  pointer-events: all;
}

.camera-shutter::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
}

.camera-shutter:active {
  transform: translateX(-50%) scale(0.93);
  background: rgba(255,255,255,0.3);
}

/* ───────────────────────────────────────
   TRANSLATION PICKER MODAL
─────────────────────────────────────── */
.translation-label--btn {
  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: background 0.12s;
}

.translation-label--btn:hover {
  background: var(--accent-soft);
}

.translation-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
}

.translation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.translation-item:hover:not([aria-disabled="true"]) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.translation-item--active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.translation-item--locked {
  opacity: 0.6;
  cursor: default;
}

.translation-item__abbr {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  min-width: 44px;
  flex-shrink: 0;
}

.translation-item__label {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.3;
}

.translation-item__badge {
  flex-shrink: 0;
}

.t-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.t-badge--active {
  background: var(--accent);
  color: #fff;
}

.t-badge--free {
  background: var(--bg-layer);
  color: var(--text-3);
}

.t-badge--locked {
  background: var(--navy);
  color: #fff;
}

/* ───────────────────────────────────────
   READING VIEW MODAL
─────────────────────────────────────── */

/* Chapter headings visible for structure but don't stick in reading mode */
.reading-body .chapter-heading {
  position: static;
}

.modal--reading {
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

.modal--reading .reading-sheet {
  width: 100%;
  height: 90vh;
  max-width: 700px;
  max-height: 90vh;
  border-radius: var(--radius);
}

.reading-body {
  padding: 28px 32px;
  font-family: var(--font-verse);
  font-size: 18px;
  line-height: 1.9;
  color: var(--text);
}

.reading-paragraph {
  margin: 0 0 0.6em;
  text-indent: 1.5em;
}

.reading-paragraph:first-child {
  text-indent: 0;
}

.reading-verse {
  display: inline;
}

/* Verse-by-verse mode for the reader */
.reading-body--verse-mode .reading-paragraph {
  text-indent: 0;
  margin-bottom: 0;
}

.reading-body--verse-mode .reading-verse {
  display: block;
  padding: 0.2em 0;
}

.reading-verse-num {
  font-size: 0.6em;
  font-weight: 700;
  color: var(--accent);
  margin-right: 1px;
  vertical-align: super;
  line-height: 0;
  user-select: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: opacity 0.12s;
}

.reading-verse-num:hover {
  opacity: 0.7;
}

@media (max-width: 480px) {
  .modal--reading {
    padding: 3vh 3vw;
  }

  .reading-body {
    padding: 20px 20px;
    font-size: 16px;
  }
}

/* ───────────────────────────────────────
   BOOK PICKER MODAL
─────────────────────────────────────── */

/* 5 category colors — OT and NT share the same 5 in order */
.bp-cat--pentateuch,
.bp-cat--gospels          { --bp-color: #8b6b14; --bp-bg: #fdf3d9; }

.bp-cat--ot-history,
.bp-cat--nt-history       { --bp-color: #8b3a1a; --bp-bg: #fdf0ea; }

.bp-cat--poetry,
.bp-cat--pauline          { --bp-color: #5a3a8b; --bp-bg: #f2ecf8; }

.bp-cat--major-prophets,
.bp-cat--general-epistles { --bp-color: #1c3a7a; --bp-bg: #eaf0f8; }

.bp-cat--minor-prophets,
.bp-cat--apocalyptic      { --bp-color: #1a5a3a; --bp-bg: #e8f5ee; }

@media (prefers-color-scheme: dark) {
  .bp-cat--pentateuch,
  .bp-cat--gospels          { --bp-color: #cda838; --bp-bg: #2a2008; }

  .bp-cat--ot-history,
  .bp-cat--nt-history       { --bp-color: #d47848; --bp-bg: #2a1408; }

  .bp-cat--poetry,
  .bp-cat--pauline          { --bp-color: #a87ad4; --bp-bg: #1e1228; }

  .bp-cat--major-prophets,
  .bp-cat--general-epistles { --bp-color: #7aaad4; --bp-bg: #0c1828; }

  .bp-cat--minor-prophets,
  .bp-cat--apocalyptic      { --bp-color: #7ad4a8; --bp-bg: #082818; }
}

.bp-section-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 16px 6px;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
}

.bp-section-header:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 8px;
}

.bp-chips {
  padding: 0 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bp-chip {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: var(--bp-bg);
  color: var(--bp-color);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.bp-chip:hover {
  background: var(--bp-color);
  color: var(--bg-raised);
}

/* Chapter grid */
.bp-chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 5px;
  padding: 8px;
}

.bp-chapter-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.bp-chapter-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.bp-chapter-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
