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

:root {
  --primary: #1a56db;
  --primary-dark: #1241b0;
  --success: #057a55;
  --warning: #c27803;
  --danger: #c81e1e;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --sidebar-w: 360px;
  --header-h: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  flex-shrink: 0;
  z-index: 1000;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.4rem; }
.logo-text { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.logo-tag {
  font-size: 0.65rem;
  background: #dbeafe;
  color: var(--primary);
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.header-nav { display: flex; gap: 0.5rem; }
.nav-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active { background: #dbeafe; color: var(--primary); }

/* ── Layout ── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.panel { padding: 1.25rem; }
.panel-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.4rem; }
.panel-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; line-height: 1.5; }

/* ── Search ── */
.search-box { display: flex; gap: 0.5rem; position: relative; }
.search-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--primary); }
.search-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}
.search-btn:hover { background: var(--primary-dark); }
.search-btn:disabled { background: #9ca3af; cursor: not-allowed; }

.autocomplete-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 2000;
  overflow: hidden;
}
.autocomplete-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f9fafb; }
.autocomplete-item strong { color: var(--text); }
.autocomplete-item small { color: var(--muted); display: block; }

.map-click-hint {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.search-error {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--danger);
  background: #fef2f2;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}

/* ── Layer toggles / Legend ── */
.layer-toggles, .legend {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.toggle-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.toggle-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
}
.toggle-item input { cursor: pointer; }
.toggle-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.legend-line {
  width: 18px;
  height: 0;
  border-top: 2.5px solid;
  flex-shrink: 0;
}

/* ── Results panel ── */
.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  font-weight: 500;
}
.back-btn:hover { text-decoration: underline; }

/* Result header */
.result-covered {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.result-covered h3 {
  color: var(--success);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.result-covered p { font-size: 0.8rem; color: #065f46; }

.result-not-covered {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.result-not-covered h3 {
  color: var(--warning);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.result-not-covered p { font-size: 0.8rem; color: #92400e; }

/* ── Product cards ── */
.provider-section { margin-bottom: 1.25rem; }
.provider-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.provider-logo { font-size: 1.2rem; }
.provider-name { font-weight: 700; font-size: 0.95rem; }
.provider-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
  text-transform: uppercase;
}

.plan-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.6rem;
  position: relative;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: default;
}
.plan-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.plan-card.highlight {
  border-color: var(--primary);
  background: #f0f7ff;
}
.plan-highlight-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.plan-top { display: flex; justify-content: space-between; align-items: flex-start; }
.plan-name { font-weight: 700; font-size: 0.95rem; }
.plan-speed {
  font-size: 0.75rem;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 5px;
  padding: 2px 7px;
  font-weight: 600;
}
.plan-price {
  margin-top: 0.3rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}
.plan-price span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.plan-features {
  list-style: none;
  margin-top: 0.5rem;
  margin-bottom: 0.7rem;
}
.plan-features li {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 1px 0;
}
.plan-features li::before { content: "✓ "; color: var(--success); font-weight: 700; }
.plan-cta {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.plan-cta:hover { background: var(--primary-dark); }

/* Interest form */
.interest-form {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}
.interest-form h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.interest-form p { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.75rem; }
.form-field { margin-bottom: 0.6rem; }
.form-field label { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 3px; }
.form-field input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  outline: none;
}
.form-field input:focus { border-color: var(--primary); }
.form-submit {
  width: 100%;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.55rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background 0.15s;
}
.form-submit:hover { background: #046c4e; }

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

.map-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 500;
  font-size: 0.9rem;
  color: var(--muted);
}
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.modal .plan-badge {
  display: inline-block;
  background: #dbeafe;
  color: var(--primary);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.modal-form .form-field { margin-bottom: 0.75rem; }
.modal-form label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }
.modal-form input, .modal-form select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
}
.modal-form input:focus, .modal-form select:focus { border-color: var(--primary); }
.modal-submit {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
.modal-submit:hover { background: var(--primary-dark); }
.modal-success { text-align: center; padding: 1rem 0; }
.modal-success .success-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.modal-success h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.modal-success p { color: var(--muted); font-size: 0.875rem; }

/* ── Utilities ── */
.hidden { display: none !important; }
.spinner {
  width: 14px; height: 14px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 700px) {
  :root { --sidebar-w: 100%; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .map-wrap { height: 50vh; }
}
