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

body {
  font-family: 'Segoe UI', sans-serif;
  background: #0a0e27;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.light {
  background: #e8eaf6;
  color: #1a1a2e;
}

/* ── NAVBAR ── */
.navbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}



.navbar-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.navbar-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  display: none;
}

@media (min-width: 768px) { .navbar-tagline { display: block; } }

.navbar-search-wrap { flex: 1; position: relative; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 12px;
  max-width: 400px;
  position: relative;
}

.search-box i { color: rgba(255,255,255,0.7); }

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}

.search-box input::placeholder { color: rgba(255,255,255,0.6); }

#searchClear {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 2px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #1f1f3a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.search-result-item:hover { background: rgba(102,126,234,0.3); }
.search-result-item small { margin-left: auto; color: #888; font-size: 11px; }

.navbar-controls { display: flex; gap: 8px; flex-shrink: 0; }

.nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.nav-btn:hover { background: rgba(255,255,255,0.28); }
.nav-btn.active { background: #ff9800; }

/* ── TAGS ROW ── */
.tags-row {
  display: flex;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(15,15,40,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.tags-row::-webkit-scrollbar { display: none; }

.tag-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tag-btn:hover { background: rgba(102,126,234,0.25); color: #fff; }

.tag-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

body.light .tags-row { background: rgba(232,234,246,0.9); border-bottom-color: rgba(0,0,0,0.1); }
body.light .tag-btn { color: #444; border-color: rgba(0,0,0,0.15); background: rgba(0,0,0,0.04); }
body.light .tag-btn:hover { background: rgba(102,126,234,0.15); color: #333; }

/* ── APP BODY ── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── TIMELINE PANEL (handled by components/timeline.js + timeline.css) ── */
#standaloneTimeline {
  flex-shrink: 0;
  height: 100%;
  overflow: hidden;
}

/* ── MAP AREA ── */
.map-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(20,20,50,0.9), rgba(10,14,39,0.95));
  position: relative;
  overflow: hidden;
  min-width: 0;
}

body.light .map-area { background: linear-gradient(135deg, rgba(232,234,246,0.9), rgba(200,210,240,0.9)); }

.map-loading {
  position: absolute;
  font-size: 28px;
  color: #667eea;
  display: none;
}

.map-loading.visible { display: block; }

#india-map {
  width: 90%;
  height: 90%;
  max-width: 500px;
  max-height: 560px;
}

/* ── STATE PATHS ── */
.state {
  fill: #1e2a4a;
  stroke: #ff9800;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.2s, opacity 0.3s, filter 0.3s;
}

.state:hover, .state:focus { fill: #2ecc71 !important; stroke: #27ae60 !important; stroke-width: 2 !important; }
.state.highlighted { fill: #f39c12 !important; stroke: #e67e22 !important; stroke-width: 2.5 !important; }
.state.year-active  { fill: #5c6bc0 !important; stroke: #7986cb !important; stroke-width: 2 !important; }

body.light .state { fill: #c5cae9; stroke: #5c6bc0; }
body.light .state:hover, body.light .state:focus { fill: #2ecc71 !important; }

/* Overlay markers */
.fort-marker { fill: #e74c3c; stroke: #fff; stroke-width: 1; transition: r 0.2s; }
.fort-marker:hover { r: 7; fill: #ff6b6b; }

.river-label { fill: #3498db; font-size: 8px; font-weight: 600; }

.map-tooltip { fill: #fff; font-size: 10px; background: #333; }

/* ── SIDE PANEL ── */
.side-panel {
  width: 320px;
  flex-shrink: 0;
  background: rgba(15,15,40,0.92);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

body.light .side-panel { background: rgba(232,234,246,0.95); border-left-color: rgba(0,0,0,0.1); }
/*
.sp-placeholder {
   display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: #555;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.sp-placeholder i { font-size: 48px; color: #667eea; margin-bottom: 10px; } */

.sp-content { 
  height: 100%; 
  display: flex; 
  flex-direction: column;
  overflow: hidden;
}
.sp-content.hidden { display: none; }

.sp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

body.light .sp-header { border-bottom-color: rgba(0,0,0,0.08); }

.sp-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.sp-header h2 { 
  font-size: 18px; 
  font-weight: 700; 
  color: #fff; 
  line-height: 1.2;
  margin-bottom: 2px;
}
body.light .sp-header h2 { color: #1a1a2e; }

.sp-sub { 
  font-size: 12px; 
  color: #888; 
  display: block;
}

.sp-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.sp-close:hover { 
  color: #fff; 
  background: rgba(255,255,255,0.1);
}

.sp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

#spDesc { 
  font-size: 14px; 
  color: #aaa; 
  line-height: 1.6; 
  margin-bottom: 8px;
}
body.light #spDesc { color: #555; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 12px;
  transition: background 0.2s;
}

.stat-item:hover {
  background: rgba(255,255,255,0.08);
}

body.light .stat-item { background: rgba(0,0,0,0.05); }
body.light .stat-item:hover { background: rgba(0,0,0,0.08); }

.stat-item i { color: #667eea; font-size: 16px; flex-shrink: 0; }
.stat-item div { min-width: 0; }
.stat-label { 
  display: block; 
  font-size: 10px; 
  color: #888; 
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.stat-value { 
  display: block; 
  font-size: 13px; 
  font-weight: 600; 
  color: #fff;
  word-break: break-word;
}
body.light .stat-value { color: #1a1a2e; }

.sp-section { 
  margin-bottom: 16px;
}
.sp-section h4 { 
  font-size: 12px; 
  color: #667eea; 
  margin-bottom: 10px; 
  display: flex; 
  align-items: center; 
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.facts-list, .events-list { 
  list-style: none; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}
.facts-list li, .events-list li { 
  font-size: 13px; 
  color: #bbb; 
  padding-left: 16px; 
  position: relative;
  line-height: 1.5;
}
.facts-list li::before, .events-list li::before { 
  content: '•'; 
  position: absolute; 
  left: 0; 
  color: #667eea;
  font-weight: bold;
  font-size: 16px;
}
body.light .facts-list li, body.light .events-list li { color: #444; }

.events-list li { 
  display: flex; 
  gap: 10px;
  align-items: flex-start;
  padding-left: 0;
}
.events-list li::before {
  display: none;
}
.ev-year { 
  color: #ff9800; 
  font-weight: 700; 
  font-size: 12px; 
  flex-shrink: 0;
  background: rgba(255,152,0,0.15);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}
.ev-text { 
  color: #bbb; 
  font-size: 13px;
  line-height: 1.5;
}
body.light .ev-text { color: #444; }
