/* ===================================================================
   Jade Portal map client — professional roofing-SaaS look, neutral palette
   =================================================================== */
:root {
  --bg:        #0f141a;
  --panel:     #171e26;
  --panel-2:   #1e2732;
  --border:    #2a3542;
  --text:      #e6ebf1;
  --text-dim:  #9aa7b4;
  --accent:    #2e8b76;   /* jade green */
  --accent-2:  #37a88e;
  --warn:      #c9822e;
  --danger:    #c0463f;
  --select:    #f0a500;   /* selected-ZIP highlight */
  --hover:     #ffffff;
  --shadow:    0 6px 22px rgba(0,0,0,.45);
  --radius:    8px;
  --fs:        13px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ---------- Top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 0 18px;
  background: linear-gradient(180deg, #1b232d, #151b23);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.brand { display: flex; flex-direction: column; line-height: 1.1; min-width: 150px; }
.brand-mark { font-weight: 800; letter-spacing: 3px; color: var(--accent-2); font-size: 18px; }
.brand-sub { font-size: 11px; color: var(--text-dim); }

.label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); }

/* storm date control */
.storm-control { flex: 1 1 auto; max-width: 520px; }
.storm-control-head { display: flex; justify-content: space-between; align-items: baseline; }
.storm-date { font-weight: 600; color: var(--text); font-size: 12px; }
.storm-control-body { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.storm-control-body input[type=range] { flex: 1; accent-color: var(--accent-2); }
.storm-status { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }

.metric-control { display: flex; flex-direction: column; gap: 3px; min-width: 170px; }

.select-sm {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; font-size: 12px;
}
.btn-icon {
  width: 30px; height: 28px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
}
.btn-icon:hover { border-color: var(--accent-2); }

/* ---------- Panels ---------- */
.panel {
  position: fixed; top: 60px; bottom: 0; z-index: 20; width: 320px;
  background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.panel-left  { left: 0; border-right: 1px solid var(--border); }
.panel-right { right: 0; border-left: 1px solid var(--border); border-right: none; }
.panel.hidden { display: none; }

.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-title {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 13px; margin-bottom: 10px;
}
.btn-link { background: none; border: none; color: var(--accent-2); cursor: pointer; font-size: 12px; }
.btn-link:hover { text-decoration: underline; }

/* selected ZIP list */
.selected-list { list-style: none; margin: 0 0 10px; padding: 0; max-height: 240px; overflow-y: auto; }
.selected-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; margin-bottom: 4px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.selected-list li .zip { font-weight: 600; }
.selected-list li .metric { color: var(--text-dim); font-size: 11px; }
.selected-list li .rm { color: var(--danger); cursor: pointer; padding: 0 4px; }
.empty-hint { color: var(--text-dim); font-size: 12px; background: none !important; border: none !important; }

.selected-summary {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0; color: var(--text-dim);
}
.selected-summary span:last-child { color: var(--text); font-weight: 600; }

/* campaign */
.channel { border: none; margin: 0 0 10px; padding: 0; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; }
.ch-content {
  width: 100%; resize: vertical; font-family: inherit; font-size: 12px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px;
}
.ch-content:disabled { opacity: .45; }

.btn-primary, .btn-secondary {
  cursor: pointer; border-radius: 6px; font-size: 12px; font-weight: 600;
  padding: 8px 12px; border: 1px solid var(--border);
}
.btn-primary { width: 100%; background: var(--accent); color: #fff; border-color: var(--accent); margin-top: 8px; }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-secondary { background: var(--panel-2); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent-2); }
.campaign-status { font-size: 11.5px; margin-top: 8px; color: var(--text-dim); min-height: 14px; }

/* drill panel data */
.drill-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.drill-actions button { flex: 1; }
.data-group { margin-bottom: 14px; }
.data-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--accent-2); border-bottom: 1px solid var(--border);
  padding-bottom: 4px; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.data-group-title .src { color: var(--text-dim); font-size: 9.5px; letter-spacing: 0; text-transform: none; }
.data-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; }
.data-row span:first-child { color: var(--text-dim); }
.todo { color: var(--warn); font-style: italic; }
.drill-hint { font-size: 11px; color: var(--text-dim); margin-top: 10px; }

/* ---------- Map ---------- */
#mapWrap { position: fixed; top: 60px; left: 320px; right: 0; bottom: 0; }
#map { position: absolute; inset: 0; }
/* when right panel visible, shrink map on the right */
body.drill-open #mapWrap { right: 320px; }

/* legend */
.legend {
  position: absolute; bottom: 24px; left: 16px; z-index: 10;
  background: rgba(23,30,38,.94); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow);
  min-width: 150px;
}
.legend-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin-bottom: 6px; }
.legend-scale { display: flex; flex-direction: column; gap: 3px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.legend-swatch { width: 18px; height: 12px; border-radius: 3px; flex: none; }

/* tooltip */
.tooltip {
  position: absolute; z-index: 15; pointer-events: none;
  background: rgba(15,20,26,.96); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 9px; font-size: 12px;
  box-shadow: var(--shadow); transform: translate(-50%, -120%); white-space: nowrap;
}
.tooltip .t-zip { font-weight: 700; }
.tooltip .t-metric { color: var(--text-dim); font-size: 11px; }
.tooltip.hidden { display: none; }

/* zoom badge */
.zoom-badge {
  position: absolute; bottom: 24px; right: 16px; z-index: 10;
  background: rgba(23,30,38,.94); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 9px; font-size: 11px; color: var(--text-dim);
  box-shadow: var(--shadow);
}

/* maplibre control tweaks for dark theme */
.maplibregl-ctrl-group { background: var(--panel-2); }
.maplibregl-ctrl-group button { background: var(--panel-2); }
.maplibregl-ctrl-attrib { background: rgba(23,30,38,.7) !important; }
.maplibregl-ctrl-attrib a { color: var(--text-dim); }
