/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAF8F3;
  --bg-2: #F2EDE4;
  --bg-3: #EAE4D8;
  --text: #1E1B16;
  --text-2: #5C5446;
  --text-3: #8C8070;
  --accent: #8B6914;
  --accent-light: #C9A84C;
  --accent-pale: #F5EDD8;
  --red: #C94040;
  --border: #DDD5C2;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
  --radius: 8px;
  --header-h: 58px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  height: var(--header-h);
  background: #2C2416;
  border-bottom: 2px solid #4A3C28;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  color: var(--accent-light);
  font-size: 18px;
}

.logo-text {
  color: #FAF8F3;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.version-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8B7A5C;
  background: rgba(255,255,255,0.06);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.lang-toggle {
  background: rgba(255,255,255,0.10);
  border: 1.5px solid rgba(255,255,255,0.22);
  color: #FAF8F3;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.main-nav {
  display: flex;
  gap: 4px;
}

.nav-btn {
  background: none;
  border: none;
  color: #B8A88C;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.nav-btn:hover { background: rgba(255,255,255,0.08); color: #FAF8F3; }
.nav-btn.active { background: var(--accent); color: #FAF8F3; }

/* ─── Main ──────────────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content { display: none; flex: 1; overflow: hidden; }
.tab-content.active { display: flex; flex-direction: column; }

/* ─── Reader Layout ─────────────────────────────────────────────────────────── */
.reader-layout {
  display: grid;
  grid-template-columns: 228px 1fr 296px;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

/* ─── Book Sidebar ──────────────────────────────────────────────────────────── */
.book-sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  flex-shrink: 0;
}

.testament-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 6px;
  padding: 3px;
}

.testament-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: none;
  color: var(--text-3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.testament-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.book-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px 20px;
}

.book-list::-webkit-scrollbar { width: 4px; }
.book-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.book-category {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 10px 8px 4px;
}

.book-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  font-size: 13.5px;
  font-family: inherit;
  background: none;
  border: none;
  color: var(--text-2);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1.3;
}

.book-item:hover { background: var(--bg-3); color: var(--text); }
.book-item.active { background: var(--accent); color: white; font-weight: 500; }

/* ─── Chapter Content ───────────────────────────────────────────────────────── */
.chapter-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 48px;
}

.location-breadcrumb {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

.chapter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrow {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s;
}

.nav-arrow:hover { background: var(--accent); color: white; border-color: var(--accent); }

.chapter-select {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}

.verse-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 40px;
}

.verse-container::-webkit-scrollbar { width: 6px; }
.verse-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Welcome Screen ────────────────────────────────────────────────────────── */
.welcome-screen {
  max-width: 540px;
  margin: 40px auto;
  text-align: center;
}

.welcome-icon { font-size: 40px; margin-bottom: 16px; }

.welcome-screen h2 {
  font-family: "Merriweather", Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 10px;
}

.welcome-screen > p {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.quick-links { text-align: left; }

.quick-links h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.quick-link {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.15s;
}

.quick-link:hover { background: var(--accent-pale); border-color: var(--accent-light); color: var(--text); }

/* ─── Book Intro ────────────────────────────────────────────────────────────── */
.book-intro {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.book-intro-title {
  font-family: "Merriweather", Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.book-intro-text {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
  max-width: 640px;
}

/* ─── Chapter / Verses ──────────────────────────────────────────────────────── */
.chapter-title {
  font-family: "Merriweather", Georgia, serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.verse {
  display: flex;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 1px;
  align-items: flex-start;
}

.verse:hover { background: var(--accent-pale); }
.verse.selected { background: var(--accent-pale); outline: 1px solid var(--accent-light); }
.verse.has-commentary { border-left: 2px solid var(--accent-light); padding-left: 8px; }

.verse-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  min-width: 24px;
  padding-top: 3px;
  flex-shrink: 0;
}

.verse-text {
  font-family: "Merriweather", Georgia, serif;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text);
}

/* ─── Commentary Panel ──────────────────────────────────────────────────────── */
.commentary-panel {
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.commentary-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  flex-shrink: 0;
}

.commentary-header h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.commentary-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 32px;
}

.commentary-content::-webkit-scrollbar { width: 4px; }
.commentary-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.commentary-hint {
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.7;
}

.commentary-ref {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.commentary-verse-text {
  font-family: "Merriweather", Georgia, serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: var(--accent-pale);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 5px 5px 0;
  margin-bottom: 14px;
  font-style: italic;
}

.commentary-subtitle {
  font-family: "Merriweather", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.commentary-body {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-2);
  margin-bottom: 12px;
}

.commentary-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 14px 0 6px;
}

.cross-refs { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.cross-ref-item {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.12s;
}

.cross-ref-item:hover { color: var(--red); }
.has-commentary-dot { color: var(--accent-light); }

/* ─── Loading ────────────────────────────────────────────────────────────────── */
.loading-spinner {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 48px 24px;
}

/* ─── Search ────────────────────────────────────────────────────────────────── */
.search-layout {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 24px;
  width: 100%;
  flex: 1;
  overflow-y: auto;
}

.search-layout::-webkit-scrollbar { width: 6px; }
.search-layout::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.search-header h2 {
  font-family: "Merriweather", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#search-input {
  flex: 1;
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
}

#search-input:focus { outline: none; border-color: var(--accent); }

#search-btn {
  padding: 11px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

#search-btn:hover { background: #6B5210; }

.search-suggestions {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 24px;
}

.suggestion-chip {
  padding: 3px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}

.suggestion-chip:hover { background: var(--accent); color: white; border-color: var(--accent); }

.search-placeholder, .no-results {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1.7;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.results-count {
  font-size: 13px;
  color: var(--text-3);
}

.open-reader-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
}

.open-reader-btn:hover { text-decoration: underline; }

.search-verse {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  background: white;
  transition: all 0.12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-verse:hover { border-color: var(--accent-light); background: var(--accent-pale); }

.search-ref {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.search-text {
  font-family: "Merriweather", Georgia, serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.theme-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.theme-ref-btn {
  padding: 4px 12px;
  background: var(--accent-pale);
  border: 1px solid var(--accent-light);
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.12s;
}

.theme-ref-btn:hover { background: var(--accent); color: white; }

/* ─── Timeline ──────────────────────────────────────────────────────────────── */
.timeline-layout {
  flex: 1;
  overflow-y: auto;
  padding: 36px 24px 60px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.timeline-layout::-webkit-scrollbar { width: 6px; }
.timeline-layout::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.section-title {
  font-family: "Merriweather", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-desc {
  color: var(--text-3);
  font-size: 15px;
  margin-bottom: 32px;
}

.timeline-container {
  position: relative;
  padding-left: 28px;
}

.timeline-container::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--border), var(--border));
}

.timeline-era {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 28px 0 12px -28px;
  padding-left: 28px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.timeline-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: -44px;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border);
  z-index: 1;
}

.timeline-body {
  flex: 1;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-top: -2px;
  transition: box-shadow 0.15s;
}

.timeline-body:hover { box-shadow: var(--shadow-lg); }

.timeline-date {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.timeline-event {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 8px;
}

.timeline-ref {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
}

.timeline-ref:hover { text-decoration: underline; }

/* ─── Maps ──────────────────────────────────────────────────────────────────── */
.maps-layout {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 0;
}

.maps-container {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 20px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.map-panel {
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.map-svg-container {
  width: 100%;
  height: 100%;
}

.bible-map {
  width: 100%;
  height: 100%;
}

/* SVG Map text styles */
.map-region {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  fill: #8C7A5A;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.map-lake {
  font-family: "Inter", sans-serif;
  font-size: 9px;
  fill: #2A5A7A;
  font-weight: 600;
}

.map-label {
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  fill: #2C2416;
  font-weight: 500;
}

.compass {
  font-family: "Inter", sans-serif;
  font-size: 9px;
  fill: #666;
  font-weight: 700;
}

/* Location Detail Panel */
.location-detail {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
}

.location-detail::-webkit-scrollbar { width: 4px; }
.location-detail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.location-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
}

.loc-name {
  font-family: "Merriweather", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.loc-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 16px;
}

.loc-events-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.loc-events {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.loc-events li {
  font-size: 13.5px;
  color: var(--text-2);
  padding: 7px 10px;
  background: white;
  border-radius: 5px;
  border-left: 3px solid var(--accent-light);
  line-height: 1.5;
}

.loc-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loc-ref-btn {
  padding: 4px 12px;
  background: var(--accent-pale);
  border: 1px solid var(--accent-light);
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.12s;
}

.loc-ref-btn:hover { background: var(--accent); color: white; }

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.verses-wrapper { padding-top: 4px; }
