/* ================= ROOT VARIABLES ================= */
:root {
  --bg-main: #000000;
  --bg-card: #0e0e0e;
  --bg-sidebar: #0f0f0f;

  --primary: #2563eb;
  --secondary: #1d4ed8;
  --success: #22c55e;

  --border: rgba(255, 255, 255, 0.08);

  --text-main: #e5e7eb;
  --text-muted: #9ca3af;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ================= RESET ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 10px;
}

/* ================= LAYOUT STRUCTURE ================= */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 70px);
}

/* ================= CONTENT ================= */
.content {
  padding: 24px;
  overflow-y: auto;
}

/* ================= GRID TOP (2 COLUMN - CHARTS + AI) ================= */
.grid-top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.grid-top .card.large {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: auto;
}

/* ================= GRID BOTTOM (FULL WIDTH) ================= */
.grid-bottom {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* ================= CARD BASE ================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.card h2 {
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 600;
}

.card p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* AI Insights Card */
.card.ai {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
}

.card.ai h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

.card.ai p {
  font-size: 22px;
  color: var(--text-main);
}

/* ================= CHART CONTAINERS ================= */
.chart-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 32px;
}

.chart-box {
  position: relative;
  height: 450px;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* overflow: hidden; */
}

.chart-box canvas {
  display: none;
  width: 100% !important;
  height: 100% !important;
}

.chart-placeholder {
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 2rem;
}

.chart-box.loading .chart-placeholder {
  display: none;
}

.chart-box.loading canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

#chart1-header,
#chart2-header,
#chart3-header {
  /* margin-bottom: 16px; */
  font-size: 16px;
  /* font-weight: 600; */
  color: var(--text-main);
}

/* ================= CHART LOADER ================= */
#chart-loader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-loader-card {
  background: rgba(18, 18, 18, 0.95);
  padding: 28px 34px;
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border);
}

.chart-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #2563eb;
  border-top-color: transparent;
  animation: chartSpin 1s linear infinite;
  margin: 0 auto 14px;
}

.chart-loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

@keyframes chartSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ================= NAVBAR ================= */
.navbar {
  height: 70px;
  background: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo img {
  /* background: var(--primary); */
  /* color: white; */
  width: 62px;
  height: 40px;
  /* border-radius: 10px; */
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-left h1 {
  font-size: 15px;
  font-weight: 600;
}

.nav-left h1 a {
  text-decoration: none;
  color: var(--text-main);
}

.nav-left p {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-right a,
.nav-icons span {
  color: var(--text-muted);
  text-decoration: none;
}

/* ================= FILE UPLOAD ================= */
.file-compo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-type {
  height: 34px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--bg-main);
  color: var(--text-main);
  border: 1px solid var(--border);
  font-size: 13px;
  outline: none;
  transition: border 0.2s ease;
}

.upload-type:hover {
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.upload-type option {
  background: #0e0e0e;
  color: var(--text-main);
  padding: 8px;
}

.upload-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.upload-btn:hover {
  transform: translateY(-1px);
  background: #2563eb;
}

.upload-btn i {
  font-size: 15px;
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

/* ================= SIDEBAR ================= */
.sidebar {
  background: var(--bg-sidebar);
  padding: 20px;
  border-right: 1px solid var(--border);
}

.sidebar h3 {
  font-size: 13px;
  margin-bottom: 20px;
  color: var(--text-muted);
}

.sidebar label {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar select,
.sidebar input {
  width: 100%;
  margin: 6px 0 14px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  outline: none;
  transition: border 0.2s ease;
}

.sidebar select:hover,
.sidebar input:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.sidebar select:focus,
.sidebar input:focus {
  border-color: var(--primary);
}

.sidebar select option {
  background: #0e0e0e;
  color: var(--text-main);
  padding: 8px;
}

/* ================= BUTTONS ================= */
.primary-btn {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary-btn:hover {
  background: var(--secondary);
}

.secondary-btn {
  padding: 10px 16px;
  background: white;
  color: var(--primary);
  border-radius: 10px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.secondary-btn:hover {
  background: #f0f0f0;
}

/* ================= HEATMAP LAYOUT ================= */
.map-layout {
  display: flex;
  gap: 16px;
  height: 500px;
  margin-top: 12px;
}

#map.heatmap {
  flex: 1;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle at top, #0b1220, #000);
  box-shadow: inset 0 0 0 1px var(--border);
}

#mapFilters {
  width: 240px;
  height: 100%;
  background: var(--bg-sidebar);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  overflow-y: auto;
}

#mapFilters h4 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#mapFilters label {
  font-size: 11px;
  color: var(--text-muted);
}

#mapFilters select {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: border 0.2s ease;
}

#mapFilters select:hover {
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#mapFilters select:focus {
  border-color: var(--primary);
}

#mapFilters select option {
  background: #0e0e0e;
  color: #ebe7e5;
  border: none;
}

.leaflet-bar a:hover {
  background: #1f2933;
}

/* REMOVE HOVER OUTLINE / SQUARE */
.leaflet-interactive {
  outline: none !important;
}

/* TOOLTIP (MATCHES YOUR DASHBOARD) */
.leaflet-tooltip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.leaflet-tooltip::before {
  display: none !important;
  /* ❌ removes white arrow */
}

.dark-tooltip {
  background: transparent;
  border: none;
}

.tooltip-card {
  background: rgba(14, 14, 14, 0.818);
  /* ⬅ softer glass */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  border-radius: 18px;
  padding: 14px 16px;
  min-width: 240px;

  color: var(--text-main);

  /* ❌ remove white border completely */
  border: none;

  /* subtle depth only */
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}

.tooltip-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-main);
}

.tooltip-row b {
  font-weight: 600;
}

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tooltip-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c) !important;
}

/* Dominant capsule */
.tooltip-pill {
  background: rgb(0, 0, 0);
  /* ⬅ dark, not opaque */
  color: var(--c);
  border: 2px solid var(--c);
  padding: 4px 12px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;

  border: none;
  /* ❌ no outline */
  box-shadow: none;
  /* ❌ no glow */
}

/* LEGEND (SUBTLE & MODERN) */
.map-legend {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 1200;
  /* 🔥 critical */

  background: rgba(14, 14, 14, 0.81);
  backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: 12px 14px;

  font-size: 11px;
  color: var(--text-main);

  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75);
}

.map-legend .legend-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--text-muted);
}

.map-legend .legend-item span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}



/* ================= SCROLLBAR ================= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 10px;
}


/* ================= EXPORT REPORT BUTTON ================= */

.export-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* Base button */
.export-btn {
  padding: 10px 22px;
  border-radius: 10px;
  background: #ffffff;
  color: #2563eb;
  border: none;
  width: 100%;
  font-size: 13px;
  font-weight: 500;

  cursor: pointer;

  transition:
    box-shadow 0.3s ease,
    font-weight 0.2s ease,
    background 0.2s ease;
}

/* Hover → only glow + bold */
.export-btn:hover {
  font-weight: 600;
  background-color: #4078f2;
  color: white;
  /* 🌌 Dark navy glow without movement */
  box-shadow:
    0 0 0 1px rgba(55, 114, 243, 0.25),
    0 0 16px rgba(52, 103, 213, 0.55),
    0 0 32px rgba(189, 208, 249, 0.35);
}

/* Click effect (pressed look, no resize) */
.export-btn:active {
  background: #f1f5ff;
  /* subtle click feedback */
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.35),
    0 0 10px rgba(37, 99, 235, 0.45);
}