:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(10, 20, 34, 0.95);
  --panel-2: rgba(17, 29, 46, 0.95);
  --text: #f4f7fb;
  --muted: #8fa0b6;
  --primary: #38bdf8;
  --accent: #7c3aed;
  --success: #22c55e;
  --danger: #fb7185;
  --border: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero-banner {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(7, 17, 31, 0.9), rgba(8, 16, 28, 0.35));
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(5, 12, 20, 0.82), rgba(13, 29, 49, 0.2)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1200&q=80") center/cover;
  filter: saturate(1.1);
}

.hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.search-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(9, 13, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  max-width: 720px;
}

.search-card input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

.search-card input::placeholder {
  color: var(--muted);
}

.hero-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.map-shell {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
}

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fab {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.fab.secondary {
  background: rgba(8, 13, 23, 0.9);
}

.mini-panel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 600;
  width: min(92vw, 360px);
  max-height: 42vh;
  padding: 12px;
  border-radius: 18px;
  background: rgba(8, 13, 24, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
  overflow: auto;
}

.mini-panel.collapsed {
  transform: translateY(calc(100% - 56px));
}

.mini-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.places-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.place-item {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.place-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.place-row strong {
  display: block;
  margin-bottom: 3px;
}

.place-row p,
.place-row small {
  margin: 0;
  color: var(--muted);
}

.place-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.primary-btn,
.secondary-btn,
.icon-btn,
#searchBtn {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-btn,
#searchBtn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.secondary-btn,
.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.secondary-btn.small {
  padding: 7px 10px;
}

.icon-btn {
  font-size: 1.1rem;
  padding: 8px 10px;
}

.directions-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.route-summary {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.direction-step {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.95rem;
}

.direction-step:last-child {
  border-bottom: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.75);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-dialog {
  width: min(100%, 440px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

form input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(19, 31, 47, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  transform: translateY(70px);
  opacity: 0;
  transition: 0.3s ease;
  z-index: 1100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.live-location-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #22c55e 40%, #15803d 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.25);
  animation: livePulse 1.2s infinite ease-out;
}

.live-location-marker::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(34, 197, 94, 0.45);
  border-radius: 50%;
  animation: livePulseRing 1.2s infinite ease-out;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(0.95);
  }
}

@keyframes livePulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .hero-banner {
    min-height: 170px;
  }

  .hero-content {
    padding: 12px;
  }

  .search-card {
    width: 100%;
  }

  .mini-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 45vh;
  }

  .toast {
    left: 12px;
    right: 12px;
    text-align: center;
  }
}
