/* ============================================
   Walk2Eat v2 — Mobile-First Redesign
   ============================================ */

:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card: #1e293b;
  --card-border: #334155;
  --text: #e5e7eb;
  --text-secondary: #94a3b8;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-soft: rgba(34,197,94,0.12);
  --accent-2: #38bdf8;
  --danger: #f87171;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.25);
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --touch-min: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Container ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px;
}

/* ── Top Header (minimal on mobile) ── */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(51,65,85,0.5);
  max-width: 640px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}
.brand-logo {
  width: 36px; height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-text {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.brand-two { color: #fff; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Bottom Navigation Bar ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(51,65,85,0.6);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  height: var(--bottom-nav-h);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.nav-item.active {
  color: var(--accent);
}
.nav-item:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card.interactive:active {
  transform: scale(0.98);
}
.card + .card { margin-top: 12px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
}
.card-icon {
  font-size: 1.3rem;
}

/* ── Grid Layout ── */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Stats / KPI cards ── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #052e16;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: #334155;
  color: var(--text);
}
.btn-secondary:hover { background: #475569; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(51,65,85,0.4); }

.btn-danger {
  background: rgba(248,113,113,0.15);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--danger);
}

.btn-icon {
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn.loading { opacity: 0.6; pointer-events: none; }

/* ── Button Row ── */
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-muted {
  background: rgba(148,163,184,0.1);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
}

/* ── Form Elements ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: #0b1220;
  color: var(--text);
  font-size: 1rem;
  min-height: var(--touch-min);
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  min-height: var(--touch-min);
}
.toggle-label { font-size: 0.85rem; }

.checkbox-wrapper-7 .tgl { display: none; }
.checkbox-wrapper-7 .tgl + .tgl-btn {
  outline: 0; display: block; width: 3.6em; height: 1.8em;
  position: relative; cursor: pointer; user-select: none;
  background: #475569; border-radius: 2em; padding: 2px;
  transition: all 0.3s ease;
}
.checkbox-wrapper-7 .tgl + .tgl-btn:after {
  position: relative; display: block; content: "";
  width: 50%; height: 100%;
  border-radius: 2em; background: #f8fafc;
  transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  left: 0;
}
.checkbox-wrapper-7 .tgl:checked + .tgl-btn { background: var(--accent); }
.checkbox-wrapper-7 .tgl:checked + .tgl-btn:after { left: 50%; }

/* ── Map ── */
.map-box {
  height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.map-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text-secondary);
  font-size: 0.9rem;
  gap: 12px;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(34,197,94,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── List ── */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center;
  gap: 12px; padding: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  min-height: var(--touch-min);
}
.list-item:active { background: rgba(51,65,85,0.6); }
.list-item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.95rem; }
.list-item-sub { font-size: 0.8rem; color: var(--text-secondary); }
.list-item-action { flex-shrink: 0; color: var(--text-secondary); font-size: 1.1rem; }

/* ── Hero (landing) ── */
.hero {
  padding: 32px 0 24px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 12px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Feature cards (landing) ── */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 24px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.feature-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius-xs);
}
.feature-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-2);
}
.feature-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Section headings ── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 12px;
}

/* ── Small text ── */
.small { font-size: 0.8rem; color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-text { font-size: 0.9rem; }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 16px 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* ── Walk Badges (map page) ── */
.walk-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.walk-badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: rgba(15,23,42,0.6);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 14px;
}
.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ── Address autocomplete ── */
.address-wrap { position: relative; }
#addressSuggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  margin-top: 4px; max-height: 200px; overflow-y: auto;
  display: none;
  box-shadow: var(--shadow);
}
#addressSuggestions .suggestion-item {
  padding: 12px 14px; cursor: pointer; font-size: 0.9rem;
  border-bottom: 1px solid var(--card-border);
  min-height: var(--touch-min);
  display: flex; align-items: center;
}
#addressSuggestions .suggestion-item:last-child { border-bottom: none; }
#addressSuggestions .suggestion-item:hover,
#addressSuggestions .suggestion-item:active {
  background: var(--accent-soft);
  color: var(--accent);
}
#geocodeStatus { font-size: 0.75rem; margin-top: 4px; min-height: 1.2em; }
#geocodeStatus.ok { color: var(--accent); }
#geocodeStatus.err { color: var(--danger); }
#geocodeStatus.loading { color: var(--text-secondary); }

/* ── Detail Panel ── */
.detail-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}
.detail-panel.open {
  max-height: 600px;
  opacity: 1;
  margin-top: 12px;
}

/* ── Responsive ── */
@media (min-width: 480px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 640px) {
  .container { padding: 16px 24px; }
  .feature-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── No-nav pages (landing, login) hide bottom nav ── */
body.no-bottom-nav { padding-bottom: 0; }
body.no-bottom-nav .bottom-nav { display: none; }

/* ── Page transitions ── */
.page-enter {
  animation: fadeSlideUp 0.25s ease-out;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
