/* ============================================================
   style.css — Pathfinder City Visual Theme (Multi-Stop)
   ============================================================ */

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #12141d;
  --bg-panel: rgba(18, 20, 32, 0.85);
  --bg-panel-hover: rgba(25, 28, 45, 0.95);
  --border: rgba(100, 120, 180, 0.12);
  --border-bright: rgba(100, 120, 180, 0.25);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #06b6d4;
  --accent-green: #00ff88;
  --accent-pink: #ff3366;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-cyan);
  color: var(--bg-primary);
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 120, 180, 0.3);
  border-radius: 3px;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

.logo h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo .accent {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  gap: 6px;
}

.kbd-hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(100, 120, 180, 0.08);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 5px;
  font-family: var(--font-mono);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
  display: flex;
  height: calc(100vh - 52px);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 290px;
  min-width: 290px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  z-index: 5;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color 0.2s ease;
}

.panel:hover {
  border-color: var(--border-bright);
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-icon {
  font-size: 14px;
}

/* ---- Select ---- */
.select {
  width: 100%;
  padding: 8px 10px;
  background-color: rgba(15, 17, 25, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.select option {
  background: #12141d;
  color: #e2e8f0;
}

/* ============================================================
   ROUTE PANEL (Multi-Stop)
   ============================================================ */
.route-panel {
  padding: 14px;
}

.route-start {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.start-badge {
  background: rgba(0, 255, 136, 0.12);
  border: 2px solid var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

.route-connector {
  width: 2px;
  height: 12px;
  background: linear-gradient(to bottom, var(--accent-green), var(--border));
  margin: 4px 0 4px 13px;
  border-radius: 1px;
}

/* ---- Waypoint List ---- */
.waypoint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 10px;
}

.waypoint-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: default;
}

.waypoint-item:hover {
  background: rgba(100, 120, 180, 0.06);
  border-color: var(--border);
}

.waypoint-item.dragging {
  opacity: 0.4;
  transform: scale(0.97);
}

.waypoint-item.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  user-select: none;
  padding: 0 2px;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--accent-cyan);
}

.drag-handle:active {
  cursor: grabbing;
}

.waypoint-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #0a0b10;
  flex-shrink: 0;
}

.waypoint-select {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  padding: 6px 8px;
}

.waypoint-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(100, 120, 180, 0.1);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.waypoint-btn:hover:not(:disabled) {
  background: rgba(100, 120, 180, 0.2);
  color: var(--text-primary);
}

.waypoint-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.waypoint-delete {
  font-size: 14px;
  font-weight: 700;
}

.waypoint-delete:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ---- Add Stop Button ---- */
.btn-add-stop {
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-add-stop:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

/* ---- Slider ---- */
.slider {
  width: 100%;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(100, 120, 180, 0.15);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.speed-value {
  margin-left: auto;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

/* ---- Buttons ---- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn-icon {
  font-size: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
  color: #fff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
  animation: pulse-glow 3s ease-in-out infinite;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(6, 182, 212, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

.btn-secondary {
  background: rgba(100, 120, 180, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(100, 120, 180, 0.18);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

/* ---- Legend ---- */
.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   CANVAS AREA
   ============================================================ */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
    var(--bg-primary);
}

#map-canvas {
  display: block;
}

/* ---- Status bar ---- */
.status-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 9px 22px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 4;
  white-space: nowrap;
}

.status-bar strong {
  color: var(--accent-cyan);
}

/* ---- Stats panel ---- */
.stats-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 2px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 4;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.stats-panel.active {
  opacity: 1;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  min-width: 80px;
}

.stat:hover {
  background: rgba(100, 120, 180, 0.08);
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  line-height: 1;
}

.stat-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
  }

  50% {
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.5);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: fade-in 0.35s ease-out backwards;
}

.panel:nth-child(1) {
  animation-delay: 0.03s;
}

.panel:nth-child(2) {
  animation-delay: 0.06s;
}

.panel:nth-child(3) {
  animation-delay: 0.09s;
}

.panel:nth-child(4) {
  animation-delay: 0.12s;
}

.panel:nth-child(5) {
  animation-delay: 0.15s;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 40vh;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .sidebar .panel {
    flex: 1 1 45%;
    min-width: 160px;
  }

  .header-right {
    display: none;
  }

  .tagline {
    display: none;
  }

  .stats-panel {
    flex-wrap: wrap;
    top: 8px;
    right: 8px;
  }

  .stat {
    min-width: 65px;
    padding: 6px 8px;
  }

  .stat-value {
    font-size: 15px;
  }
}