/* App page styles — light theme (matches theme.css design system) */

.app-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

/* App navigation overrides */
.app-page .nav {
  background: rgba(250,250,250,0.95);
}

/* App container — full-screen card feel */
.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 88px var(--space-5) 120px;
}

.app-header { margin-bottom: var(--space-8); }

.app-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
}

.app-subtitle {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* Generator form — card layout */
.gen-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.form-input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  min-height: 48px;
}

.form-input::placeholder { color: var(--fg-muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-select {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  width: 100%;
  min-height: 48px;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-select:focus { border-color: var(--accent); }

/* Location input with autocomplete */
.location-wrapper {
  position: relative;
}

/* Route info stats */
.route-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.route-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.stat-unit {
  font-size: 13px;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-weight: 400;
}

/* Route output — hidden until route generated */
#routeOutput { display: none; }

/* Map container */
.map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

#map {
  height: 400px;
  width: 100%;
  background: var(--bg-3);
}

/* Action buttons row */
.actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

/* Error state */
.error-msg {
  background: rgba(255,85,34,0.06);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  color: var(--accent-hover);
  font-size: 14px;
  margin-bottom: var(--space-5);
}

/* Loading state */
.loading-msg {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 14px;
  margin-bottom: var(--space-5);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 200;
  display: none;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.autocomplete-dropdown.active { display: block; }

.autocomplete-item {
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--fg);
  transition: background 0.15s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--accent-dim); }
.autocomplete-item.selected { background: var(--accent-dim); }

.autocomplete-name { font-weight: 600; margin-bottom: 2px; }
.autocomplete-hint { font-size: 12px; color: var(--fg-muted); }

.autocomplete-loading {
  padding: var(--space-4) var(--space-5);
  font-size: 13px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.autocomplete-empty {
  padding: var(--space-4) var(--space-5);
  font-size: 13px;
  color: var(--fg-muted);
  cursor: default;
}

/* Attribution */
.map-attribution {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: var(--space-3);
  text-align: center;
}

/* ─── Bottom Navigation Bar (mobile PWA) ──────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 72px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--fg-muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  min-width: 64px;
  min-height: 44px;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Hide bottom nav on desktop */
@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .app-container { padding-bottom: var(--space-8); }
}

/* Mobile responsive */
@media (max-width: 480px) {
  .route-info { grid-template-columns: 1fr 1fr; }
  .route-stat:last-child { grid-column: 1 / -1; }
  #map { height: 320px; }
  .gen-form { padding: var(--space-5); }
}

@media (max-width: 700px) {
  .app-container { padding: 84px var(--space-4) 120px; }
  .form-input, .form-select { min-height: 48px; }
}