/* ═══════════════════════════════════════════════════════════
   e-Himalaya shared.css — GTA Smart Governance Platform
   Design: Dark sidebar · Light content · Module accent colors
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  display: flex;
  height: 100vh;
  overflow: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --accent:     #2563eb;
  --accent-l:   #1d4ed8;
  --accent-dim: rgba(37,99,235,.10);

  --sidebar-bg:   #0c1a2e;
  --sidebar-w:    238px;

  --surface:    #ffffff;
  --surface-2:  #f8fafc;
  --border:     #e2e8f0;
  --border-2:   #cbd5e1;

  --text-1:     #0f172a;
  --text-2:     #334155;
  --text-3:     #64748b;
  --text-4:     #94a3b8;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  14px;

  --transition: 0.18s ease;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition), min-width var(--transition);
  position: relative;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar.closed { width: 0; min-width: 0; }

/* Himalaya mountain bg in sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('sidebarbg.png');
  background-size: cover;
  background-position: center top;
  z-index: 0;
  pointer-events: none;
}
/* Mountain silhouette overlay at bottom */
.sidebar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(180deg, transparent 0%, rgba(12,26,46,0.9) 100%);
  z-index: 0;
  pointer-events: none;
}

/* Head */
.sb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Nav */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
  position: relative;
  z-index: 1;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.074); border-radius: 2px; }

.sb-section-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #93c5fd;
  padding: 10px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  margin: 1px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #cbd5e1;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #bfdbfe;
}
.nav-item.active {
  background: rgba(37,99,235,0.20) !important;
  color: #93c5fd !important;
  box-shadow: inset 2px 0 0 #3b82f6;
}
.nav-item.active .ni-icon { stroke: #93c5fd !important; }

.ni-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: #94a3b8;
  transition: stroke var(--transition);
}
.nav-item:hover .ni-icon { stroke: #bfdbfe; }

/* Footer */
.sb-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.user-row { display: flex; align-items: center; gap: 9px; }
.user-ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 10px; color: #64748b; margin-top: 1px; }

/* Sidebar logo */
.sb-logo-img {
  height: 76px; width: auto; object-fit: contain; display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

/* ══════════════════════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════════════════════ */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; transition: all var(--transition);
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 0 var(--border);
}
.tb-menu {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-3);
  transition: background var(--transition), color var(--transition); flex-shrink: 0;
}
.tb-menu:hover { background: var(--surface-2); color: var(--text-1); }
.tb-title {
  font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 700;
  color: var(--text-1); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-pill {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 20px; background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.18); font-size: 11px; font-weight: 500;
  color: #2563eb; flex-shrink: 0;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%; background: #3b82f6;
  animation: pulse 2s infinite; display: inline-block;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.85); }
}
.tb-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tb-time { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-3); }
.tb-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; transition: background var(--transition);
}
.tb-btn:hover { background: var(--border); }

/* ── Content ────────────────────────────────────────────── */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.page-animate { animation: fadeUp .35s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   PAGE HERO BANNER
══════════════════════════════════════════════════════════ */
.page-hero {
  width: calc(100% - 40px); height: 86px; border-radius: 14px;
  overflow: hidden; margin: 20px 20px 0; position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,0.16); flex-shrink: 0;
}
.page-hero img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 30%; display: block;
}
.page-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,20,60,0.78) 0%, rgba(10,30,80,0.45) 55%, transparent 100%);
  display: flex; align-items: center; padding: 0 24px; gap: 14px;
}
.page-hero-icon {
  width: 42px; height: 42px; border-radius: 11px; border-width: 1.5px;
  border-style: solid; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; backdrop-filter: blur(6px);
}
.page-hero-text h2 {
  font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700;
  color: #f1f5f9; margin: 0; text-shadow: 0 1px 8px rgba(0,0,0,0.45); letter-spacing: -0.3px;
}
.page-hero-text p {
  font-size: 11px; color: rgba(226,232,240,0.76); margin-top: 3px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* ══════════════════════════════════════════════════════════
   CARDS & SURFACES
══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

/* Stat cards */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px 18px; position: relative; overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .sc-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .sc-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; color: var(--text-1); margin: 4px 0 2px; line-height: 1; }
.stat-card .sc-sub { font-size: 11px; color: var(--text-3); }
.stat-card .sc-icon {
  position: absolute; right: 14px; top: 14px; width: 36px; height: 36px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-card .sc-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
}

/* Section headers */
.section-title {
  font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--text-1); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Map container */
.map-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 14px; margin-bottom: 14px;
}
.map-box { border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }

/* Layer panel */
.layer-panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px;
}
.layer-panel-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-3); margin-bottom: 8px;
}
.layer-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.layer-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.layer-check input { display: none; }
.lc-content { display: flex; align-items: center; gap: 6px; }
.lc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lc-box {
  width: 14px; height: 14px; border-radius: 3px; border: 2px solid var(--border-2);
  background: var(--surface); transition: all var(--transition); flex-shrink: 0;
}
.layer-check input:checked ~ .lc-content .lc-box {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
.layer-check span { font-size: 12px; color: var(--text-2); font-weight: 500; }

/* Tabs */
.tab-bar {
  display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap;
}
.tab-btn {
  padding: 7px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); transition: all var(--transition); white-space: nowrap;
}
.tab-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.tab-btn.active {
  background: var(--accent); color: white; border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  padding: 9px 12px; text-align: left; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tr:hover td { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 12px; font-size: 10.5px; font-weight: 600;
}
.badge-green  { background: rgba(22,163,74,.1);  color: #15803d; }
.badge-red    { background: rgba(220,38,38,.1);   color: #b91c1c; }
.badge-orange { background: rgba(217,119,6,.1);   color: #b45309; }
.badge-blue   { background: rgba(37,99,235,.1);   color: #1d4ed8; }
.badge-purple { background: rgba(124,58,237,.1);  color: #6d28d9; }
.badge-cyan   { background: rgba(8,145,178,.1);   color: #0e7490; }
.badge-sky    { background: rgba(14,165,233,.1);  color: #0369a1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,.4); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-2); }

/* Form */
.form-input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 13px;
  color: var(--text-1); background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition); outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; display: block; }

/* Alert strip */
.alert-strip {
  padding: 9px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.alert-strip.warning { background: rgba(217,119,6,.08); border: 1px solid rgba(217,119,6,.22); color: #92400e; }
.alert-strip.danger  { background: rgba(220,38,38,.07);  border: 1px solid rgba(220,38,38,.2);  color: #991b1b; }
.alert-strip.info    { background: rgba(37,99,235,.07);  border: 1px solid rgba(37,99,235,.2);  color: #1e40af; }
.alert-strip.success { background: rgba(22,163,74,.07);  border: 1px solid rgba(22,163,74,.2);  color: #15803d; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 11.5px; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Module color palette */
.mod-heritage  { --mod-color: #D97706; }
.mod-homestay  { --mod-color: #16a34a; }
.mod-transport { --mod-color: #2563eb; }
.mod-fmcg      { --mod-color: #7C3AED; }
.mod-disaster  { --mod-color: #DC2626; }
.mod-land      { --mod-color: #0891b2; }
.mod-ev        { --mod-color: #16a34a; }
.mod-health    { --mod-color: #e11d48; }
.mod-finance   { --mod-color: #0EA56E; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 0; min-width: 0; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}

/* Leaflet overrides */
.leaflet-container { font-family: 'DM Sans', sans-serif !important; }
.leaflet-popup-content-wrapper { border-radius: 10px !important; box-shadow: var(--shadow-md) !important; font-size: 12px; }
.leaflet-tooltip { font-size: 11.5px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.leaflet-control-zoom { border: 1px solid var(--border) !important; border-radius: 8px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 28px !important; height: 28px !important; line-height: 28px !important; font-size: 16px !important; }

/* ── New Tree Sidebar Nav (added for restructure) ────────── */
.sb-tree-section { margin: 0; }
.sb-tree-header {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; margin: 1px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #e2e8f0;
  cursor: pointer; transition: background .15s, color .15s;
  user-select: none; white-space: nowrap; position: relative;
}
.sb-tree-header:hover { background: rgba(255,255,255,.07); color: #bfdbfe; }
.sb-tree-chevron {
  margin-left: auto; flex-shrink: 0; width: 13px; height: 13px;
  stroke: #64748b; transition: transform .2s ease, stroke .15s;
}
.sb-tree-header:hover .sb-tree-chevron { stroke: #93c5fd; }
.sb-tree-header.open .sb-tree-chevron { transform: rotate(90deg); stroke: #93c5fd; }
.sb-tree-children { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.sb-tree-children.open { max-height: 600px; }
.sb-tree-child {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 36px; margin: 1px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 400; color: #94a3b8;
  cursor: pointer; transition: background .13s, color .13s;
  white-space: nowrap; text-decoration: none;
}
.sb-tree-child:hover { background: rgba(255,255,255,.05); color: #bfdbfe; }
.sb-tree-child.active { background: rgba(37,99,235,0.18); color: #93c5fd; font-weight: 500; }
.sb-tree-child::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #334155; flex-shrink: 0; margin-left: -14px; transition: background .13s;
}
.sb-tree-child:hover::before, .sb-tree-child.active::before { background: #3b82f6; }
.sb-section-top {
  font-size: 9px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase;
  color: #86b8fe; padding: 12px 16px 3px;
}
.nav-item-single {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; margin: 1px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #e2e8f0; white-space: nowrap;
  transition: background .15s, color .15s; cursor: pointer; text-decoration: none;
}
.nav-item-single:hover { background: rgba(255,255,255,.07); color: #bfdbfe; }
.nav-item-single.active { background: rgba(37,99,235,0.20); color: #93c5fd; box-shadow: inset 2px 0 0 #3b82f6; }
.nav-item-single .ni-icon { stroke: #64748b; }
.nav-item-single:hover .ni-icon, .nav-item-single.active .ni-icon { stroke: #93c5fd; }
