/* ── Friend Cards ── */
/* The friends are rendered into #friendsList, so the gap between cards lives here
 * (the panel's own gap only spaces #friendsList from its siblings, not the cards). */
#friendsList {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.friend-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.friend-card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.friend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-1 { background: #60a5fa; }
.dot-2 { background: #f97316; }
.dot-dest { background: var(--accent); }

.friend-card-header label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  flex: 1;
}

.field-row { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: 11px; color: var(--muted); }

/* ── Location autocomplete dropdown ── */
.ac-wrap { position: relative; }
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}
.ac-item {
  padding: .45rem .7rem;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.ac-item + .ac-item { border-top: 1px solid var(--border); }
.ac-item.active { background: var(--surface3); color: var(--accent); }

/* ── Unresolved field: has text but no dropdown selection ── */
.needs-pick {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 1px var(--red);
}

/* ── Add / remove friend ── */
.add-friend-btn {
  width: 100%;
  padding: .6rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.add-friend-btn:hover { border-color: var(--accent); color: var(--text); }

.remove-friend-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.remove-friend-btn:hover { border-color: var(--red); color: var(--red); background: rgba(248,113,113,.1); }

/* ── Sub-meetups toggle ── */
.submeetup-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.submeetup-label input[type="checkbox"] { width: auto; cursor: pointer; accent-color: var(--accent); }

input[type="text"] {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .45rem .7rem;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--muted); }

/* ── Find Button ── */
.find-btn {
  width: 100%;
  padding: .75rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: -.01em;
}
.find-btn:hover:not(:disabled) { opacity: .9; }
.find-btn:active:not(:disabled) { transform: scale(.98); }
.find-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Share plan ── */
.share-section {
  margin-top: .6rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.share-btn {
  width: 100%;
  padding: .65rem;
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, opacity .15s;
  letter-spacing: -.01em;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.share-btn:active { transform: scale(.98); }
#shareUrl {
  width: 100%;
  padding: .55rem .6rem;
  background: var(--surface3);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  box-sizing: border-box;
}
#shareUrl:focus { outline: none; border-color: var(--accent); color: var(--text); }

/* ── Status ── */
.status {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 20px;
}
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { color: var(--red); font-size: 13px; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2); border-radius: 6px; padding: .5rem .75rem; }

/* ── Results ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.results-header h2 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.results-count { font-size: 12px; color: var(--muted); background: var(--surface3); border: 1px solid var(--border); border-radius: 20px; padding: .1rem .6rem; }

.results-list { display: flex; flex-direction: column; gap: .5rem; }

.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .9rem 1rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.result-card:hover, .result-card.active {
  border-color: var(--accent);
  background: var(--surface3);
}

.result-card-top {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: .4rem;
}
.safety-badge {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .5rem;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }

.result-name { font-size: 14px; font-weight: 600; line-height: 1.3; flex: 1; }
.result-type { font-size: 12px; color: var(--muted); margin-bottom: .25rem; }
.result-reason { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: .5rem; }
.result-meta { display: flex; align-items: center; gap: .75rem; }
.result-dist { font-size: 12px; color: var(--muted); }
.result-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
}
.result-link:hover { text-decoration: underline; }

/* ── Set-as-meetup button + chosen-spot styling ── */
.set-meetup-btn {
  margin-top: .6rem;
  width: 100%;
  padding: .35rem .6rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.set-meetup-btn:hover { border-color: var(--accent); color: var(--accent); }
.popup-set-meetup-btn { margin-top: .5rem; }

.result-card.is-meetup {
  border-color: var(--accent);
  background: rgba(255, 180, 84, 0.08);
}
.result-card.is-meetup .set-meetup-btn {
  border-color: var(--accent);
  color: var(--accent);
}
.meetup-badge {
  display: none;
  flex-shrink: 0;
  margin-top: 1px;
  padding: .2rem .5rem;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #1a1a1a;
  background: var(--accent);
}
.result-card.is-meetup .meetup-badge { display: inline-block; }

/* ── Turn-by-turn directions panel ── */
.directions-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}
.directions-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.directions-via { font-size: 12px; color: var(--accent); }
.directions-rows { display: flex; flex-direction: column; gap: .4rem; }
.directions-row { display: flex; align-items: center; gap: .5rem; font-size: 13px; }
.directions-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.directions-name { flex: 1; }
.directions-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.directions-link:hover { text-decoration: underline; }
.directions-share { display: inline-block; margin-top: .6rem; }

/* ── "Why carpool?" savings card ── */
.why-carpool {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .75rem .85rem;
}
.why-carpool-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.why-carpool-headline {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 .6rem;
}
.why-carpool-headline b { color: var(--green); }
.why-carpool-empty {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.savings-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
}
.savings-stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .4rem .55rem;
}
.savings-value { font-size: 14px; font-weight: 600; color: var(--accent); }
.savings-label { font-size: 11px; color: var(--muted); }
.why-carpool-disclaimer { font-size: 11px; color: var(--muted); margin: .6rem 0 0; }

.no-results { font-size: 13px; color: var(--muted); text-align: center; padding: 1.5rem 1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); }

/* ── Legend ── */
.legend {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .75rem 1rem;
}
.legend-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; }
.legend-items { display: flex; flex-direction: column; gap: .3rem; }
.legend-item { display: flex; align-items: center; gap: .5rem; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Scenario selector ── */
#scenarioSelector {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .75rem 1rem;
}
.scenario-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .6rem;
}
.scenario-chips {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.scenario-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  padding: .5rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.scenario-chip:hover { border-color: var(--accent); color: var(--text); }
.scenario-chip.active {
  border-color: var(--accent);
  background: rgba(255,180,84,.07);
  color: var(--text);
}
.chip-title { font-weight: 600; font-size: 13px; }
.chip-sub   { font-size: 11px; color: var(--muted); }

/* ── Optional card ── */
.optional-card {
  border-style: dashed;
  opacity: .85;
}
.optional-card:focus-within { opacity: 1; }
.optional-tag {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .1rem .4rem;
  margin-left: .3rem;
}

/* ── Advice banner ── */
.advice-banner {
  font-size: 13px;
  line-height: 1.5;
  border-radius: var(--r);
  padding: .65rem .9rem;
  border: 1px solid transparent;
}
.advice-success  { background: rgba(74,222,128,.08);  border-color: rgba(74,222,128,.25);  color: #86efac; }
.advice-warning  { background: rgba(251,191,36,.08);  border-color: rgba(251,191,36,.25);  color: #fde68a; }
.advice-info     { background: rgba(96,165,250,.08);  border-color: rgba(96,165,250,.25);  color: #bfdbfe; }

/* ── Retry button ── */
.retry-btn {
  display: inline-block;
  margin-left: .4rem;
  padding: .15rem .55rem;
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 4px;
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.retry-btn:hover { background: rgba(248,113,113,.12); }
