/* ═══════════════════════════════════════════════════════════════
   DHARAVERSE UPSC MAPS — MASTER STYLESHEET
   Version 2026 | Nobel Prize Worthy Design
═══════════════════════════════════════════════════════════════ */

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

:root {
  --bg-primary: #050B1A;
  --bg-secondary: #080F22;
  --bg-card: #0C1428;
  --bg-glass: rgba(12, 20, 40, 0.85);
  --bg-glass-light: rgba(255,255,255,0.04);

  --gold: #F0A500;
  --gold-light: #FFD166;
  --gold-dark: #C67C00;
  --gold-glow: rgba(240, 165, 0, 0.3);

  --blue: #1E90FF;
  --blue-light: #4DB8FF;
  --blue-dark: #0060CC;
  --blue-glow: rgba(30, 144, 255, 0.3);

  --cyan: #00D4FF;
  --green: #00FF88;
  --red: #FF4466;
  --orange: #FF7A00;
  --purple: #8B5CF6;

  --text-primary: #F0F4FF;
  --text-secondary: #8899BB;
  --text-muted: #4A5568;
  --text-gold: #F0A500;

  --border: rgba(255,255,255,0.08);
  --border-gold: rgba(240, 165, 0, 0.3);
  --border-blue: rgba(30, 144, 255, 0.3);

  --shadow-gold: 0 0 20px rgba(240, 165, 0, 0.2);
  --shadow-blue: 0 0 20px rgba(30, 144, 255, 0.2);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);

  --sidebar-width: 320px;
  --header-height: 80px;
  --controls-height: 60px;
  --breadcrumb-height: 36px;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* LIGHT THEME */
body.light-theme {
  --bg-primary: #F0F4FF;
  --bg-secondary: #E8EDF8;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255,255,255,0.9);
  --bg-glass-light: rgba(0,0,0,0.04);
  --text-primary: #0A0F1E;
  --text-secondary: #4A5568;
  --text-muted: #9CA3AF;
  --border: rgba(0,0,0,0.1);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.1);
}

html { scroll-behavior: smooth; }

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

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--gold-dark), var(--gold));
  border-radius: var(--radius-full);
}

/* ══════════════════════════════════
   PRELOADER
══════════════════════════════════ */
#preloader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #020812 0%, #050B1A 50%, #020C10 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.preloader-globe {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.globe-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: globeSpin linear infinite;
}

.ring-1 {
  width: 120px; height: 120px;
  border-top-color: var(--gold);
  border-right-color: var(--gold-light);
  animation-duration: 3s;
}
.ring-2 {
  width: 90px; height: 90px;
  border-top-color: var(--blue);
  border-left-color: var(--cyan);
  animation-duration: 2s;
  animation-direction: reverse;
}
.ring-3 {
  width: 60px; height: 60px;
  border-bottom-color: var(--green);
  border-right-color: var(--purple);
  animation-duration: 1.5s;
}

.globe-core {
  position: relative;
  z-index: 2;
  font-size: 28px;
  color: var(--gold);
  filter: drop-shadow(0 0 12px var(--gold));
  animation: corePulse 2s ease-in-out infinite;
}

@keyframes globeSpin {
  to { transform: rotate(360deg); }
}
@keyframes corePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.preloader-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
  filter: drop-shadow(0 0 20px var(--gold-glow));
}

.brand-sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.preloader-bar {
  width: 280px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.preloader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--gold-glow);
}

.preloader-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ══════════════════════════════════
   HEADER
══════════════════════════════════ */
.main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-gold);
}

.header-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240,165,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,165,0,0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  height: var(--header-height);
  gap: 20px;
}

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

.brand-icon {
  position: relative;
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #000;
  box-shadow: 0 4px 20px var(--gold-glow);
}

.brand-pulse {
  position: absolute;
  inset: -4px;
  border: 2px solid var(--gold);
  border-radius: calc(var(--radius-md) + 4px);
  animation: brandPulse 2s ease-in-out infinite;
  opacity: 0;
}

@keyframes brandPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.05); }
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-glass-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.stat-pill i { font-size: 0.7rem; }

.stat-pill.active-pill {
  background: rgba(240, 165, 0, 0.1);
  border-color: var(--border-gold);
  color: var(--gold);
}

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

.btn-icon {
  width: 40px; height: 40px;
  background: var(--bg-glass-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(240, 165, 0, 0.1);
  border-color: var(--border-gold);
  color: var(--gold);
  transform: translateY(-2px);
}

/* BREADCRUMB */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--breadcrumb-height);
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
}

.breadcrumb-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bc-item {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.bc-item.active {
  color: var(--gold);
}

.bc-sep {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.breadcrumb-progress {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════ */
.main-layout {
  display: flex;
  margin-top: calc(var(--header-height) + var(--breadcrumb-height));
  height: calc(100vh - var(--header-height) - var(--breadcrumb-height));
  position: relative;
}

/* ══════════════════════════════════
   SIDEBAR
══════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition-slow);
  flex-shrink: 0;
  z-index: 500;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.sidebar-header h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-gold);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-sidebar {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}
.btn-close-sidebar:hover { color: var(--red); }

.sidebar-search {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: var(--transition);
}

.search-wrap:focus-within {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.search-wrap i { color: var(--text-muted); font-size: 0.8rem; }

.search-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-body);
}
.search-wrap input::placeholder { color: var(--text-muted); }

.btn-clear-search {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition-fast);
  display: none;
}
.btn-clear-search.visible { display: block; }
.btn-clear-search:hover { color: var(--red); }

.sidebar-categories {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Category Group */
.cat-group {
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.cat-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.cat-group-header:hover {
  background: rgba(240, 165, 0, 0.08);
}

.cat-group-header.active {
  background: rgba(240, 165, 0, 0.12);
  border-left: 3px solid var(--gold);
}

.cat-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.cat-info h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.cat-info p {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.cat-chevron {
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: var(--transition-fast);
}

.cat-group.open .cat-chevron {
  transform: rotate(180deg);
}

.cat-maps-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-primary);
}

.cat-group.open .cat-maps-list {
  max-height: 1000px;
}

.map-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

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

.map-item:hover {
  background: rgba(240, 165, 0, 0.06);
}

.map-item.active {
  background: rgba(240, 165, 0, 0.12);
  border-left: 3px solid var(--gold);
}

.map-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 35px;
}

.map-item.active .map-num { color: var(--gold); }

.map-item-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.map-item.active .map-item-text { color: var(--text-primary); }

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 490;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════
   MAP AREA
══════════════════════════════════ */
.map-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* CONTROLS BAR */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--controls-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

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

/* DROPDOWNS */
.dropdown-wrap {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-width: 180px;
}

.dropdown-btn:hover:not(:disabled) {
  border-color: var(--border-gold);
  color: var(--gold);
  background: rgba(240, 165, 0, 0.08);
}

.dropdown-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown-btn i:first-child { color: var(--gold); font-size: 0.8rem; }

.drop-arrow {
  margin-left: auto;
  font-size: 0.65rem;
  transition: var(--transition-fast);
}

.dropdown-wrap.open .drop-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), var(--shadow-gold);
  z-index: 200;
  display: none;
  animation: dropIn 0.2s ease;
}

.dropdown-wrap.open .dropdown-menu { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

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

.drop-item:hover {
  background: rgba(240, 165, 0, 0.08);
  color: var(--text-primary);
}

.drop-item.selected {
  background: rgba(240, 165, 0, 0.15);
  color: var(--gold);
}

.drop-item .drop-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 30px;
}

.drop-item.selected .drop-num { color: var(--gold); }

/* CTRL BUTTONS */
.ctrl-btn {
  width: 36px; height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover:not(:disabled) {
  background: rgba(240, 165, 0, 0.1);
  border-color: var(--border-gold);
  color: var(--gold);
}

.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.map-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 50px;
  text-align: center;
}

/* ══════════════════════════════════
   MAP CONTAINER
══════════════════════════════════ */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#leafletMap {
  width: 100%;
  height: 100%;
  display: none;
}

#leafletMap.visible { display: block; }

/* ── WELCOME SCREEN ── */
.welcome-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #080F22 0%, #020812 100%);
  z-index: 10;
}

.welcome-screen.hidden { display: none; }

.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  max-width: 500px;
  padding: 40px;
}

.welcome-globe {
  position: relative;
  width: 140px; height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wg-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: globeSpin linear infinite;
}
.wg-r1 { width: 140px; height: 140px; border-top-color: var(--gold); border-right-color: rgba(240,165,0,0.3); animation-duration: 8s; }
.wg-r2 { width: 105px; height: 105px; border-top-color: var(--blue); border-left-color: rgba(30,144,255,0.3); animation-duration: 5s; animation-direction: reverse; }
.wg-r3 { width: 70px; height: 70px; border-bottom-color: var(--green); border-right-color: rgba(0,255,136,0.3); animation-duration: 3s; }

.wg-icon {
  font-size: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px var(--gold-glow));
  animation: corePulse 3s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.welcome-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.welcome-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 32px;
  background: var(--bg-glass-light);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
}

.ws-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ws-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
}

.ws-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ws-divider {
  width: 1px;
  height: 40px;
  background: var(--border-gold);
}

.welcome-instruction {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.welcome-instruction i {
  color: var(--gold);
  animation: bounce 1.5s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* MAP LOADING */
.map-loading {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 20;
  display: none;
}
.map-loading.visible { display: flex; }

.ml-spinner {
  position: relative;
  width: 80px; height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ml-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--gold);
  border-right-color: var(--gold-light);
  animation: globeSpin 1s linear infinite;
}

.ml-icon {
  font-size: 24px;
  color: var(--gold);
  animation: corePulse 1.5s ease-in-out infinite;
}

.ml-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════
   LEGEND PANEL
══════════════════════════════════ */
.legend-panel {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 260px;
  max-height: 60vh;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--shadow-gold);
  z-index: 50;
  overflow: hidden;
  display: none;
  animation: slideInRight 0.3s ease;
}

.legend-panel.visible { display: flex; flex-direction: column; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-gold);
  background: rgba(240, 165, 0, 0.08);
}

.legend-header h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}

.btn-close-legend, .btn-close-info {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}
.btn-close-legend:hover, .btn-close-info:hover { color: var(--red); }

.legend-body {
  padding: 14px;
  overflow-y: auto;
}

/* Legend Items */
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 20px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.legend-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-line {
  width: 24px; height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-section-title {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════
   INFO PANEL
══════════════════════════════════ */
.info-panel {
  position: absolute;
  top: 0; right: 0;
  width: 340px;
  height: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-gold);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  z-index: 60;
  display: none;
  flex-direction: column;
  animation: slideInFromRight 0.3s ease;
}

.info-panel.visible { display: flex; }

@keyframes slideInFromRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-gold);
  background: rgba(240, 165, 0, 0.08);
}

.info-header h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--gold);
}

.info-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.info-section {
  margin-bottom: 20px;
}

.info-section-title {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-gold);
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-item i {
  color: var(--gold);
  font-size: 0.7rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.info-fact-card {
  background: rgba(240, 165, 0, 0.05);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.info-fact-title {
  font-size: 0.7rem;
  color: var(--gold);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.info-fact-value {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ══════════════════════════════════
   LEAFLET CUSTOMIZATIONS
══════════════════════════════════ */
.leaflet-container {
  background: #0A1628 !important;
  font-family: var(--font-body) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-gold) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-gold) !important;
  overflow: hidden;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  background: var(--bg-card) !important;
  color: var(--gold) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 16px !important;
  transition: var(--transition-fast) !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: rgba(240, 165, 0, 0.15) !important;
  color: var(--gold-light) !important;
}

.leaflet-attribution-flag { display: none !important; }

.leaflet-control-attribution {
  background: rgba(5, 11, 26, 0.85) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
  padding: 2px 8px !important;
}

.leaflet-control-attribution a { color: var(--gold) !important; }

/* Custom Popup */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-gold) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card), var(--shadow-gold) !important;
  color: var(--text-primary) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
}

.custom-popup {
  padding: 14px 16px;
  min-width: 200px;
}

.popup-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-gold);
  padding-bottom: 6px;
}

.popup-body {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.popup-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(240,165,0,0.1);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  color: var(--gold);
  margin: 4px 3px 0 0;
}

/* Custom Markers */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-mountain {
  background: var(--gold);
  color: #000;
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--gold-light);
  box-shadow: 0 4px 12px var(--gold-glow);
}

.marker-mountain span {
  transform: rotate(45deg);
  font-size: 12px;
  display: block;
}

/* ══════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-card), var(--shadow-gold);
  font-size: 0.8rem;
  color: var(--text-primary);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}

.toast i { color: var(--gold); }
.toast.success { border-color: rgba(0,255,136,0.4); }
.toast.success i { color: var(--green); }
.toast.error { border-color: rgba(255,68,102,0.4); }
.toast.error i { color: var(--red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 600;
    transition: transform 0.3s ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed { width: var(--sidebar-width); transform: translateX(-100%); }

  .header-stats { display: none; }
  .brand-subtitle { display: none; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
    --controls-height: 52px;
  }

  .header-content { padding: 10px 16px; }
  .controls-bar { padding: 0 12px; gap: 8px; }
  .controls-left { gap: 6px; }
  .dropdown-btn { min-width: 140px; padding: 7px 12px; font-size: 0.75rem; }

  .legend-panel { right: 12px; bottom: 12px; width: 220px; }
  .info-panel { width: 100%; }

  .welcome-title { font-size: 1.4rem; }
  .welcome-stats { gap: 16px; padding: 14px 20px; }
  .ws-num { font-size: 1.4rem; }
}

/* ══════════════════════════════════
   UTILITY CLASSES
══════════════════════════════════ */
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }
.visible-flex { display: flex !important; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glow border */
.glow-border {
  box-shadow: 0 0 0 1px var(--border-gold), var(--shadow-gold);
}

/* Shimmer effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(240,165,0,0.1) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}
/* ═══════════════════════════════════════════════
   DHARAVERSE MAPS — LABEL & POPUP FIXES
   ═══════════════════════════════════════════════ */

/* Fix Leaflet divIcon default box — causes vertical text */
.leaflet-div-icon {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Label markers — horizontal always */
.dv-label-marker {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
}

.dv-label-marker div {
    white-space: nowrap !important;
    display: inline-block !important;
    overflow: visible !important;
}

/* Info boxes */
.dv-info-box {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.dv-info-box div {
    white-space: normal !important;
    word-wrap: break-word !important;
}

/* Label toggle button */
#btnToggleLabels.active-off {
    opacity: 0.5;
    background: rgba(255, 68, 102, 0.15);
    border-color: rgba(255, 68, 102, 0.3);
}

/* Popup dark skin */
.custom-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 280px;
}

.custom-popup .popup-title {
    font-weight: 700;
    font-size: 13px;
    color: #FFD700;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 4px;
}

.custom-popup .popup-body {
    font-size: 11px;
    color: #E8E8E8;
    line-height: 1.5;
}

.popup-tag {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(240, 165, 0, 0.15);
    border: 1px solid rgba(240, 165, 0, 0.25);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    color: #F0A500;
    margin-right: 4px;
    margin-bottom: 2px;
}

.leaflet-popup-content-wrapper {
    background: rgba(10, 22, 40, 0.95) !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    color: #F0F4FF !important;
}

.leaflet-popup-tip {
    background: rgba(10, 22, 40, 0.95) !important;
}

.leaflet-popup-close-button {
    color: #FFD700 !important;
    font-size: 18px !important;
}

/* Fix panels behind map */
.legend-panel.visible,
.info-panel.visible {
    z-index: 900 !important;
}

#toastContainer {
    z-index: 9999 !important;
}
