/* ═══════════════════════════════════════════════════════════════════════════════
   visualize-reachability – Stylesheet
   Modern, elegant alpine aesthetic with dark/light glassmorphic accents
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  --primary: #15803d;
  --primary-hover: #166534;
  --primary-light: #dcfce7;
  --primary-glow: rgba(34, 197, 94, 0.25);
  
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  --border: #e2e8f0;
  --border-focus: #22c55e;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --tier-1: #10b981;
  --tier-2: #3b82f6;
  --tier-3: #8b5cf6;
  --tier-4: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 20px var(--primary-glow);
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 440px;
  min-width: 400px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #dcfce7;
  color: #166534;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.sidebar-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.sidebar-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Form Container ── */
.form-container {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .col {
  flex: 1;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.icon {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.search-input-wrapper {
  position: relative;
}

input[type="text"],
input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.btn-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
}

.btn-icon:hover {
  color: #ef4444;
}

/* ── Autocomplete Dropdown ── */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: #f0fdf4;
  color: var(--primary);
}

.autocomplete-item .item-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Presets Chips ── */
.presets-section {
  margin-top: 6px;
}

.presets-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: var(--primary-light);
  border-color: #86efac;
  color: var(--primary-hover);
}

.chip-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ── Range Selector ── */
.label-with-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.range-wrapper {
  margin-top: 4px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 12px 18px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.25);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
}

.btn-text:hover {
  color: var(--text-main);
}

.btn-icon-svg {
  width: 18px;
  height: 18px;
}

/* ── Results Container ── */
.results-container {
  padding: 16px 24px 24px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-header h3 {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.hubs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.hub-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.hub-card:hover {
  border-color: #86efac;
  transform: translateX(2px);
}

.hub-info {
  display: flex;
  flex-direction: column;
}

.hub-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.hub-duration {
  font-size: 11px;
  color: var(--text-muted);
}

.hub-dep-badge {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.dep-label {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.dep-time {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  background: #f0fdf4;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
}

/* ── Sharepic CTA Card ── */
.sharepic-cta-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #e0e7ff 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sharepic-cta-card h4 {
  font-size: 13px;
  font-weight: 800;
  color: #166534;
}

.sharepic-cta-card p {
  font-size: 11px;
  color: #475569;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
}

.click-hint {
  color: var(--primary);
  font-weight: 600;
}

.footer-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--primary-hover);
}

/* ── Map Viewport ── */
.map-viewport {
  flex: 1;
  position: relative;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100%;
  background: #e5e7eb;
}

/* ── Floating Legend ── */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
}

.map-overlay-legend {
  position: absolute;
  bottom: 24px;
  right: 24px;
  padding: 14px 18px;
  z-index: 1000;
  pointer-events: auto;
}

.legend-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}

.legend-swatch {
  width: 18px;
  height: 10px;
  border-radius: 3px;
}

.legend-swatch.tier-1 { background: var(--tier-1); opacity: 0.8; }
.legend-swatch.tier-2 { background: var(--tier-2); opacity: 0.8; }
.legend-swatch.tier-3 { background: var(--tier-3); opacity: 0.8; }
.legend-swatch.tier-4 { background: var(--tier-4); opacity: 0.8; }

/* ── Loading Overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner-card {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #dcfce7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.loading-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Custom Map Markers ── */
.custom-origin-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.origin-pin-pulse {
  position: absolute;
  width: 38px;
  height: 38px;
  background: rgba(22, 101, 52, 0.3);
  border-radius: 50%;
  animation: pulse-pin 2s infinite ease-out;
}

@keyframes pulse-pin {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.origin-pin-core {
  position: relative;
  width: 24px;
  height: 24px;
  background: #166534;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.custom-hub-marker {
  pointer-events: auto;
}

.hub-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #0f172a;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 2px solid #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, background 0.15s ease;
}

.hub-badge-pill:hover {
  transform: translate(-50%, -55%) scale(1.05);
  background: #166534;
}

.hub-pill-time {
  font-family: var(--font-mono);
  background: #22c55e;
  color: #052e16;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}

/* ── Modal Dialog ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 840px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.canvas-preview-wrapper {
  background: #0f172a;
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
}

#sharepic-canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}
