/*
 * PublicV2 search form surface
 *
 * This is the canonical visual skin for public/partials/search_form.html.
 * Page-level templates may select only the opacity variant; layout, controls,
 * responsive behaviour and dropdown layering stay shared.
 */

.public-search-surface {
  --search-surface-top-alpha: 0.98;
  --search-surface-bottom-alpha: 0.94;
  --search-surface-base-alpha: 0.96;
  --search-surface-border-alpha: 0.18;
  --search-label-color: rgba(15, 23, 42, 0.88);
  --search-label-shadow: none;

  position: relative;
  z-index: 60;
  margin-top: 12px;
  padding: 10px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, var(--search-surface-border-alpha));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, var(--search-surface-top-alpha)),
      rgba(255, 255, 255, var(--search-surface-bottom-alpha))
    ),
    rgba(255, 255, 255, var(--search-surface-base-alpha));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 18px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}

/* The landing keeps the exact glass opacity that was previously scoped there. */
.public-search-surface--landing {
  --search-surface-top-alpha: 0.16;
  --search-surface-bottom-alpha: 0.08;
  --search-surface-base-alpha: 0.08;
  --search-label-color: rgba(255, 255, 255, 0.88);
  --search-label-shadow: 0 1px 12px rgba(0, 0, 0, 0.30);
}

.public-search-surface .modern-form {
  margin: 0;
}

.public-search-surface .modern-form-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.35fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 10px;
}

.public-search-surface .modern-form--route-swap-between .modern-form-row {
  grid-template-columns: minmax(0, 2.55fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 0.9fr) minmax(0, 1fr);
}

@media (min-width: 992px) {
  .public-search-surface .modern-form--route-swap-between .modern-field-route-cluster {
    grid-column: span 1;
  }
}

.public-search-surface .modern-label,
.public-search-surface .modern-route-head-label,
.public-search-surface .modern-route-cluster-col > .modern-label {
  color: var(--search-label-color) !important;
  opacity: 0.96;
  text-shadow: var(--search-label-shadow);
}

/* Supera la vecchia etichetta bianca globale nell'iframe e nelle superfici opache. */
.ui-public .public-search-surface--default .modern-form--route-swap-between .modern-route-head-label {
  color: #0f172a !important;
  opacity: 0.96;
  text-shadow: none;
}

.public-search-surface .modern-input {
  border-color: rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: #0f172a;
  box-shadow: none;
}

.public-search-surface .modern-input::placeholder {
  color: rgba(15, 23, 42, 0.48);
}

.public-search-surface .btn-modern-cta {
  box-shadow: none !important;
}

.public-search-surface .modern-form--route-swap-between .modern-route-cluster-grid {
  background: #ffffff;
}

.public-search-surface .modern-form--route-swap-between .modern-route-swap-field {
  position: relative;
  z-index: 20;
  border-radius: 999px;
  background: #ffffff;
}

.public-search-surface .location-picker,
.public-search-surface .pax-picker {
  position: relative;
  z-index: 70;
}

.public-search-surface .modern-dropdown,
.public-search-surface .pax-dropdown {
  z-index: 1400 !important;
}

.public-search-surface .modern-dropdown {
  width: min(330px, 88vw);
}

.public-search-surface .modern-dropdown .modern-scroll {
  max-height: min(46vh, 360px);
}

@media (max-width: 991.98px) {
  .public-search-surface .modern-form-row,
  .public-search-surface .modern-form--route-swap-between .modern-form-row {
    grid-template-columns: 1fr;
  }

  .public-search-surface .modern-form--route-swap-between .modern-route-cluster-grid {
    position: relative;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .public-search-surface .modern-form--route-swap-between .modern-field-route-source {
    position: relative;
    z-index: 1;
    grid-column: 1;
    grid-row: 1;
  }

  .public-search-surface .modern-form--route-swap-between .modern-field-route-destination {
    position: relative;
    z-index: 1;
    display: flex;
    grid-column: 1;
    grid-row: 2;
    flex-direction: column-reverse;
  }

  .public-search-surface .modern-form--route-swap-between .modern-field-route-destination > .modern-label {
    margin: 6px 0 0;
  }

  .public-search-surface .modern-form--route-swap-between .modern-route-swap-field {
    position: absolute;
    z-index: 1600;
    top: 50%;
    right: 16px;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    pointer-events: auto;
  }

  .public-search-surface .modern-swap-btn.modern-swap-btn--between {
    position: relative;
    z-index: 1601;
    width: 42px;
    min-width: 42px;
    height: 42px;
    opacity: 1;
    box-shadow: 0 10px 22px rgba(15, 76, 129, 0.34);
  }

  .public-search-surface .modern-form--route-swap-between .modern-field-route-source .modern-input {
    border-radius: 16px 16px 0 0;
  }

  .public-search-surface .modern-form--route-swap-between .modern-field-route-destination .modern-input {
    border-top: 0;
    border-radius: 0 0 16px 16px;
  }

  .public-search-surface .modern-form--route-swap-between .modern-route-cluster-grid:has(.location-picker.is-open) .modern-route-swap-field {
    z-index: 0;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .public-search-surface .location-picker.inline-dropdown.is-open {
    z-index: 2100 !important;
  }

  .public-search-surface .location-picker.inline-dropdown.is-open .modern-icon,
  .public-search-surface .location-picker.inline-dropdown.is-open .modern-caret,
  .public-search-surface .location-picker.inline-dropdown.is-open .location-clear-btn {
    top: 27px;
  }

  .public-search-surface .location-picker.inline-dropdown.is-open .location-dropdown.modern-dropdown {
    position: relative !important;
    z-index: 2110 !important;
    margin-top: 10px !important;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22) !important;
  }

  .public-search-surface .modern-form--route-swap-between .modern-route-head-label,
  .public-search-surface .modern-form--route-swap-between .modern-route-cluster-col > .modern-label {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .public-search-surface .modern-dropdown {
    width: min(100%, calc(100vw - 2rem));
  }

  .public-search-surface .modern-dropdown .modern-scroll {
    max-height: min(44vh, 20rem);
  }

  .public-search-surface .location-picker.inline-dropdown,
  .public-search-surface .pax-picker.inline-dropdown {
    position: relative !important;
    z-index: 120;
  }

  .public-search-surface .location-picker.inline-dropdown .location-dropdown.modern-dropdown,
  .public-search-surface .pax-picker.inline-dropdown .pax-dropdown {
    position: static !important;
    z-index: 130 !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 8px !important;
    transform: none !important;
    background: #ffffff !important;
    opacity: 1 !important;
  }

  .public-search-surface .location-picker.inline-dropdown .location-dropdown.modern-dropdown {
    border: 1px solid rgba(0, 0, 0, 0.10) !important;
  }
}

/* In un iframe, vh segue l'altezza ancora in aggiornamento del frame. */
.cs-embed-page .public-search-surface .location-dropdown .modern-scroll,
.public-iframe-mode .public-search-surface .location-dropdown .modern-scroll {
  max-height: 360px;
}

@media (max-width: 575.98px) {
  .cs-embed-page .public-search-surface .location-dropdown .modern-scroll,
  .public-iframe-mode .public-search-surface .location-dropdown .modern-scroll {
    max-height: 320px;
  }
}
