/* ─── Palette ─────────────────────────────────────────────── */
:root {
  --c-tan:    #eee1cd;
  --c-sand:   #ca9f5f;
  --c-mid:    #c77203;
  --c-orange: #e85d04;
  --c-dark:   #8b4300;
  --c-brush:  #c77203;
}

/* ─── Global Reset ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Base Layout ──────────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 8px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #edf5ff;
  overflow: hidden;
}

/* ─── Header ───────────────────────────────────────────────── */
#site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

#header-left {
  flex-shrink: 0;
}

#header-left h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

#header-subtitle {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ─── KPI Strip ────────────────────────────────────────────── */
#kpi-strip {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid #e0d8cc;
  border-radius: 8px;
  padding: 5px 18px;
  min-width: 110px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c-dark);
  line-height: 1.1;
}

.kpi-label {
  font-size: 9.5px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
}

/* ─── Header Controls ──────────────────────────────────────── */
#header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#header-controls label {
  display: flex;
  align-items: center;
  gap: 4px;
}

#header-controls select,
#header-controls button {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

#header-controls button:hover {
  background: #f0f0f0;
}

#brush-toggle.active,
#toggle-heatmap.active {
  background: var(--c-mid);
  color: #fff;
  border-color: var(--c-dark);
}

.info-text {
  font-size: 11px;
  color: #888;
}
/* ─── Data Selection ─────────────────────────────────────────────────── */
#choose-data {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-size: 12px;
  gap: 6px;
}

#choose-data .data-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

#choose-data .data-options label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
}

#choose-data .data-options input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

#choose-data .data-actions {
  display: flex;
  gap: 8px;
}

#choose-data .data-actions button {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

#choose-data .data-actions button:hover {
  background: #f0f0f0;
}
/* ─── Card ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e0d8cc;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.card-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-mid);
  flex-shrink: 0;
  margin-bottom: 4px;
}

/* ─── Maps Row ─────────────────────────────────────────────── */
#maps-row {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#my-map,
#choropleth-map {
  flex: 1;
  min-height: 0;
}

/* ─── Timeline ─────────────────────────────────────────────── */
#timeline-panel {
  height: 150px;
  flex-shrink: 0;
}

#timeline-chart {
  flex: 1;
  min-height: 0;
}

/* ─── Bottom Row ───────────────────────────────────────────── */
#bottom-row {
  height: 195px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  gap: 8px;
}

#lollipop-chart,
#barchart-priority {
  flex: 1;
  min-height: 0;
}

#donut-chart {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG sizing */
#timeline-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

#lollipop-chart svg,
#barchart-priority svg {
  display: block;
  width: 100%;
  height: auto;
}

#donut-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── Tooltip ──────────────────────────────────────────────── */
#tooltip {
  position: absolute;
  opacity: 0;
  z-index: 100000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  padding: 8px 12px;
  pointer-events: none;
  max-width: 320px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.tooltip-label {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-mid);
}

.tooltip-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: #2c3e50;
}

.tooltip-row {
  font-size: 12px;
  color: #555;
}

.tooltip-row strong {
  color: #333;
}

/* ─── Legend (Leaflet) ─────────────────────────────────────── */
.legend {
  background: rgba(255,255,255,0.95);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.legend i {
  width: 14px;
  height: 14px;
  float: left;
  margin-right: 6px;
  border: 1px solid #ccc;
}

.legend .gradient-bar {
  width: 100%;
  height: 12px;
  border: 1px solid #ccc;
  border-radius: 2px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.legend-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* ─── Word Cloud ───────────────────────────────────────────── */
#word-cloud-chart {
  flex: 1;
  min-height: 0;
  position: relative;
}

.wc-empty-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #888;
  font-style: italic;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  display: none;
  margin: 0;
}

#word-cloud-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.cloud-word {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.cloud-word.wc-selected {
  font-weight: 700;
}

.wc-empty {
  fill: #999;
  font-size: 12px;
  font-style: italic;
}

/* ─── Chart Styling ────────────────────────────────────────── */
.bar,
.arc,
.timeline-bar {
  cursor: pointer;
}

.axis-title,
.axis-label {
  font-size: 11px;
  fill: #555;
}

/* Lollipop */
.lollipop-line {
  stroke: var(--c-mid);
  stroke-width: 2;
}

.lollipop-circle {
  fill: var(--c-mid);
  cursor: pointer;
}

/* Brush */
.brush .selection {
  fill: var(--c-brush);
  fill-opacity: 0.15;
  stroke: var(--c-brush);
}

.brush .handle {
  fill: var(--c-brush);
  fill-opacity: 0.5;
}
