/* Components: Hero */

/* ---- Hero Section ---- */
.hero {
  position: relative;
  z-index: 10;
  background: var(--color-nav);
  color: #fff;
  padding: var(--space-4xl) 0;
  overflow: visible;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  color: #fff;
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-md);
}

.hero p {
  font-size: var(--font-size-lg);
  opacity: 0.85;
  margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
  .hero {
    padding: var(--space-3xl) 0;
  }
  .hero h1 {
    font-size: var(--font-size-2xl);
  }
}

/* ================================================================
   UNIFIED SEARCH BAR (USB)
   The search "pill" is the entire .usb-input-wrap — a white rounded
   container with the input, GPS button, and submit button inside.
   The submit button has NO border — the pill's white background
   surrounding it creates the visual border effect.
   Two variants: kpdd-search-form[hero] (homepage) and kpdd-search-form:not([hero]) (filter bar)
   ================================================================ */

/* ---- Base ---- */
.usb {
  position: relative;
}

.usb-form {
  margin: 0;
}

/* ---- Input Row ---- */
.usb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The pill — the whole row IS the search pill */
.usb-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  background: #fff;
  border-radius: 100px;
  /* The pill itself is the container — the white bg around the submit btn creates the "border" */
  padding: 4px;
}

/* ---- Mirror Input System ---- */
/* The pill looks like an input. The real <input> is invisible on top,
   capturing keystrokes. Below it, mirror divs show typed text (black)
   and autocomplete suggestion (gray). */
.usb-mirror-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Real input — sits on top, fully transparent, captures all events */
.usb-input {
  position: relative;
  z-index: 2;
  width: 100%;
  border: none;
  border-radius: 100px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: normal;
  background: transparent;
  color: transparent; /* real text hidden; mirrors show visible text */
  caret-color: var(--color-text, #1a1a1a);
  outline: none;
  padding: 10px 0 10px 20px;
}

.usb-input::selection {
  background: rgba(59, 130, 246, 0.3);
  color: transparent;
}

/* Mirror layer — typed text + ghost suggestion, positioned under the input */
.usb-mirror {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 10px 0 10px 20px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: normal;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  z-index: 1;
}

.usb-mirror-typed {
  color: #1a1a1a;
}

.usb-mirror-ghost {
  color: #9ca3af;
}

/* Placeholder — shown when input is empty */
.usb-mirror-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 10px 0 10px 20px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: normal;
  color: var(--color-muted);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  z-index: 1;
}

.usb-input::placeholder {
  color: transparent;
}

/* ---- GPS Button (inside pill, before submit) ---- */
.usb-gps-btn {
  position: absolute;
  right: 90px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 16px;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  z-index: 3;
}

.usb-gps-btn:hover {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.usb-gps-btn.locating {
  color: var(--color-primary);
  animation: pulse-gps 1s ease-in-out infinite;
}

@keyframes pulse-gps {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Submit Button (inside pill, rightmost) ---- */
/* NO border on the button — the pill's white background IS the border */
.usb-submit-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 3;
  white-space: nowrap;
}

/* In hero, submit shows label text; in filter, submit shows just the magnifying glass icon */
kpdd-search-form[hero] .usb-submit-icon--filter {
  display: none;
}

.usb-submit-btn:hover {
  background: color-mix(in srgb, var(--color-primary) 85%, #000);
}

.usb-submit-btn i {
  font-size: 13px;
}

/* ================================================================
   HERO VARIANT — centered card with tabs above, dark bg context
   Host layout is in shadow DOM; these rules style light DOM children.
   ================================================================ */

/* Category Tabs (above the pill on hero) — radio inputs */
.usb-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.usb-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  transition: color 0.15s, border-color 0.15s;
}

.usb-tab input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.usb-tab:hover {
  color: rgba(255,255,255,0.85);
}

.usb-tab:has(input:checked) {
  color: #fff;
  border-bottom-color: #fff;
}

/* Hero pill sizing */
kpdd-search-form[hero] .usb-input-wrap {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

kpdd-search-form[hero] .usb-input {
  font-size: 16px;
  padding: 14px 0 14px 24px;
  caret-color: #1a1a1a;
}

kpdd-search-form[hero] .usb-mirror,
kpdd-search-form[hero] .usb-mirror-placeholder {
  font-size: 16px;
  padding: 14px 0 14px 24px;
}

kpdd-search-form[hero] .usb-gps-btn {
  right: 100px;
  font-size: 18px;
}

kpdd-search-form[hero] .usb-submit-btn {
  padding: 0 28px;
  font-size: 15px;
  height: 52px;
  line-height: 25px;
}

@media (max-width: 575px) {
  kpdd-search-form[hero] .usb-input {
    font-size: 14px;
    padding: 10px 0 10px 16px;
  }

  kpdd-search-form[hero] .usb-mirror,
  kpdd-search-form[hero] .usb-mirror-placeholder {
    font-size: 14px;
    padding: 10px 0 10px 16px;
  }

  kpdd-search-form[hero] .usb-submit-label {
    display: none;
  }

  kpdd-search-form[hero] .usb-submit-btn {
    padding: 10px 14px;
    height: auto;
  }

  kpdd-search-form[hero] .usb-gps-btn {
    right: 52px;
  }
}

/* ================================================================
   GOOGLE-STYLE OVERLAY — hero search expands on focus
   Search bar pins to top, white bg, results fill below.
   ================================================================ */

/* Lock body scroll when overlay is open */
body.usb-overlay-open {
  overflow: hidden;
}

/* Portal — lives at body level, outside all shadow DOM / containment contexts */
.usb-overlay-portal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #fff;
  display: flex;
  flex-direction: column;
  animation: usbOverlayIn 0.15s ease-out;
}

kpdd-search-form.usb--overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: var(--space-md) var(--space-lg);
  background: #fff;
}

@keyframes usbOverlayIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hide tabs in overlay — no room, focus on search */
kpdd-search-form.usb--overlay .usb-tabs {
  display: none;
}

/* Pill in overlay mode — no shadow, subtle border */
kpdd-search-form.usb--overlay .usb-input-wrap {
  box-shadow: none;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 100px;
  flex-shrink: 0;
}

/* Input text dark in overlay — font-size must match mirror exactly */
kpdd-search-form.usb--overlay .usb-input {
  color: var(--color-text, #1a1a1a);
  font-size: 16px;
  padding: 12px 0 12px 44px;
}

/* Mirror layers must match input font-size and padding in overlay */
kpdd-search-form.usb--overlay .usb-mirror,
kpdd-search-form.usb--overlay .usb-mirror-placeholder {
  font-size: 16px;
  padding: 12px 0 12px 44px;
}

kpdd-search-form.usb--overlay .usb-input::placeholder {
  color: var(--color-muted, #9ca3af);
}

/* (search icon removed from pill — kept in submit button only) */

/* GPS button dark in overlay */
kpdd-search-form.usb--overlay .usb-gps-btn {
  color: var(--color-muted, #6b7280);
}

/* Dropdown in overlay: not absolute, flows in column, fills remaining space */
kpdd-search-form.usb--overlay .omni-dropdown {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--color-border, #e5e7eb);
  margin-top: var(--space-sm);
  max-height: none;
  flex: 1;
  overflow-y: auto;
}

/* Close button for overlay */
kpdd-search-form.usb--overlay::before {
  content: '';
}

kpdd-search-form.usb--overlay .usb-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

kpdd-search-form.usb--overlay .usb-input-row {
  flex-shrink: 0;
}

/* Back/close button in overlay */
.usb-overlay-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-muted, #6b7280);
  cursor: pointer;
  padding: 8px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.usb-overlay-close:hover {
  background: var(--color-bg-alt, #f3f4f6);
  color: var(--color-text, #1a1a1a);
}

/* padding-left for overlay close button — handled above with full padding shorthand */

/* ================================================================
   FILTER VARIANT — same pill look, slightly smaller, in the filter bar
   Uses same colors and shape as hero for visual consistency.
   ================================================================ */

/* Host layout (flex, min/max-width, responsive order) handled by shadow DOM CSS */

kpdd-search-form:not([hero]) .usb-input-wrap {
  background: #fff;
  border: 1.5px solid var(--color-border);
  padding: 3px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

kpdd-search-form:not([hero]) .usb-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

kpdd-search-form:not([hero]) .usb-input {
  font-size: 14px;
  padding: 8px 0 8px 16px;
}

kpdd-search-form:not([hero]) .usb-mirror,
kpdd-search-form:not([hero]) .usb-mirror-placeholder {
  font-size: 14px;
  padding: 8px 0 8px 16px;
}

kpdd-search-form:not([hero]) .usb-gps-btn {
  right: 56px;
  font-size: 14px;
  padding: 4px;
}

kpdd-search-form:not([hero]) .usb-submit-btn {
  padding: 11px 14px;
  font-size: 12px;
}

kpdd-search-form:not([hero]) .usb-submit-label {
  display: none;
}

/* Submit button spinner animation */
.omni-spin {
  animation: omni-spin 0.8s linear infinite;
}
@keyframes omni-spin {
  to { transform: rotate(360deg); }
}

/* Responsive filter layout handled by shadow DOM CSS */
