/* ═══════════════════════════════════════════════════════════
   e-Delta shared.css — Sundarbans GIS 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: #f1f5f8;
  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:     #0EA56E;
  --accent-l:   #16a34a;
  --accent-dim: rgba(14,165,110,.10);

  --sidebar-bg:   #0f172a;
  --sidebar-w:    230px;

  --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;
}

/* Head */
.sb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f4c35, #0EA56E);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sb-logo svg {
  width: 16px;
  height: 16px;
  fill: white;
}
.sb-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.3px;
}
.sb-sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
}

/* 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;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.sb-section-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #475569;
  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: #94a3b8;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
}
.nav-item.active {
  background: rgba(14,165,110,.15);
  color: #4ade80;
}
.nav-item.active .ni-icon { stroke: #4ade80; }

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

/* Footer */
.sb-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.user-ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #0EA56E);
  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;
}

/* ══════════════════════════════════════════════════════════
   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(14,165,110,.08);
  border: 1px solid rgba(14,165,110,.18);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-l);
  flex-shrink: 0;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  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); }
}

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

/* Indicator / stat cards */
.is-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.is-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}
.is-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.is-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.is-lbl {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 500;
}

/* ── Feature cards (bottom row) ──── */
.fc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.fc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fc-icon svg {
  width: 14px;
  height: 14px;
  fill: white;
}
.fc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
}
.fc-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Module quick access cards ──── */
.cult-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}
.cult-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
  border-color: var(--border-2);
}
.cult-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cult-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-1);
}
.cult-sub {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD BANNER
══════════════════════════════════════════════════════════ */
.dash-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1a2744 50%, #0f3025 100%);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.dash-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(14,165,110,.18) 0%, transparent 70%);
  pointer-events: none;
}
.dash-banner-left h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}
.dash-banner-left p {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
.dash-banner-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.db-pill {
  padding: 5px 11px;
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ══════════════════════════════════════════════════════════
   MAP & LAYERS
══════════════════════════════════════════════════════════ */
.map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.map-box {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e9eff5;
}

/* 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: 7px;
}
.layer-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.layer-check {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.layer-check input {
  position: absolute;
  opacity: 0;
  width: 0;
}
.lc-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
}
.lc-content:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}
.lc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lc-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.layer-check input:checked + .lc-content {
  background: rgba(14,165,110,.06);
  border-color: rgba(14,165,110,.3);
  color: var(--text-1);
}
.layer-check input:checked + .lc-content .lc-box {
  background: var(--accent);
  border-color: var(--accent);
}
.layer-check input:checked + .lc-content .lc-box::after {
  content: '';
  display: block;
  width: 5px;
  height: 3px;
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 6px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.tab-btn {
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tab-btn:hover {
  background: var(--surface-2);
  color: var(--text-2);
}
.tab-btn.active {
  background: var(--text-1);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════════════ */
.pg-header {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  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; }

/* ══════════════════════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════════════════════ */
.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(14,165,110,.12);
}
.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
  display: block;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── 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(14,165,110,.3);
}
.btn-primary:hover {
  background: #0b9460;
  box-shadow: 0 4px 12px rgba(14,165,110,.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);
}
.btn-danger {
  background: #DC2626;
  color: white;
}
.btn-danger:hover {
  background: #b91c1c;
}

/* ══════════════════════════════════════════════════════════
   MODULE COLOR PALETTE (accent overrides per page)
══════════════════════════════════════════════════════════ */
.mod-physical  { --mod-color: #0EA56E; }
.mod-socio     { --mod-color: #2563eb; }
.mod-bio       { --mod-color: #16a34a; }
.mod-disaster  { --mod-color: #DC2626; }
.mod-cultural  { --mod-color: #D97706; }
.mod-infra     { --mod-color: #7C3AED; }
.mod-admin     { --mod-color: #0891b2; }

/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.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; }

/* 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; }

/* ══════════════════════════════════════════════════════════
   ALERT / NOTIFICATION 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(14,165,110,.07);
  border: 1px solid rgba(14,165,110,.2);
  color: #065f46;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE / SIDEBAR COLLAPSE
══════════════════════════════════════════════════════════ */
.main.full { /* sidebar closed */ }

@media (max-width: 900px) {
  .sidebar { width: 0; min-width: 0; }
  .main { }
}

/* ══════════════════════════════════════════════════════════
   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;
}
