/* ════════════════════════════════════════════════════════════════
 * Garage Lead Request Modal
 * Triggered by "Request garage quote →" CTA on search result cards.
 * Visual style mirrors .xref-upgrade-overlay / .xref-upgrade in
 * css/pages/cross-reference.css — same dark palette + accent tokens.
 * ════════════════════════════════════════════════════════════════ */

/* ── Dim overlay ─────────────────────────────────────────────── */
.lead-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(7, 12, 22, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: lead-fade-in 0.2s ease;
}

@keyframes lead-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Centered card ───────────────────────────────────────────── */
.lead-modal {
  background: var(--surface-card, #11182b);
  border: 1px solid rgba(34, 211, 166, 0.25);
  border-radius: 16px;
  padding: 28px 24px 24px;
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden; /* outer shell never scrolls */
}

.lead-modal h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  padding-right: 32px; /* room for × button */
}

/* ── Close button ────────────────────────────────────────────── */
.lead-modal__x {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: 0;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lead-modal__x:hover {
  color: var(--text-primary, #f1f5f9);
  background: rgba(255, 255, 255, 0.06);
}

/* ── Subtitle (vehicle · part) ───────────────────────────────── */
.lead-modal__sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
}

/* ── Toolbar: filter input + A–Z sort chip ───────────────────── */
.lead-modal__toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lead-modal__filter {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary, #f1f5f9);
  font-size: 0.875rem;
  font-family: inherit;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  /* Remove native search decorations */
  -webkit-appearance: none;
  appearance: none;
}
.lead-modal__filter::placeholder {
  color: var(--text-dim, #64748b);
}
.lead-modal__filter:focus {
  border-color: rgba(34, 211, 166, 0.45);
  background: rgba(255, 255, 255, 0.06);
}
/* Hide native × clear button in Webkit */
.lead-modal__filter::-webkit-search-cancel-button { display: none; }

.lead-modal__sort-chip {
  flex-shrink: 0;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  min-height: 36px;
}
.lead-modal__sort-chip:hover {
  border-color: rgba(34, 211, 166, 0.4);
  color: #22d3a6;
}
.lead-modal__sort-chip.is-active {
  border-color: #22d3a6;
  color: #22d3a6;
  background: rgba(34, 211, 166, 0.08);
}

/* ── Garage list (vertical, scrollable) ─────────────────────── */
.lead-modal__garages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden; /* never horizontal scroll */
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  max-height: 260px;
  padding-right: 4px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 166, 0.2) transparent;
}
.lead-modal__garages::-webkit-scrollbar {
  width: 4px;
}
.lead-modal__garages::-webkit-scrollbar-track {
  background: transparent;
}
.lead-modal__garages::-webkit-scrollbar-thumb {
  background: rgba(34, 211, 166, 0.2);
  border-radius: 2px;
}

.lead-modal__loading,
.lead-modal__empty {
  color: var(--text-muted, #94a3b8);
  font-size: 0.875rem;
  padding: 20px 0;
  text-align: center;
}

/* ── Garage card rows (vertical list) ───────────────────────── */
.lead-garage {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  /* Full-width, never wraps or collapses */
  width: 100%;
  box-sizing: border-box;
  min-height: 44px; /* a11y tap target */
}
.lead-garage:hover {
  border-color: rgba(34, 211, 166, 0.3);
  background: rgba(34, 211, 166, 0.05);
}
.lead-garage:has(input:checked) {
  border-color: rgba(34, 211, 166, 0.65);
  background: rgba(34, 211, 166, 0.09);
  box-shadow: 0 0 0 1px rgba(34, 211, 166, 0.2);
}

/* Hidden radio (a11y: still focusable/keyboard) */
.lead-garage input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom radio indicator */
.lead-garage::before {
  content: '';
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  margin-top: 3px;
  transition: border-color 0.15s, background 0.15s;
}
.lead-garage:has(input:checked)::before {
  border-color: #22d3a6;
  background: radial-gradient(circle, #22d3a6 38%, transparent 42%);
  box-shadow: 0 0 6px rgba(34, 211, 166, 0.4);
}

/* Card body: name + address + chips stacked vertically */
.lead-garage__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0; /* allow text to truncate within flex */
  flex: 1;
}

.lead-garage__name {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-garage__meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Service chips row */
.lead-garage__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.lead-garage__chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #22d3a6;
  background: rgba(34, 211, 166, 0.1);
  border: 1px solid rgba(34, 211, 166, 0.2);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  line-height: 1.5;
}

/* ── Note textarea ───────────────────────────────────────────── */
.lead-modal__note {
  width: 100%;
  min-height: 72px;
  max-height: 140px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary, #f1f5f9);
  font-size: 0.875rem;
  font-family: inherit;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.lead-modal__note::placeholder {
  color: var(--text-dim, #64748b);
}
.lead-modal__note:focus {
  border-color: rgba(34, 211, 166, 0.4);
}

/* ── Send button ─────────────────────────────────────────────── */
.lead-modal__send {
  width: 100%;
  padding: 13px 18px;
  border-radius: 8px;
  border: 0;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(90deg, #0EA5E9, #22d3a6);
  color: #0a0f1e;
  transition: opacity 0.15s, transform 0.15s;
  min-height: 48px;
}
.lead-modal__send:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}
.lead-modal__send:active:not(:disabled) {
  transform: translateY(0);
}
.lead-modal__send:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
}

/* ── Mobile adjustments ──────────────────────────────────────── */
@media (max-width: 560px) {
  .lead-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .lead-modal {
    padding: 22px 16px 20px;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    width: 100%;
    max-width: 100%;
  }
  .lead-modal h2 {
    font-size: 1.05rem;
  }
  .lead-modal__garages {
    max-height: 200px;
  }
  .lead-modal__filter {
    font-size: 1rem; /* 16px — prevents iOS zoom */
  }
}

/* ── "See reviews" toggle (garage picker card) ── */
.lead-garage__see-reviews {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-muted, #94a3b8);
  transition: border-color 0.15s, color 0.15s;
}
.lead-garage__see-reviews:hover {
  border-color: rgba(34, 211, 166, 0.45);
  color: #5eead4;
}
