/**
 * Hero search bar — single source of truth (Airbnb-style)
 * Loads last; overrides main.css + form-underline.css + homepage.css
 */

.hero-search-wrap {
  --hs-x: 1.125rem;
  --hs-label: 0.625rem;
  --hs-value: 0.875rem;
  --hs-label-lh: 1.15;
  --hs-value-lh: 1.25;
  --hs-field-h: 4rem;
  --hs-muted: #6b6b6b;
  --hs-text: #1a1a1a;
  --hs-stack-gap: 0.375rem;
  --hs-border: #e8e8e8;
  --hs-active: #f7f7f7;
}

/* ——— Bar shell ——— */
.head-section--compact .hero-search-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-wrap: nowrap;
  background: #fff;
  border: 1px solid var(--hs-border);
  border-radius: 0;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.1);
  padding: 0;
  min-height: var(--hs-field-h);
  overflow: visible;
  position: relative;
}

.head-section--compact .hero-search-bar .search-separator {
  width: 1px;
  align-self: stretch;
  margin: 0.5rem 0;
  background: var(--hs-border);
  flex-shrink: 0;
}

/* ——— Each field: centered label + value stack (Airbnb) ——— */
.head-section--compact .hero-search-bar .search-field {
  flex: 1 1 0;
  min-width: 0;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  text-align: left;
  min-height: var(--hs-field-h) !important;
  padding: 0 !important;
  margin: 0;
  gap: 0;
  position: relative;
  z-index: 1;
  overflow: visible;
  background: transparent;
  cursor: pointer;
  border: none;
  box-sizing: border-box;
}

.head-section--compact .hero-search-bar .search-field-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--hs-stack-gap);
  width: 100%;
  min-width: 0;
  min-height: var(--hs-field-h);
  padding: 0 var(--hs-x);
  box-sizing: border-box;
}

.head-section--compact .hero-search-bar .destination-field {
  flex: 1.3 1 0;
}

.head-section--compact .hero-search-bar .date-field {
  flex: 0.82 1 0;
}

.head-section--compact .hero-search-bar .guests-field {
  flex: 0.9 1 0;
}

.head-section--compact .hero-search-bar .search-field.is-active {
  background: var(--hs-active) !important;
  z-index: 2;
}

.head-section--compact .hero-search-bar .search-field.is-active .search-field-stack {
  background: transparent;
}

/* Label */
.head-section--compact .hero-search-bar .search-field-label {
  display: block;
  margin: 0 !important;
  padding: 0 !important;
  font-size: var(--hs-label) !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  line-height: var(--hs-label-lh) !important;
  color: var(--hs-green) !important;
  text-align: left !important;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Value — input & preferences trigger */
.head-section--compact .hero-search-bar .search-input,
.head-section--compact .hero-search-bar .search-input--trigger,
.head-section--compact .hero-search-bar .lg-underline-field {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  font-family: inherit !important;
  font-size: var(--hs-value) !important;
  font-weight: 400 !important;
  line-height: var(--hs-value-lh) !important;
  color: var(--hs-text) !important;
  text-align: left !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-image: none !important;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  box-sizing: border-box;
}

.head-section--compact .hero-search-bar button.search-input--trigger {
  text-align: left;
  font-family: inherit;
}

.head-section--compact .hero-search-bar .search-input::placeholder {
  color: var(--hs-muted) !important;
  opacity: 1;
}

.head-section--compact .hero-search-bar .search-input:placeholder-shown {
  color: var(--hs-muted) !important;
}

.head-section--compact .hero-search-bar .search-input--trigger {
  color: var(--hs-muted) !important;
}

.head-section--compact .hero-search-bar .search-input--trigger.has-value {
  color: var(--hs-text) !important;
}

/* Search button */
.head-section--compact .hero-search-bar .hero-search-submit {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 1.75rem;
  min-width: 7.5rem;
  min-height: var(--hs-field-h);
  border: none;
  border-radius: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--hs-green);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.head-section--compact .hero-search-bar .hero-search-submit:hover {
  background: #0a3d2a;
  transform: none;
}

/* ——— Unified date panel ——— */
.hero-search-dates-panel__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  padding: 0.75rem 1rem 1rem;
}

.calendar-month-block {
  min-width: 0;
}

.hero-search-dates-panel .calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.calendar-header-spacer {
  flex: 0 0 2rem;
}

/* Date range */
.head-section--compact .hero-search-bar .calendar-day.in-range {
  background: rgba(6, 40, 28, 0.14);
  color: var(--hs-green);
  border-radius: 0;
}

.head-section--compact .hero-search-bar .calendar-day.range-start,
.head-section--compact .hero-search-bar .calendar-day.range-end {
  background: var(--hs-green);
  color: #fff;
}

.head-section--compact .hero-search-bar .calendar-day.range-start {
  border-radius: 999px 0 0 999px;
}

.head-section--compact .hero-search-bar .calendar-day.range-end {
  border-radius: 0 999px 999px 0;
}

.head-section--compact .hero-search-bar .calendar-day.range-start.range-end {
  border-radius: 999px;
}

/* ——— Flyout panels — reset main.css absolute dropdown rules ——— */
.head-section--compact .hero-search-flyout .hero-search-step-panel {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  transform: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.head-section--compact .hero-search-flyout .hero-search-step-panel.active {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ——— Desktop flyout panels ——— */
@media (min-width: 769px) {
  .head-section--compact .hero-search-bar .search-field .search-dropdown {
    display: none !important;
  }

  .head-section--compact .hero-search-flyout .hero-search-dates-panel,
  .head-section--compact .hero-search-flyout .destination-dropdown,
  .head-section--compact .hero-search-flyout .guests-dropdown,
  .head-section--compact .hero-search-flyout .details-dropdown {
    width: 100%;
    max-width: 100%;
    max-height: min(420px, 52vh);
    overflow-y: auto;
  }
}

/* ——— Mobile: stacked fields, inline panels ——— */
@media (max-width: 768px) {
  .hero-search-wrap {
    --hs-x: 1rem;
    --hs-field-h: auto;
    --hs-mobile-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --hs-mobile-duration: 0.38s;
  }

  @keyframes hs-mobile-panel-in {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .head-section--compact .hero-search-bar {
    flex-direction: column !important;
    min-height: 0;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    transition:
      box-shadow var(--hs-mobile-duration) var(--hs-mobile-ease),
      transform var(--hs-mobile-duration) var(--hs-mobile-ease);
  }

  .head-section--compact .hero-search-bar.is-mobile-expanded {
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
    transform: translateY(-2px);
  }

  .head-section--compact .hero-search-bar .search-separator {
    display: none;
  }

  .head-section--compact .hero-search-bar .search-field {
    flex: none !important;
    width: 100% !important;
    min-height: 0 !important;
    justify-content: flex-start !important;
    border-bottom: 1px solid #ececec;
    transition: background-color 0.28s ease;
  }

  .head-section--compact .hero-search-bar .search-field-stack {
    min-height: 0;
    padding: 0.75rem var(--hs-x) 0.65rem;
    transition: padding 0.28s var(--hs-mobile-ease);
  }

  .head-section--compact .hero-search-bar .search-field.is-active .search-field-stack {
    padding-top: 0.85rem;
    padding-bottom: 0.7rem;
  }

  .head-section--compact .hero-search-bar .search-field:last-of-type {
    border-bottom: none;
  }

  .head-section--compact .hero-search-bar .search-field:not(:has(.search-dropdown)) .search-field-stack {
    padding-bottom: 0.85rem;
  }

  .head-section--compact .hero-search-bar .search-dropdown {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-top: 1px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 0 !important;
    visibility: visible !important;
    overflow: hidden !important;
    transform: translateY(-6px);
    pointer-events: none;
    padding: 0;
    transition:
      max-height var(--hs-mobile-duration) var(--hs-mobile-ease),
      opacity 0.3s ease,
      transform var(--hs-mobile-duration) var(--hs-mobile-ease),
      border-color 0.25s ease !important;
  }

  .head-section--compact .hero-search-bar .search-dropdown.active {
    max-height: min(78vh, 680px) !important;
    opacity: 1 !important;
    transform: translateY(0);
    pointer-events: auto;
    border-top-color: #f0f0f0 !important;
  }

  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .dropdown-section,
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item {
    animation: hs-mobile-panel-in 0.38s var(--hs-mobile-ease) both;
    animation-delay: calc(var(--hs-item-index, 0) * 35ms);
  }

  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(1) { --hs-item-index: 0; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(2) { --hs-item-index: 1; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(3) { --hs-item-index: 2; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(4) { --hs-item-index: 3; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(5) { --hs-item-index: 4; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .destination-item:nth-child(n+6) { --hs-item-index: 5; }

  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .calendar-month-block,
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guest-option,
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guests-done-btn {
    animation: hs-mobile-panel-in 0.4s var(--hs-mobile-ease) both;
  }

  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .calendar-month-block:nth-child(2) {
    animation-delay: 0.06s;
  }

  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guest-option:nth-child(1) { animation-delay: 0.04s; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guest-option:nth-child(2) { animation-delay: 0.08s; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guest-option:nth-child(3) { animation-delay: 0.12s; }
  .head-section--compact .hero-search-bar .search-dropdown.active.is-entering .guests-done-btn { animation-delay: 0.16s; }

  .head-section--compact .hero-search-bar .hero-search-submit {
    width: 100%;
    min-height: 3.375rem;
    order: 10;
    transition: transform 0.28s var(--hs-mobile-ease);
  }

  .head-section--compact .hero-search-bar.is-mobile-expanded .hero-search-submit {
    transform: translateY(2px);
  }

  .hero-search-dates-panel__inner {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0.85rem;
  }

  .head-section--compact .hero-search-flyout {
    display: none !important;
  }

  .head-section--compact .hero-search-slider {
    display: none !important;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .head-section--compact .hero-search-bar,
  .head-section--compact .hero-search-bar .search-field,
  .head-section--compact .hero-search-bar .search-dropdown,
  .head-section--compact .hero-search-bar .hero-search-submit {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }

  .head-section--compact .hero-search-bar .search-dropdown.active {
    max-height: none !important;
  }
}
