/* ============================================================
   GeoZMap — Location Intelligence Platform
   Clean Light Design System
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface2: #eef0f4;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.13);
  --accent: #1e3a4f;      /* Dark navy from logo */
  --accent2: #2a7d8e;     /* Teal from logo */
  --accent-glow: rgba(30,58,79,0.12);
  --text: #111827;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --green: #059669;
  --yellow: #d97706;
  --red: #dc2626;
  --green-glow: rgba(5,150,105,0.1);
  --yellow-glow: rgba(217,119,6,0.1);
  --red-glow: rgba(220,38,38,0.1);
  --header-bg: #1a2f3f;  /* Logo-matched dark navy */
}

html, body { height: 100%; overflow: hidden; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }

/* ---- MAP ---- */
#map { position: fixed; inset: 0; z-index: 0; }

/* ---- HEADER ---- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; height: 64px;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; }
.logo-img {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover;
}
.logo-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.logo-accent { color: #5ec6d0; }

.header-nav { display: flex; align-items: center; gap: 24px; }
.nav-link { font-size: 14px; color: rgba(255,255,255,0.7); text-decoration: none; transition: color 0.2s; }
.nav-link:hover { color: #fff; }
.header-tag { font-size: 12px; color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.08); padding: 4px 12px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.1); }


/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 64px; left: 0; bottom: 0; z-index: 900;
  width: 300px;
  background: #fff;
  border-right: 1px solid var(--border2);
  overflow-y: auto; overflow-x: hidden;
  transition: transform 0.3s ease;
}
.sidebar-inner { padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.sidebar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.sidebar-subtitle { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

.input-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.coord-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 10px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; appearance: none;
}
.coord-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.coord-input option { background: #fff; }

.radius-options { display: flex; gap: 8px; }
.radius-btn {
  flex: 1; padding: 8px 0;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.radius-btn:hover { border-color: var(--accent); color: var(--text); }
.radius-btn.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 2px 8px var(--accent-glow); }

.analyze-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--accent);
  color: white; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.analyze-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--accent-glow); }
.analyze-btn:active { transform: translateY(0); }
.btn-icon { font-size: 17px; }

.tip-box {
  background: rgba(30,58,79,0.05); border: 1px solid rgba(30,58,79,0.12);
  border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.tip-icon { flex-shrink: 0; }

/* ---- RESULTS PANEL ---- */
.results-panel {
  position: fixed; top: 64px; right: 0; bottom: 0; z-index: 900;
  width: 340px;
  background: #fff;
  border-left: 1px solid var(--border2);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}
.results-panel.open { transform: translateX(0); }
.results-inner { padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 20px; }

.close-btn {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.close-btn:hover { background: var(--red); color: white; }

/* Location Info */
.location-info { padding-top: 4px; }
.result-category-badge {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  background: rgba(30,58,79,0.08); border: 1px solid rgba(30,58,79,0.15);
  color: var(--accent); font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 12px;
}
.location-name { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
.location-coords { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Score Ring */
.score-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 16px; padding: 20px;
}
.score-ring-wrapper { position: relative; flex-shrink: 0; width: 100px; height: 100px; }
.score-ring { width: 100px; height: 100px; transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: rgba(0,0,0,0.06); stroke-width: 8; }
.score-ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.16,1,0.3,1), stroke 0.4s;
}
.score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-number { font-size: 28px; font-weight: 800; line-height: 1; }
.score-label { font-size: 11px; color: var(--text-dim); }

.score-meta { flex: 1; }
.score-verdict { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.score-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* Breakdown */
.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.breakdown-list { display: flex; flex-direction: column; gap: 10px; }
.breakdown-item {
  background: var(--surface); border-radius: 12px; padding: 12px 14px;
  border: 1px solid var(--border);
}
.breakdown-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.breakdown-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.breakdown-score { font-size: 13px; font-weight: 700; }
.breakdown-bar-bg { height: 5px; background: rgba(0,0,0,0.06); border-radius: 99px; overflow: hidden; }
.breakdown-bar-fill { height: 100%; border-radius: 99px; transition: width 1s cubic-bezier(0.16,1,0.3,1); }
.breakdown-detail { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }

/* POI Grid */
.poi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.poi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.poi-icon { font-size: 18px; margin-bottom: 4px; }
.poi-count { font-size: 20px; font-weight: 700; line-height: 1; }
.poi-name { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Suggestions */
.suggestions-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.suggestion-item {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 12px; padding: 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.suggestion-item:hover { border-color: var(--accent); background: rgba(30,58,79,0.03); }
.suggestion-rank {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; color: #fff;
}
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-coords { font-size: 11px; color: var(--text-dim); }
.suggestion-score { font-size: 16px; font-weight: 800; flex-shrink: 0; }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-card {
  background: #fff; border: 1px solid var(--border2);
  border-radius: 20px; padding: 36px; text-align: center;
  width: 320px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.1);
}
.loading-spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid rgba(30,58,79,0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.loading-steps { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.loading-step {
  font-size: 13px; color: var(--text-dim);
  padding: 8px 12px; border-radius: 8px;
  transition: all 0.3s;
}
.loading-step.active { color: var(--text); background: rgba(30,58,79,0.06); }
.loading-step.done { color: var(--green); }

/* Color utilities */
.color-green { color: var(--green) !important; }
.color-yellow { color: var(--yellow) !important; }
.color-red { color: var(--red) !important; }
.bar-green { background: linear-gradient(90deg, #059669, #34d399); }
.bar-yellow { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-red { background: linear-gradient(90deg, #dc2626, #f87171); }
.ring-green { stroke: var(--green) !important; }
.ring-yellow { stroke: var(--yellow) !important; }
.ring-red { stroke: var(--red) !important; }

/* Leaflet Overrides */
.leaflet-container { background: #e8ecf0 !important; }
.leaflet-tile { filter: none; }
.leaflet-control-zoom { border: 1px solid var(--border2) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-control-zoom a {
  background: rgba(255,255,255,0.95) !important; color: var(--text) !important;
  border: none !important; border-bottom: 1px solid var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--surface) !important; }
.leaflet-popup-content-wrapper {
  background: #fff !important; color: var(--text) !important;
  border: 1px solid var(--border2) !important; border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
}
.leaflet-popup-tip { background: #fff !important; }

/* Custom Markers */
.custom-marker {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.9);
  font-size: 16px;
}
.marker-main {
  width: 44px; height: 44px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.2);
}
.marker-suggestion {
  width: 36px; height: 36px;
  background: var(--green);
  box-shadow: 0 0 14px var(--green-glow);
}
.marker-poi {
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.6);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* Attribution override */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important; color: var(--text-dim) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--accent2) !important; }
