/* =============================================================================
   style.css — Shared map application styles
   All geography-specific overrides go in that geography's config.js or a
   local style block in its index.html.
   ============================================================================= */

/* ── IMPORTS ────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=DM+Sans:wght@300;400;500&display=swap');

/* ── RESET & BASE ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-deep:    #1b3a2f;
  --green-mid:     #2a5240;
  --green-light:   #3d7a5e;
  --gold:          #c4963a;
  --cream:         #f5f0e8;
  --sidebar-bg:    #1e2d28;
  --sidebar-width: 340px;
  --navbar-h:      52px;
  --panel-radius:  4px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.12);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.18);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}

/* ── NAVBAR ─────────────────────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

#app-title {
  font-family: 'DM Sans', sans-serif; /*'Cormorant Garamond', serif;*/
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
}

.navbar-btn {
  padding: 0.35rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: var(--panel-radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  border: none;
}

.btn-outline {
  background: transparent;
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.btn-gold {
  background: var(--gold);
  color: #fff;
  border: 1px solid var(--gold);
}

.btn-gold:hover { background: #b88430; }

.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.72rem; }

.navbar-right { display: flex; align-items: center; gap: 0.5rem; }

/* ── MAP ─────────────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* ── DST PANEL (sidebar) ────────────────────────────────────────────────────── */
#dst-panel {
  position: fixed;
  top: var(--navbar-h);
  right: 0;
  width: var(--sidebar-width);
  bottom: 0;
  background: var(--sidebar-bg);
  color: #e8e8e8;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  overflow: hidden;
}

#dst-panel.open { transform: translateX(0); }

.dst-header {
  padding: 1.2rem 1.4rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.dst-header h2 {
  font-family: 'DM Sans', monospace; */'Cormorant Garamond', serif;*/
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
}

.dst-header p {
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(255,255,255,0.45);
  line-height: 1.5;
}

.dst-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.dst-body::-webkit-scrollbar { width: 5px; }
.dst-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Section headings inside DST panel */
.dst-section {
  margin-bottom: 1.2rem;
}

.dst-section-title {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(196,150,58,0.3);
}

/* Individual criterion slider block */
.criterion-row {
  margin-bottom: 1.2rem;
}

.criterion-label {
  font-size: 0.8rem;
  font-weight: 300;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  min-height: 2.4em;
}

.criterion-label strong {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.slider-wrap input[type=range] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.slider-wrap input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}

.slider-val {
  width: 36px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gold);
  font-family: 'DM Sans', monospace;
  flex-shrink: 0;
}

/* Consistency index display */
.consistency-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.4rem;
}

.cr-value {
  font-weight: 500;
  font-family: monospace;
}

.cr-good  { color: #5dbf7a; }
.cr-bad   { color: #e06b6b; }

/* DST footer buttons */
.dst-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.dst-footer button {
  flex: 1;
  padding: 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: var(--panel-radius);
  cursor: pointer;
  transition: background 0.15s;
}

#btn-reset {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}

#btn-reset:hover { background: rgba(255,255,255,0.14); }

#btn-calculate {
  background: var(--gold);
  color: #fff;
}

#btn-calculate:hover { background: #b88430; }

/* D3 chart area */
#dst-chart {
  margin-top: 0.5rem;
  min-height: 160px;
}

/* ── HOVER INFO BOX ─────────────────────────────────────────────────────────── */
#info-box {
  position: fixed;
  pointer-events: none;
  z-index: 900;
  background: rgba(255,255,255,0.97);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-md);
  padding: 0;
  min-width: 210px;
  max-width: 280px;
  font-size: 0.82rem;
  display: none;
  overflow: hidden;
}

#info-box.visible { display: block; }

.info-header {
  background: #555;
  color: #fff;
  padding: 0.4rem 0.7rem;
  font-weight: 500;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
}

.info-body {
  padding: 0.4rem 0.7rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.2rem 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 0.5rem;
}

.info-row:last-child { border-bottom: none; }

.info-key {
  color: #666;
  font-weight: 400;
  flex-shrink: 0;
}

.info-val {
  font-weight: 500;
  color: #222;
  text-align: right;
}

/* ── LEGEND ─────────────────────────────────────────────────────────────────── */
.map-legend {
  background: rgba(255,255,255,0.95);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.78rem;
  max-width: 200px;
  line-height: 1.4;
}

.legend-title {
  font-weight: 500;
  font-size: 0.75rem;
  color: #333;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.legend-swatch {
  width: 22px;
  height: 13px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
}

.legend-label {
  color: #555;
  font-size: 0.72rem;
  white-space: nowrap;
}

.legend-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.8rem;
  margin-top: 0.3rem;
}

.legend-dual-head {
  font-size: 0.68rem;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

/* ── OPACITY CONTROL ────────────────────────────────────────────────────────── */
#opacity-control {
  position: fixed;
  bottom: 2rem;
  left: 1rem;
  background: rgba(255,255,255,0.95);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0.9rem;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: #555;
  min-width: 180px;
}

#opacity-control label {
  white-space: nowrap;
  font-weight: 500;
}

#opacity-slider {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green-mid);
  cursor: pointer;
}

/* ── SEARCH ─────────────────────────────────────────────────────────────────── 
#search-box {
  position: fixed;
  top: calc(var(--navbar-h) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: rgba(255,255,255,0.96);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  overflow: hidden;
  min-width: 240px;
}

#search-input {
  border: none;
  outline: none;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  flex: 1;
  background: transparent;
}

#search-btn {
  padding: 0.5rem 0.75rem;
  background: var(--green-deep);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
}
*/
/* ── LEAFLET OVERRIDES ──────────────────────────────────────────────────────── */
.leaflet-control-layers {
  border-radius: var(--panel-radius) !important;
  box-shadow: var(--shadow-sm) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 0.82rem !important;
}

.leaflet-control-layers-toggle {
  background-color: var(--green-deep) !important;
}

.leaflet-bar a {
  border-radius: 0 !important;
  font-family: 'DM Sans', sans-serif !important;
}

.leaflet-bar a:first-child { border-radius: var(--panel-radius) var(--panel-radius) 0 0 !important; }
.leaflet-bar a:last-child  { border-radius: 0 0 var(--panel-radius) var(--panel-radius) !important; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --sidebar-width: 100vw; }
  #opacity-control { bottom: 1rem; right: 0.5rem; }
  #search-box { min-width: 180px; }
}

/* ── UTILITY ─────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
