/*
 * Shravana — The Text Itself
 * No cards. No boxes. No panels.
 * Typography carries all hierarchy. Spacing is the primary tool.
 * One background. One accent. Three text colors.
 */

/* ── Tokens ─────────────────────────────────────────────── */

:root {
  --bg:            #0c0b10;
  --bg-raised:     #12101a;
  --bg-hover:      #1a1724;
  --bg-active:     rgba(193, 134, 66, 0.06);

  --text:          #e4dccf;
  --text-soft:     #a69a88;
  --text-muted:    #6d6458;

  --accent:        #c18642;
  --accent-bright: #d49444;
  --accent-dim:    #7a5530;
  --accent-glow:   rgba(193, 134, 66, 0.08);
  --accent-ghost:  rgba(193, 134, 66, 0.04);

  --radius-sm: 4px;
  --radius:   8px;
  --radius-lg: 14px;

  --font-heading: 'Cinzel', serif;
  --font-body:    'Inter', sans-serif;
  --font-sa:      'Noto Serif Devanagari', serif;

  --transition: 0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────── */

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

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(193, 134, 66, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(193, 134, 66, 0.3); }

/* ── Layout ─────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--accent-ghost);
}

.sidebar-header {
  padding: 28px 24px 20px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── Filter Controls ────────────────────────────────────── */

.sidebar-controls {
  padding: 0 20px 16px;
  display: flex;
  gap: 6px;
}

.filter-btn {
  flex: 1;
  padding: 7px 0;
  border: 1px solid rgba(122, 85, 48, 0.15);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: rgba(193, 134, 66, 0.25);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── Chapter Nav ────────────────────────────────────────── */

.chapter-nav {
  padding: 4px 20px 12px;
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.chapter-chip {
  padding: 3px 10px;
  border: 1px solid rgba(122, 85, 48, 0.12);
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.chapter-chip:hover,
.chapter-chip.active {
  border-color: rgba(193, 134, 66, 0.3);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── Volume Header ──────────────────────────────────────── */

.volume-header {
  padding: 20px 24px 8px;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.volume-header:first-child {
  padding-top: 4px;
}

.volume-header .hi {
  display: block;
  font-family: var(--font-sa);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* ── Discourse List ─────────────────────────────────────── */

.discourse-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
}

.discourse-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.discourse-item:hover {
  background: var(--bg-hover);
}

.discourse-item.active {
  background: var(--bg-active);
}

.discourse-item.active .discourse-num {
  color: var(--accent);
}

.discourse-item.active .discourse-title {
  color: var(--text);
}

.discourse-num {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
  line-height: 1;
}

.discourse-info {
  flex: 1;
  min-width: 0;
}

.discourse-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.discourse-chapter {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

.discourse-progress {
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: rgba(122, 85, 48, 0.15);
}

.discourse-progress-bar {
  height: 100%;
  background: var(--accent-dim);
  transition: width 0.3s ease;
}

/* ── Main Content ───────────────────────────────────────── */

.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content {
  flex: 1;
  overflow-y: auto;
}

.content-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Empty State ────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.empty-om {
  font-family: var(--font-sa);
  font-size: 5rem;
  color: var(--accent-dim);
  opacity: 0.4;
  line-height: 1;
  margin-bottom: 24px;
  user-select: none;
}

.empty-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  max-width: 360px;
  line-height: 1.7;
}

/* ── Player ─────────────────────────────────────────────── */

.player-section {
  margin-bottom: 56px;
}

.player-top {
  margin-bottom: 32px;
}



.player-meta {
  flex: 1;
  padding-top: 6px;
  min-width: 0;
}

.player-meta h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.chapter-label {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 8px;
  line-height: 1.5;
}

.chapter-label em {
  font-style: normal;
  color: var(--accent);
}

/* ── Waveform ───────────────────────────────────────────── */

.waveform {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  margin-top: 16px;
  opacity: 0.4;
  transition: opacity 0.5s ease;
}

.player-section.playing .waveform {
  opacity: 0.75;
}

.waveform-bar {
  flex: 1;
  background: var(--accent-dim);
  border-radius: 2px;
  min-height: 3px;
  height: 12%;
  transition: height 0.08s linear;
}

.waveform.paused .waveform-bar {
  height: 8% !important;
  transition: height 0.4s ease;
}

/* ── Controls ───────────────────────────────────────────── */

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 8px;
  border-radius: 50%;
}

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

.ctrl-btn.play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
}

.ctrl-btn.play:hover {
  background: var(--accent-bright);
  transform: scale(1.06);
}

.ctrl-btn svg { width: 20px; height: 20px; }
.ctrl-btn.play svg { width: 22px; height: 22px; }
.ctrl-btn.prev svg,
.ctrl-btn.next svg { width: 22px; height: 22px; }

/* ── Progress Bar ───────────────────────────────────────── */

.progress-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: center;
  letter-spacing: 0.04em;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(122, 85, 48, 0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  transform: translate(50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--transition);
}
.progress-bar:hover .progress-fill::after { opacity: 1; }



/* ── Player Extras ──────────────────────────────────────── */

.player-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(193, 134, 66, 0.06);
}

.extra-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.extra-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 4px;
}

.speed-btn {
  padding: 3px 9px;
  border: 1px solid rgba(122, 85, 48, 0.15);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.speed-btn:hover,
.speed-btn.active {
  border-color: rgba(193, 134, 66, 0.3);
  color: var(--accent);
  background: var(--accent-glow);
}

.timer-btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color var(--transition);
  padding: 4px 0;
}

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

.timer-display {
  font-size: 0.75rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

/* ── Verses ─────────────────────────────────────────────── */

.verses-section {
  margin-bottom: 56px;
}

.verses-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.verses-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

.verses-title .sa {
  font-family: var(--font-sa);
  font-size: 0.85rem;
  color: var(--accent-dim);
  margin-left: 10px;
}

.toggle-group {
  display: flex;
  gap: 2px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid rgba(122, 85, 48, 0.12);
}

.toggle-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 3px;
  transition: all var(--transition);
}

.toggle-btn:hover { color: var(--text-soft); }

.toggle-btn.active {
  background: var(--bg-active);
  color: var(--accent);
}

.verses-list {
  display: flex;
  flex-direction: column;
}

.verse-item {
  padding: 24px 0;
  border-bottom: 1px solid rgba(193, 134, 66, 0.06);
}

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

.verse-sanskrit {
  font-family: var(--font-sa);
  font-size: 1.25rem;
  line-height: 2.2;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 500;
}

.verse-transliteration {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-soft);
  font-style: italic;
  line-height: 1.9;
  margin-bottom: 16px;
  padding-left: 20px;
  border-left: 2px solid var(--accent-dim);
}

.verse-translation {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.8;
  font-weight: 400;
}

/* ── Transcript ─────────────────────────────────────────── */

.transcript-section {
  margin-bottom: 32px;
}

.transcript-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.transcript-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color var(--transition);
}

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

.transcript-link svg {
  opacity: 0.7;
}

/* ── Modal (Timer) ──────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-raised);
  border: 1px solid rgba(193, 134, 66, 0.12);
  border-radius: var(--radius);
  padding: 32px;
  min-width: 300px;
  max-width: 90vw;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 0.04em;
}

.timer-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.timer-preset {
  padding: 12px 8px;
  border: 1px solid rgba(122, 85, 48, 0.15);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.timer-preset:hover {
  border-color: rgba(193, 134, 66, 0.3);
  color: var(--accent);
  background: var(--accent-glow);
}

.modal-close {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  border: 1px solid rgba(122, 85, 48, 0.12);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  border-color: rgba(193, 134, 66, 0.25);
  color: var(--accent);
}

/* ── Toast ──────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--bg-raised);
  border: 1px solid rgba(193, 134, 66, 0.15);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  z-index: 200;
  opacity: 0;
  transition: all 0.35s ease;
  pointer-events: none;
  letter-spacing: 0.02em;
}

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

/* ── Mobile Menu Toggle ─────────────────────────────────── */

.menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(122, 85, 48, 0.15);
  background: var(--bg-raised);
  color: var(--text-soft);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.menu-toggle:hover {
  border-color: rgba(193, 134, 66, 0.3);
  color: var(--accent);
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--bg-raised);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    z-index: 65;
  }

  .content-inner {
    padding: 60px 24px 80px;
  }

  .player-top {
    margin-bottom: 24px;
  }

  .player-meta h2 {
    font-size: 1.2rem;
  }

  .player-controls {
    gap: 16px;
  }

  .empty-om {
    font-size: 3.5rem;
  }

  .empty-title {
    font-size: 1.3rem;
  }

  .verse-sanskrit {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .content-inner {
    padding: 56px 16px 64px;
  }

  .player-meta h2 {
    font-size: 1.1rem;
  }

  .extra-group:first-child {
    gap: 4px;
  }

  .speed-btn {
    padding: 3px 6px;
    font-size: 0.65rem;
  }

  .verses-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Focus states ───────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ctrl-btn:focus-visible {
  outline-offset: -2px;
}

/* ── Selection ──────────────────────────────────────────── */

::selection {
  background: rgba(193, 134, 66, 0.2);
  color: var(--text);
}
