@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@300;400;500;600;700&family=Fira+Code:wght@300;400;500;600&display=swap');

:root {
  --bg-primary: #07090f;
  --bg-surface: #0d1117;
  --bg-card: #111827;
  --bg-card-hover: #161e2e;
  --border: rgba(0, 212, 255, 0.15);
  --border-hover: rgba(0, 212, 255, 0.45);
  --accent-cyan: #00d4ff;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-cyan-glow: rgba(0, 212, 255, 0.3);
  --text-primary: #e2e8f0;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --highlight-bg: rgba(245, 158, 11, 0.12);
  --highlight-border: rgba(245, 158, 11, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ─── HEADER ─────────────────────────────────────── */
.site-header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
}

.brand-logo {
  font-family: 'Fira Code', monospace;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  color: var(--accent-cyan);
  text-shadow: 0 0 20px var(--accent-cyan-glow), 0 0 40px rgba(0, 212, 255, 0.15);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.brand-logo span {
  color: var(--accent-gold);
  text-shadow: 0 0 20px var(--accent-gold-glow);
}

.brand-tagline {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ─── PAGE TITLES ────────────────────────────────── */
.page-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-subtitle {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 36px;
}

/* ─── SECTION LABELS ─────────────────────────────── */
.testament-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin: 40px 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.testament-label::before,
.testament-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.3));
}

.testament-label::after {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.3), transparent);
}

/* ─── BOOK GRID ──────────────────────────────────── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  list-style: none;
}

.book-grid li a {
  display: block;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-subtle);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
}

.book-grid li a:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--accent-cyan);
  text-shadow: 0 0 8px var(--accent-cyan-glow);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.08), inset 0 0 16px rgba(0, 212, 255, 0.04);
  transform: translateY(-2px);
}

/* ─── CHAPTER GRID ───────────────────────────────── */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  list-style: none;
  max-width: 800px;
}

.chapter-grid li a {
  display: block;
  padding: 16px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-subtle);
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
}

.chapter-grid li a:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--accent-cyan);
  text-shadow: 0 0 8px var(--accent-cyan-glow);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.08);
  transform: translateY(-2px);
}

/* ─── BACK NAV ───────────────────────────────────── */
.back-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}

.back-nav:hover {
  color: var(--accent-cyan);
}

.back-nav::before {
  content: '←';
  font-size: 1rem;
}

/* ─── BREADCRUMB ─────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--accent-cyan);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.breadcrumb a:hover {
  opacity: 1;
}

.breadcrumb .sep {
  color: var(--text-muted);
  opacity: 0.4;
}

/* ─── AUDIO PLAYER ───────────────────────────────── */
.audio-player {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.audio-player-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  flex: 1;
  min-width: 120px;
}

.audio-player-label span {
  color: var(--accent-cyan);
}

.player-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-subtle);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-player:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

.btn-player.active {
  background: rgba(0, 212, 255, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.2);
}

.btn-player.btn-stop:hover {
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

/* ─── VOICE SELECTOR ─────────────────────────────── */
.voice-selector-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.voice-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-subtle);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  max-width: 240px;
  transition: border-color 0.2s, color 0.2s;
}

.voice-select:hover,
.voice-select:focus {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

.voice-select option,
.voice-select optgroup {
  background: #111827;
  color: var(--text-subtle);
}

/* ─── VERSE READER ───────────────────────────────── */
.chapter-reader {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}

.verse {
  display: flex;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.3s ease, border-color 0.3s ease;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 2px -16px;
}

.verse:last-child {
  border-bottom: none;
}

.verse-num {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-gold);
  min-width: 28px;
  padding-top: 3px;
  text-align: right;
  opacity: 0.7;
  flex-shrink: 0;
}

.verse-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text-subtle);
  line-height: 1.8;
  letter-spacing: 0.3px;
}

.verse.highlight {
  background: var(--highlight-bg);
  border-left: 2px solid var(--accent-gold);
  margin-left: -18px;
  padding-left: 16px;
}

.verse.highlight .verse-num {
  opacity: 1;
  color: var(--accent-gold);
  text-shadow: 0 0 8px var(--accent-gold-glow);
}

.verse.highlight .verse-text {
  color: var(--text-primary);
}

/* ─── LOADING OVERLAY ────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 20px;
}

.tts-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  margin-bottom: 16px;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 8px;
}

.tts-loading .loading-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
  flex-shrink: 0;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* ─── CHAPTER NAV (prev/next) ────────────────────── */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  gap: 16px;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-subtle);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-nav:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--bg-card-hover);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.1);
}

.btn-nav.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ─── CHAPTER HEADER ─────────────────────────────── */
.chapter-header {
  margin-bottom: 32px;
}

.chapter-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.chapter-meta {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ─── ERROR STATE ────────────────────────────────── */
.error-card {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: #fca5a5;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 600px) {
  .page-wrapper {
    padding: 24px 16px;
  }

  .chapter-reader {
    padding: 24px 16px;
  }

  .audio-player {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-select {
    max-width: 100%;
    width: 100%;
  }

  .chapter-nav {
    flex-direction: column;
  }

  .btn-nav {
    width: 100%;
    justify-content: center;
  }
}
