/* =============================================================
   JANATA · Map + Stats styles (v3)
   Depends on app.css design tokens.
   ============================================================= */

/* Full-bleed inside the view container */
.kmap-wrap, .kstats-wrap {
  padding: 0 0 90px;
  display: block;
}

/* ---------- Header ---------- */
.kmap-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 12px;
}
.kmap-eye {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--kr-red, #C4392F);
}
.kmap-h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.25;
}
.kmap-chip {
  min-width: 74px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(196, 57, 47, 0.12), rgba(255, 207, 47, 0.15));
  border: 1px solid rgba(196, 57, 47, 0.20);
  text-align: right;
}
.kmap-chip .v {
  font-size: 22px;
  font-weight: 800;
  color: var(--kr-red, #C4392F);
  line-height: 1;
}
.kmap-chip .l {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 4px;
}

/* ---------- Filter chips ---------- */
.kmap-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0 18px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.kmap-chips::-webkit-scrollbar { display: none; }
.kmap-chip-fil {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-soft, #ECEFF5);
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.kmap-chip-fil .ic { font-size: 14px; line-height: 1; }
.kmap-chip-fil:hover { transform: translateY(-1px); }
.kmap-chip-fil.on {
  border-color: var(--tc, #C4392F);
  background: color-mix(in srgb, var(--tc, #C4392F) 10%, white 90%);
  color: var(--ink);
}

/* ---------- Map canvas ---------- */
.kmap-canvas {
  height: 60vh;
  min-height: 340px;
  max-height: 620px;
  margin: 4px 12px 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-soft, #ECEFF5);
  background: #EEF2F7;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
}

/* Leaflet overrides */
.leaflet-container {
  font-family: inherit;
  background: #EEF2F7;
}
.leaflet-tooltip.kmap-tip {
  background: #111827;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.leaflet-tooltip.kmap-tip:before { border-top-color: #111827; }
.leaflet-popup.kmap-popwrap .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
}
.leaflet-popup.kmap-popwrap .leaflet-popup-content { margin: 0; }
.kmap-pop {
  min-width: 200px;
  max-width: 260px;
  overflow: hidden;
  border-radius: 12px;
}
.kmap-pop-photo {
  width: 100%;
  height: 128px;
  overflow: hidden;
  background: #EEF2F7;
}
.kmap-pop-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.kmap-pop-body {
  padding: 10px 12px;
}
.kmap-pop .e {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.kmap-pop .t {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 3px;
  line-height: 1.3;
}
.kmap-pop .s {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 4px;
}

/* ---------- Legend ---------- */
.kmap-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 11px;
}
.kmap-legend::-webkit-scrollbar { display: none; }
.kmap-legend .ttl {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.kmap-legend .row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-2);
  font-weight: 600;
  flex: 0 0 auto;
}
.kmap-legend .sw {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

/* ---------- Bottom CTA ---------- */
.kmap-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 18px 0;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #059669, #0EA5E9);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.24);
}
.kmap-cta .ic {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
}
.kmap-cta .sub {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}
.kmap-cta.secondary {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.22);
}

/* ---------- Stats view: KPI cards ---------- */
.kstats-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 18px 8px;
}
.kstats-kpi {
  padding: 16px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--kc, #C4392F) 14%, white 86%), white);
  border: 1px solid color-mix(in srgb, var(--kc, #C4392F) 25%, white 75%);
  text-align: left;
}
.kkpi-v {
  font-size: 28px;
  font-weight: 800;
  color: var(--kc, #C4392F);
  line-height: 1;
}
.kkpi-l {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 6px;
}

/* ---------- Section headers ---------- */
.kstats-section-h {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 16px 18px 6px;
}

/* ---------- Horizontal bars ---------- */
.kstats-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 6px;
}
.kbar-row {
  display: grid;
  grid-template-columns: 34px 100px 1fr 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line-soft, #ECEFF5);
}
.kbar-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.kbar-rank {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: 0.06em;
  text-align: center;
}
.kbar-lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kbar-track {
  height: 8px;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.kbar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease-out;
}
.kbar-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Home tile for the new Explore Karnataka block ---------- */
.explore-kn-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 0;
}
.explore-kn-card {
  display: block;
  padding: 14px 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 122px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
}
.explore-kn-card.map  { background: linear-gradient(135deg, #C4392F 0%, #EA580C 100%); }
.explore-kn-card.stats { background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%); }
.explore-kn-card .eye {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.explore-kn-card .ttl {
  font-size: 16px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1.2;
}
.explore-kn-card .sub {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.9;
  line-height: 1.35;
}
.explore-kn-card .art {
  position: absolute;
  right: -6px;
  bottom: -14px;
  font-size: 68px;
  opacity: 0.28;
  filter: saturate(1.2);
}

/* ---------- Small screens ---------- */
@media (max-width: 380px) {
  .kbar-row { grid-template-columns: 30px 90px 1fr 36px; gap: 8px; padding: 7px 8px; }
  .kmap-canvas { height: 55vh; }
}
