@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-dark: #090c12;
  --bg-card: #131722;
  --bg-parchment: #faf8f5;
  --border-color: #212838;
  --border-gold: #c5a059;
  --text-light: #f4f5f7;
  --text-muted: #9ba3b4;
  --text-dark: #2d2621;
  --text-dark-muted: #5c534c;
  --gold-primary: #d4af37;
  --gold-hover: #ffd700;
  --accent-red: #c22525;
  --accent-blue: #2c529c;
  --shadow-dark: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-light: 0 8px 20px rgba(45, 38, 33, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-light);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  background-color: rgba(9, 12, 18, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.logo {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--gold-primary);
  text-decoration: none;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.logo:hover {
  color: var(--gold-hover);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}

.back-link:hover {
  color: var(--gold-primary);
  border-color: var(--gold-primary);
  background-color: rgba(212, 175, 55, 0.05);
}

/* App Main Layout */
.app-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .app-container {
    flex-direction: row;
  }
}

/* Sidebar Controls & Document Selector */
.sidebar {
  background-color: #0c0f17;
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .sidebar {
    width: 320px;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
  }
}

.sidebar h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold-primary);
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

/* Custom Dropdown / Selector Buttons */
.doc-selector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.85rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-light);
  background-color: rgba(212, 175, 55, 0.03);
}

.doc-btn.active {
  border-color: var(--border-gold);
  color: var(--gold-primary);
  background-color: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.05);
}

.doc-btn::after {
  content: '→';
  opacity: 0.5;
  transition: var(--transition);
}

.doc-btn.active::after {
  content: '✓';
  color: var(--gold-primary);
  opacity: 1;
}

/* Interactive Image Area */
.view-pane {
  flex-grow: 1;
  background-color: #06080c;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.image-viewport {
  position: relative;
  width: 100%;
  max-height: 75vh;
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: #030406;
  overflow: hidden;
}

.image-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* SVG Interactive Overlay — covers image 1:1 */
.interactive-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: auto;
}

.hotspot {
  fill: rgba(212, 175, 55, 0);
  stroke: rgba(212, 175, 55, 0);
  stroke-width: 0.3;
  transition: all 0.2s ease;
  cursor: pointer;
}

.hotspot:hover, .hotspot.active {
  fill: rgba(212, 175, 55, 0.15);
  stroke: var(--gold-primary);
  stroke-width: 0.6;
  filter: drop-shadow(0 0 2px rgba(212, 175, 55, 0.5));
}

/* Show Highlights Mode */
.interactive-overlay.show-all .hotspot {
  stroke: rgba(212, 175, 55, 0.35);
  stroke-width: 0.3;
}

.interactive-overlay.show-all .hotspot:hover,
.interactive-overlay.show-all .hotspot.active {
  stroke: var(--gold-primary);
  stroke-width: 0.6;
  fill: rgba(212, 175, 55, 0.15);
}

/* Viewport Controls */
.viewport-controls {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
}

.control-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}

.control-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-light);
}

.control-btn.active {
  background-color: var(--gold-primary);
  color: var(--bg-dark);
  border-color: var(--gold-primary);
}

/* Details Panel (Right Sidebar) */
.details-pane {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .details-pane {
    width: 450px;
    border-top: none;
    border-left: 1px solid var(--border-color);
    height: 100%;
  }
}

.details-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.details-header .tag {
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 2px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  display: block;
}

.details-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  color: var(--text-light);
}

.details-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tab System */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  overflow-x: auto;
  white-space: nowrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.tab-btn:hover {
  color: var(--text-light);
}

.tab-btn.active {
  color: var(--gold-primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--gold-primary);
}

/* Text Box (Parchment) */
.parchment-box {
  background-color: var(--bg-parchment);
  color: var(--text-dark);
  padding: 1.5rem;
  border-radius: 6px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  line-height: 1.5;
  border: 1px solid #e2dacb;
  box-shadow: var(--shadow-light);
  position: relative;
  min-height: 120px;
}

.parchment-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px solid rgba(197, 160, 89, 0.2);
  margin: 4px;
  pointer-events: none;
}

.parchment-box.rtl {
  direction: rtl;
  text-align: right;
  font-family: 'SBL Hebrew', 'Times New Roman', serif;
  font-size: 1.35rem;
  line-height: 1.8;
}

.rubric {
  color: var(--accent-red);
  font-weight: 700;
}

.initial-drop {
  color: var(--accent-blue);
  font-size: 2.2rem;
  float: left;
  line-height: 0.8;
  margin-right: 0.4rem;
  margin-top: 0.15rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

.hebrew-letter {
  color: var(--accent-red);
  font-weight: 700;
  font-family: 'Cinzel', serif;
}

/* Commentary Text */
.commentary-section h4 {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.commentary-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.commentary-text p {
  margin-bottom: 0.75rem;
}

.theology-badge {
  background-color: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* Verses List Navigation */
.verses-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.verses-nav h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.verse-item {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
  transition: var(--transition);
}

.verse-item:hover {
  border-color: rgba(212, 175, 55, 0.3);
  color: var(--text-light);
  background-color: rgba(255, 255, 255, 0.04);
}

.verse-item.active {
  border-color: var(--border-gold);
  color: var(--gold-primary);
  background-color: rgba(212, 175, 55, 0.05);
}

/* Custom Scrollbar for sidebar and boxes */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Floating Tooltip */
.floating-tooltip {
  position: fixed;
  background: rgba(19, 23, 34, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 0.85rem 1.2rem;
  color: var(--text-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  display: none;
  border-left: 3px solid var(--gold-primary);
}

.floating-tooltip.show {
  opacity: 1;
}

.floating-tooltip .tooltip-header {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--gold-primary);
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.floating-tooltip .tooltip-body {
  line-height: 1.5;
  color: #e2dacb;
}

.floating-tooltip.hebrew-tooltip {
  direction: rtl;
  text-align: right;
  font-family: 'SBL Hebrew', 'Times New Roman', serif;
  font-size: 1.25rem;
  line-height: 1.7;
  border-left: 1px solid var(--border-gold);
  border-right: 3px solid var(--gold-primary);
}
