/* DSIG Prospect Engine — UI styles */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #1a1f36;
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ── */
.topbar {
  background: linear-gradient(135deg, #1F3864 0%, #2E74B5 100%);
  color: white;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .logo { font-size: 22px; }
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.env-tag {
  background: rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.topbar nav a:hover { background: rgba(255,255,255,0.2); }
.topbar nav a.active { background: rgba(255,255,255,0.3); font-weight: 600; }

/* ── Layout: sidebar + map ── */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  overflow: hidden;
}

.controls {
  background: white;
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid #eaecef;
}
.controls h2 {
  font-size: 16px;
  color: #1F3864;
  margin-bottom: 4px;
}
.controls .hint {
  font-size: 13px;
  color: #697386;
  margin-bottom: 18px;
}

.control-block {
  margin-bottom: 20px;
}
.control-block label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.pin-location {
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #1F3864;
  border: 1px solid #e3e8ee;
}
.pin-location.set { border-color: #2E74B5; background: #f0f6ff; }

input[type="range"] { width: 100%; }
input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #e3e8ee;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: #2E74B5; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chips label {
  text-transform: none;
  letter-spacing: 0;
  background: #f8fafc;
  border: 1px solid #e3e8ee;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 500;
  color: #4a5568;
}
.chips label:has(input:checked) {
  background: #1F3864;
  color: white;
  border-color: #1F3864;
}
.chips input { margin: 0; }

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  background: #1F3864;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #16294a; }
.btn-primary:disabled { background: #aab1bd; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 10px 14px;
  background: white;
  color: #2E74B5;
  border: 1.5px solid #2E74B5;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #2E74B5; color: white; }

/* ── Summary block ── */
.summary {
  background: #f0f6ff;
  border: 1px solid #c5dcf5;
  border-radius: 8px;
  padding: 14px;
}
.summary h3 {
  font-size: 13px;
  color: #1F3864;
  margin-bottom: 8px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
}
.summary-row strong { color: #1F3864; }

/* ── Usage block ── */
.usage-block {
  margin-top: 24px;
  padding: 14px;
  background: #fff8e6;
  border: 1px solid #f5d574;
  border-radius: 8px;
  font-size: 11px;
}
.usage-block h4 {
  color: #6b4f00;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.usage-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}
.usage-grid .label { color: #4a5568; }
.usage-grid .value { font-weight: 600; color: #6b4f00; font-variant-numeric: tabular-nums; }
.usage-grid .value.ok { color: #1d7a3a; }
.usage-grid .value.warn { color: #b3261e; }

/* ── Map ── */
.map-area {
  position: relative;
}
#map {
  height: 100%;
  width: 100%;
}

.leaflet-popup-content {
  font-size: 13px;
  min-width: 200px;
}
.popup-name { font-weight: 600; color: #1F3864; margin-bottom: 4px; }
.popup-address { color: #697386; font-size: 12px; }
.popup-phone { color: #1d7a3a; font-weight: 600; margin-top: 6px; }
.popup-flag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  margin-top: 4px;
}
.popup-flag.verified { background: #d4f4dd; color: #1d7a3a; }
.popup-flag.high { background: #cce5ff; color: #1F3864; }
.popup-flag.medium { background: #fff0c9; color: #8a6100; }
.popup-flag.low { background: #f1f3f5; color: #697386; }

/* ── Loading overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}
.spinner {
  border: 3px solid #f1f3f5;
  border-top: 3px solid #2E74B5;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .controls { max-height: 50vh; }
}
