* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0e17;
  color: #e6e9f0;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---------- SIDEBAR ---------- */

.sidebar {
  width: 360px;
  flex-shrink: 0;
  background: #0d1220;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.guest-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.trip-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.trip-picker select {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e6e9f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(34, 211, 238, 0.12);
  color: #22d3ee;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.icon-btn:hover { background: rgba(34, 211, 238, 0.22); }

.add-stop-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}

.add-stop-form label {
  font-size: 0.75rem;
  color: #8b93a7;
  margin-top: 8px;
}

.add-stop-form input,
.add-stop-form textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e6e9f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
}

.add-stop-form input:focus,
.add-stop-form textarea:focus {
  outline: none;
  border-color: #22d3ee;
}

.autocomplete-wrap { position: relative; }

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #131a2b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  display: none;
}

.suggestions.open { display: block; }

.suggestion-item {
  padding: 10px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: rgba(34, 211, 238, 0.1); }

.primary-btn {
  margin-top: 14px;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  color: #0a0e17;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.stops-list-wrap h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b93a7;
  margin: 0 0 10px;
}

.stops-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stop-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.stop-info strong { display: block; font-size: 0.9rem; }
.stop-info span { color: #8b93a7; font-size: 0.75rem; }

.stop-delete {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 1rem;
}
.stop-delete:hover { color: #f87171; }

.empty-hint {
  color: #4b5261;
  font-size: 0.82rem;
  text-align: center;
  padding: 16px 0;
}

.stats-panel {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.stat {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 4px;
}

.stat-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 0.65rem;
  color: #8b93a7;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- MAP ---------- */

.map-area { flex: 1; position: relative; }
#map { position: absolute; inset: 0; }

.mapboxgl-popup-content {
  background: #131a2b !important;
  color: #e6e9f0 !important;
  border-radius: 10px !important;
  font-family: inherit !important;
  font-size: 0.85rem !important;
}
.mapboxgl-popup-tip { border-top-color: #131a2b !important; }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: 55vh; }
  .map-area { height: 45vh; }
}
