@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

:root {
  --reader-font-size: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  background: #ffffff;
  color: #272a35;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: #cbd5f5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  .auth-top-controls {
    display: flex;
    align-items: center;
    gap: 12px;
  }
}

.topbar-search {
  flex: 1 1 320px;
  display: flex;
  justify-content: center;
  min-width: 220px;
}

.topbar-search input {
  width: min(100%, 420px);
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.topbar-search input::placeholder {
  color: #64748b;
}

.topbar-search input:focus {
  outline: none;
  border-color: #6366f1;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #f8fafc;
  color: #1f2937;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.nav-menu a:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  text-decoration: none;
}

.nav-menu a.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.25);
}

.menu-toggle {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1f2937;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-menu-popup {
  position: absolute;
  top: 64px;
  right: 24px;
  width: 240px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 1200;
}

.menu-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}
.menu-profile {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: 1px solid #5b21b6;
}

.menu-profile:hover {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  border-color: #7c3aed;
}

.menu-link:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.menu-logout {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.menu-logout:hover {
  background: #fecdd3;
  border-color: #f97316;
}

.brand {
  font-weight: 700;
  font-size: 20px;
}

.subtitle {
  color: #475569;
  font-size: 14px;
  margin-top: 4px;
}

.layout {
  width: min(1100px, 95%);
  margin: 32px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  flex: 1;
}

.page-shell {
  min-width: 1100px;
}

.panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.panel-body {
  margin-bottom: 12px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.auth-modal.show {
  display: flex;
}

.auth-modal-content {
  width: min(480px, 95%);
  max-width: 540px;
  margin: 0 auto;
}

.auth-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.auth-card.auth-top {
  margin-bottom: 0;
  min-width: 260px;
}

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

.auth-statusline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-title {
  font-weight: 600;
  color: #272a35;
}

.auth-user {
  color: #6366f1;
  font-size: 14px;
  font-weight: 600;
  display: inline-block;
}

.auth-toggle {
  display: inline-flex;
  gap: 8px;
  margin: 12px 0;
}

.auth-top .auth-toggle {
  margin: 0;
}

.auth-mode.active {
  border-color: #6366f1;
  color: #272a35;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field.signup-only {
  display: none;
}

.field.signup-only.show {
  display: block;
}

.field.signup-only input {
  display: block;
  width: 100%;
  margin-top: 5px;
}

.hint {
  color: #475569;
  margin: 6px 0 16px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #272a35;
}

input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #272a35;
}

input:focus {
  outline: 2px solid #6366f1;
  border-color: #6366f1;
}

select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #272a35;
  font-family: inherit;
  cursor: pointer;
}

select:focus {
  outline: 2px solid #6366f1;
  border-color: #6366f1;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* Auth modal spacing */
.auth-card .actions {
  margin-top: 10px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
}

button.btn-secondary {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
}

button.btn-secondary:hover {
  border-color: #6366f1;
  color: #6366f1;
  transform: translateY(-1px);
}

button.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.status {
  font-size: 13px;
  color: #6366f1;
  font-weight: 600;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6366f1;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.output {
  min-height: 160px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  line-height: 1.7;
  color: #272a35;
  font-size: var(--reader-font-size, 18px);
  width: 99.5%;
}

.output.incomplete {
  border: 1px solid #f1dcdc;
  box-shadow: none;
}

.output.completed {
  border: 1px solid #c2eac2;
  box-shadow: 0 0 9px -4px #c2eac2;
}

.output,
.output * {
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}

/* Force NLT-rendered text to use taller line height */
.output .BibleText {
  line-height: 2.2 !important;
}

/* Hide chapter numbers */
.output .chapter-number {
  display: none !important;
}

.font-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.font-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-buttons .btn-secondary {
  padding: 6px 10px;
  font-size: 12px;
  min-width: 36px;
}

#font-size-value {
  font-size: 12px;
  color: #475569;
  min-width: 28px;
  text-align: center;
  margin: 0 4px;
}
.floating-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: min(960px, 94%);
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
  z-index: 80;
}

.nav-content {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  gap: 12px;
  align-items: center;
}

.progress-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-guest {
  text-align: center;
  color: #475569;
  font-size: 13px;
}

.progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  margin: 8px 0;
}

.progress-summary-text {
  color: #475569;
  font-size: 14px;
}

.progress-summary-bar {
  flex: 1;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 8px;
}

.progress-summary-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  transition: width 0.2s ease;
}

.progress-summary-actions {
  display: flex;
  gap: 8px;
}

.progress-summary-percent {
  font-weight: 600;
  color: #272a35;
  display: grid;
  justify-content: center;
  align-items: center;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #475569;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  transition: width 0.2s ease;
}

.font-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.font-size-value {
  font-weight: 600;
  color: #272a35;
  min-width: 44px;
  text-align: center;
}

.a-tn {
  position: relative;
  cursor: help;
  color: #8b5cf6;
  text-decoration: underline dotted;
}

.tn {
  display: none;
}

.a-tn::after {
  content: attr(data-note);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  min-width: 160px;
  max-width: 260px;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid #1f2937;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.4;
  transition: opacity 0.12s ease;
  z-index: 20;
}

.a-tn:hover::after,
.a-tn:focus-visible::after {
  opacity: 1;
}

.footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
}

body {
  padding-bottom: 120px;
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-search {
    width: 100%;
    min-width: 0;
  }

  .topbar-search input {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .auth-card.auth-top {
    width: 100%;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}

/* Audio controls */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 6px;
}

.audio-playback-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.audio-progress {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(320px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 5;
}

.audio-playback-anchor.is-active .audio-progress {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.audio-time {
  min-width: 38px;
  font-size: 11px;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.audio-seek {
  flex: 1 1 auto;
  width: 100%;
  height: 6px;
  cursor: pointer;
}

.audio-seek:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#audio-play {
  padding: 6px 12px;
  font-size: 14px;
  min-width: 40px;
  transition: all 0.2s ease;
}

#audio-play.loading {
  opacity: 0.7;
  animation: pulse 1.5s ease-in-out infinite;
}

#audio-play.error {
  color: #ef4444;
}

#audio-play:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.audio-indicator {
  display: none;
}

.audio-version {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #272a35;
  font-size: 12px;
  min-width: 110px;
  cursor: pointer;
}

.speed-control,
.volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-control label,
.volume-control label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.audio-speed {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #272a35;
  font-size: 12px;
  cursor: pointer;
}

.audio-volume {
  width: 120px;
  height: 6px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .audio-row.primary,
  .audio-row.secondary {
    flex-wrap: wrap;
  }

  .audio-progress {
    left: calc(100% + 8px);
    top: 50%;
    bottom: auto;
    width: min(240px, calc(100vw - 96px));
    transform: translateY(-50%) translateX(-6px);
  }
}

.volume-display {
  font-size: 11px;
  color: #475569;
  min-width: 30px;
  text-align: right;
}

/* SEO Content - Hidden from display but visible to search engines */
.seo-content {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Loading Modal */
.loading-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
}

.loading-modal.show {
  display: flex;
}

.loading-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 16px;
  font-weight: 500;
  color: #272a35;
  margin: 0;
}

.seo-content p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #272a35;
}
