/* planner.css — Mobile "Cómo llegar" tab (6 states)
   Colors come from the central palette in /styles.css (--vv-*). */

.vv-pl-view {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--vv-bottom-nav-height, 64px) + env(safe-area-inset-bottom, 0px));
  z-index: 30; /* above map & floating controls, below sheets (40/45) and nav (50) */
  background: var(--vv-surface);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--vv-text);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
}

@media (max-width: 767px) {
  .vv-pl-view.open { display: flex; }
}

/* Hidden while picking a point on the map or during state 5 (detalle) */
.vv-pl-view.vv-pl-hidden { display: none !important; }

/* Collapsed: only the compact header is visible; map is fully interactive */
.vv-pl-view.vv-pl-collapsed {
  top: auto;
  height: 68px;
  overflow: hidden;
  cursor: pointer;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}

/* While planner is open, the floating route pill must not overlay it */
body.vv-pl-open .vv-mobile-selection-pill { display: none !important; }

/* State 2: keyboard open → hide the bottom nav (spec) */
@media (max-width: 767px) {
  body.vv-pl-keyboard .vv-bottom-nav { display: none; }
}

/* ── Headers ────────────────────────────────────────────────────────── */
.vv-pl-header-entrada {
  padding: 18px 20px 6px;
}

.vv-pl-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.vv-pl-header-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 0.5px solid var(--vv-border);
}

.vv-pl-back,
.vv-pl-edit {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--vv-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-summary {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Fields (states 1–2) ─────────────────────────────────────────────── */
.vv-pl-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 14px;
}

.vv-pl-fields-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vv-pl-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0.5px solid var(--vv-border-control);
  border-radius: 10px;
  padding: 0 12px;
  min-height: 46px;
  background: var(--vv-surface);
  transition: border-color 0.15s ease;
}

.vv-pl-field.focused {
  border: 1.5px solid var(--vv-accent);
}

.vv-pl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vv-accent);
  flex-shrink: 0;
}

.vv-pl-sq {
  width: 9px;
  height: 9px;
  background: var(--vv-text-2);
  flex-shrink: 0;
}

.vv-pl-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-size: 16px; /* ≥16px previene el zoom automático en iOS Safari */
  color: var(--vv-text);
  padding: 10px 0;
  outline: none;
  font-family: inherit;
}

.vv-pl-input::placeholder { color: var(--vv-text-2); }

.vv-pl-clear {
  border: none;
  background: none;
  color: var(--vv-text-2);
  min-width: 34px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-swap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0.5px solid var(--vv-border-control);
  background: var(--vv-surface);
  color: var(--vv-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-swap:active { color: var(--vv-accent); border-color: var(--vv-accent); }

.vv-pl-error {
  margin: 0;
  padding: 10px 20px;
  font-size: 13px;
  color: #dc2626;
}

/* ── State 1: saved + recents ──────────────────────────────────────────── */
.vv-pl-home {
  flex: 1;
  background: var(--vv-surface-2);
  padding: 14px 20px 20px;
}

.vv-pl-hint {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--vv-text-2);
}

.vv-pl-sec-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vv-text-2);
  margin: 14px 0 8px;
}

.vv-pl-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vv-pl-saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 0.5px solid var(--vv-border-control);
  border-radius: 22px;
  background: var(--vv-surface);
  color: var(--vv-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-saved-chip svg { color: var(--vv-accent); flex-shrink: 0; }

.vv-pl-saved-chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-pl-recents { display: flex; flex-direction: column; }

.vv-pl-recent {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 2px;
  border: none;
  border-bottom: 0.5px solid var(--vv-border);
  background: none;
  color: var(--vv-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-recent svg { color: var(--vv-text-2); flex-shrink: 0; }

.vv-pl-recent span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Re-run button (state 1, when dest is already set) */
.vv-pl-run-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--vv-accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}

.vv-pl-run-btn:active { opacity: 0.85; }

.vv-pl-run-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 3px;
}

.vv-pl-run-dest {
  font-size: 15px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: left;
}

/* ── State 2: search results ─────────────────────────────────────────── */
.vv-pl-search {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Once this list hits its scroll boundary, stop — don't chain the drag
     up to .vv-pl-view (which also scrolls), or the whole panel moves. */
  overscroll-behavior-y: contain;
}

.vv-pl-sr-live {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.vv-pl-sr-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 20px;
  border: none;
  border-bottom: 0.5px solid var(--vv-border);
  background: none;
  color: var(--vv-accent);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-sr-group {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vv-text-2);
}

.vv-pl-sr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 8px 20px;
  border: none;
  border-bottom: 0.5px solid var(--vv-border);
  background: none;
  color: var(--vv-text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-sr-name { font-size: 14px; }
.vv-pl-sr-name strong { font-weight: 700; }
.vv-pl-sr-sub { font-size: 12px; color: var(--vv-text-2); }

/* ── State 3: skeletons ──────────────────────────────────────────────── */
.vv-pl-skeletons { padding: 14px 20px; }

.vv-pl-skel-card {
  border: 0.5px solid var(--vv-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.vv-pl-skel {
  background: var(--vv-surface-2);
  border-radius: 6px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.vv-pl-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: vvPlShimmer 1.4s infinite;
}

@media (prefers-color-scheme: dark) {
  .vv-pl-skel::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  }
}

@keyframes vvPlShimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .vv-pl-skel::after { animation: none; }
}

.vv-pl-skel-time { width: 64px; height: 22px; }
.vv-pl-skel-badge { width: 90px; height: 14px; }
.vv-pl-skel-seq { width: 80%; height: 18px; }
.vv-pl-skel-line { width: 60%; height: 12px; margin-bottom: 0; }

.vv-pl-slow {
  margin: 4px 2px 0;
  font-size: 13px;
  color: var(--vv-text-2);
  text-align: center;
}

/* ── State 4: result cards ────────────────────────────────────────────── */
.vv-pl-results { padding: 14px 20px 20px; }

.vv-pl-card {
  display: block;
  width: 100%;
  border: 0.5px solid var(--vv-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--vv-surface);
  color: var(--vv-text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-card--first { border-left: 3px solid var(--vv-accent); }

.vv-pl-card:focus-visible {
  outline: 2px solid var(--vv-accent);
  outline-offset: 2px;
}

.vv-pl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.vv-pl-card-time {
  font-size: 19px;
  font-weight: 600;
}

.vv-pl-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--vv-surface-2);
  color: var(--vv-text-2);
  white-space: nowrap;
}

.vv-pl-badge--primary {
  background: var(--vv-accent);
  color: white;
}

.vv-pl-card-seq {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.vv-pl-seq-walk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--vv-text-2);
}

.vv-pl-seq-chev {
  display: inline-flex;
  color: var(--vv-muted);
}

.vv-pl-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 5px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.vv-pl-card-detail {
  font-size: 11px;
  color: var(--vv-text-2);
}

/* ── State 5: detalle ─────────────────────────────────────────────────── */
.vv-pl-detalle-back {
  display: none;
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 10px;
  z-index: 65; /* above the expanded sheet (60) — it's the exit of state 5 */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--vv-border-control);
  background: var(--vv-surface);
  color: var(--vv-text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-detalle-back.open { display: flex; }

.vv-pl-detalle {
  padding: 4px 20px 24px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--vv-text);
}

.vv-pl-dt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vv-pl-dt-time {
  font-size: 20px;
  font-weight: 600;
}

.vv-pl-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1.5px solid var(--vv-border-control);
  border-radius: 999px;
  background: var(--vv-surface);
  color: var(--vv-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.vv-pl-save.saved {
  border-color: var(--vv-accent);
  color: var(--vv-accent);
}

.vv-pl-dt-eta {
  margin: 4px 0 16px;
  font-size: 13px;
  color: var(--vv-text-2);
}

/* Vertical timeline */
.vv-pl-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vv-pl-tl-step {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 22px 4px;
}

/* 2px connector between nodes */
.vv-pl-tl-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--vv-muted);
}

.vv-pl-tl-node {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.vv-pl-tl-node--walk {
  width: 10px;
  height: 10px;
  margin: 5px 6px 0;
  border-radius: 50%;
  border: 2px solid var(--vv-accent);
  background: var(--vv-surface);
}

.vv-pl-tl-node--bus {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: white;
}

.vv-pl-tl-node--end {
  width: 12px;
  height: 12px;
  margin: 4px 5px 0;
  border-radius: 3px;
  background: var(--vv-text);
}

.vv-pl-tl-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vv-pl-tl-mid {
  font-size: 13px;
  color: var(--vv-text-2);
  margin-top: 2px;
}

.vv-pl-tl-sub {
  font-size: 12px;
  color: var(--vv-text-2);
  margin-top: 2px;
}

/* ── State 6: sin resultados ─────────────────────────────────────────── */
.vv-pl-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.vv-pl-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--vv-surface-2);
  color: var(--vv-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.vv-pl-empty-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.vv-pl-empty-text {
  margin: 0;
  font-size: 12px;
  color: var(--vv-text-2);
  max-width: 260px;
}

.vv-pl-empty-sep {
  width: 100%;
  max-width: 320px;
  height: 0.5px;
  background: var(--vv-border);
  margin: 20px 0 4px;
}

.vv-pl-report {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--vv-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
