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

/* Normalize iOS form elements */
input, button, select, textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
}

button {
  border-radius: 0;
}

:root {
  --bg-deep: #f5f7fa;
  --bg-base: #ffffff;
  --bg-surface: #ffffff;
  --bg-elevated: #f8f9fb;
  --border: rgba(0, 0, 0, 0.06);
  --border-light: rgba(0, 0, 0, 0.1);
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a78;
  --text-muted: #8a8aa0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --purple: #8b5cf6;
  --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-soft: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.08));
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.06);
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #ca8a04;
  --green: #16a34a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page { min-height: 100vh; }

/* ===== GLASS EFFECT ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
}

/* ===== UTILITIES ===== */
.muted { color: var(--text-secondary); }
.small { font-size: 0.8rem; }
.accent-text { color: var(--accent); font-weight: 700; }
.unit { color: var(--text-muted); font-weight: 400; }

/* ===== LOGIN PAGE ===== */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.06) 0%, transparent 50%),
    var(--bg-deep);
  padding: 1.5rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  margin-bottom: 2rem;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--gradient-soft);
  border: 1px solid var(--glass-border);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.login-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.login-card {
  background: var(--bg-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.login-field {
  margin-bottom: 1.25rem;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-field input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

#login-btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

#login-btn:hover { opacity: 0.9; }
#login-btn:active { transform: scale(0.98); }

.login-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

.login-footer {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ===== HEADER ===== */
header {
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-logout {
  padding: 0.4rem 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ===== MAIN ===== */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ===== SEARCH CARD ===== */
.search-card {
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.section-subheading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

#address-input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#address-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#address-input::placeholder { color: var(--text-muted); }

.btn-gps {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
  touch-action: manipulation;
}

.btn-gps:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

.btn-gps.loading {
  color: var(--accent);
  animation: pulse-gps 1s infinite;
}

@keyframes pulse-gps {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Slider */
#radius-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
}

#radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  transition: transform 0.15s;
}

#radius-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 0.25rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== RECENT SCANS ===== */
.recent-scans {
  margin-top: 1.5rem;
}

.recent-list {
  display: grid;
  gap: 0.5rem;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.recent-item:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.recent-info {
  min-width: 0;
  flex: 1;
}

.recent-address {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.scan-status {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.scan-status.complete { background: #dcfce7; color: var(--green); }
.scan-status.scanning { background: #fef3c7; color: var(--yellow); }
.scan-status.error { background: #fecaca; color: var(--red); }
.scan-status.pending { background: #f1f5f9; color: var(--text-muted); }

/* ===== PROGRESS ===== */
.progress-card {
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
}

.progress-icon {
  margin-bottom: 1.25rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 1.25rem 0 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-stats {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ===== RESULTS ===== */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.results-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.results-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(59,130,246,0.06);
  border-color: var(--accent);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}

#map {
  height: 420px;
  width: 100%;
}

.results-list {
  display: grid;
  gap: 0.6rem;
}

.result-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}

.result-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.result-thumb {
  width: 130px;
  height: 95px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: #e2e8f0;
}

.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.result-address {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-type { background: #dbeafe; color: #1e40af; }
.badge-severity-low { background: #fef3c7; color: #92400e; }
.badge-severity-medium { background: #fed7aa; color: #9a3412; }
.badge-severity-high { background: #fecaca; color: #991b1b; }

.result-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-coords {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* No results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.no-results h3 {
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  position: relative;
  background: var(--bg-base);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  color: white;
  cursor: pointer;
  z-index: 1;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(0,0,0,0.6); }

#modal-image {
  width: 100%;
  display: block;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.modal-body h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.modal-badges {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.coords {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ===== CANCEL BUTTON ===== */
.btn-cancel {
  margin-top: 1.25rem;
  padding: 0.55rem 1.25rem;
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.5);
}

#progress-eta {
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

/* ===== SEVERITY FILTER (segmented control) ===== */
.severity-filters {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  line-height: 1;
}
.chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.chip[data-severity="all"]::before {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}
.chip[data-severity="high"]::before { background: var(--red); }
.chip[data-severity="medium"]::before { background: var(--orange); }
.chip[data-severity="low"]::before { background: #eab308; }

.chip:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  padding: 0 0.3rem;
  height: 1.1rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  transition: background 0.18s, color 0.18s;
}
.chip-active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.chip-active .chip-count { background: rgba(0, 0, 0, 0.06); color: var(--text-primary); }

.chip-high.chip-active { background: #fef2f2; color: var(--red); }
.chip-high.chip-active .chip-count { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.chip-medium.chip-active { background: #fff7ed; color: var(--orange); }
.chip-medium.chip-active .chip-count { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.chip-low.chip-active { background: #fefce8; color: #a16207; }
.chip-low.chip-active .chip-count { background: rgba(234, 179, 8, 0.15); color: #a16207; }

/* ===== RESULT FOOTER / MAPS LINK ===== */
.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}
.result-maps {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.result-maps:hover { text-decoration: underline; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.modal-maps-link {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.modal-maps-link:hover { text-decoration: underline; }

/* ===== TOAST ===== */
.toast-host {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}
.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 420px;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-info { border-left-color: var(--accent); }
.toast-success { border-left-color: var(--green); }

/* ===== LIVE PROGRESS MAP ===== */
.progress-map-container {
  margin-top: 0.5rem;
}
#progress-map-wrap {
  margin-top: 1.25rem;
}
#progress-map-inner {
  height: 320px;
  width: 100%;
}

/* ===== MAP LEGEND ===== */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  padding: 0.5rem 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.legend-dot-check { background: #86efac; border: 1px solid #22c55e; }
.legend-dot-high { background: #ef4444; border: 2px solid #ef4444; }
.legend-dot-medium { background: #f97316; border: 2px solid #f97316; }
.legend-dot-low { background: #eab308; border: 2px solid #eab308; }

/* ===== FILTERS ROW ===== */
.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.confidence-filter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 200px;
  flex: 0 1 260px;
}
.confidence-filter label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.confidence-filter input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: #e2e8f0;
  border-radius: 2px;
}
.confidence-filter input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--gradient);
  border-radius: 50%;
  cursor: pointer;
}

/* ===== CONFIDENCE DOT ===== */
.conf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  background: conic-gradient(var(--accent) var(--conf), #e2e8f0 0);
  border: 1px solid var(--border);
}

/* ===== EXTRA BADGES ===== */
.badge-surface { background: #e0e7ff; color: #3730a3; }
.badge-area { background: #f1f5f9; color: var(--text-secondary); }
.badge-quote {
  background: #dcfce7;
  color: #15803d;
  font-variant-numeric: tabular-nums;
}
.badge-conf { background: #f1f5f9; color: var(--text-secondary); }

/* ===== WIDE IMAGE TOGGLE IN MODAL ===== */
.modal-image-wrap { position: relative; }
.modal-wide-btn {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-wide-btn:hover { background: rgba(0, 0, 0, 0.85); }

.modal-keyhint {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ===== SHORTCUT HELP OVERLAY ===== */
.shortcut-help {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  max-width: 280px;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 500;
}
.shortcut-help.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.shortcut-help strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.shortcut-help div {
  display: flex;
  gap: 0.4rem;
  padding: 0.2rem 0;
  color: var(--text-secondary);
}
.shortcut-help kbd {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

/* ===== MARKERCLUSTER OVERRIDES ===== */
.marker-cluster {
  background: rgba(59, 130, 246, 0.2);
}
.marker-cluster div {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  main { padding: 1rem; }
  .search-card { padding: 1.5rem; }
  .result-card { flex-direction: column; }
  .result-thumb { width: 100%; height: 180px; }
  #map, #progress-map-inner { height: 300px; }
  .results-header { flex-direction: column; }
  .results-actions { width: 100%; flex-wrap: wrap; }
  .results-actions button { flex: 1; min-width: 0; }
  .severity-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.25rem; }
  .chip { flex-shrink: 0; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .confidence-filter { width: 100%; }
  .shortcut-help { left: 1rem; right: 1rem; max-width: none; }
}
