/* ============================================================
   Booking bar — override [iw_availability_search]
   Adatta il form al design editoriale del tema HelloChalet.
   ============================================================ */

/* Contenitore che emerge dall'hero (homepage) */
.booking-bar-wrap {
  margin: -56px auto 0;
  max-width: calc(var(--maxw) - var(--gutter) * 2);
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  box-shadow: 0 20px 60px -30px rgba(31,36,25,0.4);
  border-radius: 4px;
  position: relative;
  z-index: 4;
  overflow: hidden;
}

/* In pagina archivio: integrata nel layout, senza card */
.listings-search-wrap .archive-search-bar .iw-avail-search-wrapper {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.listings-search-wrap .archive-search-bar .iw-avail-field,
.listings-search-wrap .archive-search-bar .iw-avail-field-submit {
  padding-top: 28px;
  padding-bottom: 28px;
}
.listings-search-wrap .archive-search-bar .iw-avail-field:first-child { padding-left: 0; }
.listings-search-wrap .archive-search-bar .iw-avail-field-submit { padding-right: 0; }

/* Reset variabili del plugin — usiamo quelle del tema */
.booking-bar-wrap .iw-avail-search-wrapper {
  --iw-avail-h: auto;
  --iw-avail-radius: 0;
  --iw-avail-gap: 0;
  --iw-avail-border: var(--c-line-2);
  --iw-avail-color: var(--c-ink);
}

/* Form: griglia 5 colonne inline — sovrascrive flex del plugin */
.booking-bar-wrap .iw-avail-search-form { margin: 0; }

.booking-bar-wrap .iw-avail-search-fields {
  display: grid !important;
  grid-template-columns: 1.6fr 1fr 1fr 0.8fr auto !important;
  grid-template-areas: "destination checkin checkout guests submit" !important;
  gap: 0 !important;
  align-items: stretch;
  flex-wrap: unset;
}
.booking-bar-wrap .iw-avail-field--destination { grid-area: destination; }
.booking-bar-wrap .iw-avail-field--checkin     { grid-area: checkin; }
.booking-bar-wrap .iw-avail-field--checkout    { grid-area: checkout; }
.booking-bar-wrap .iw-avail-field--guests      { grid-area: guests; }
.booking-bar-wrap .iw-avail-field-submit       { grid-area: submit; }

/* Ogni campo */
.booking-bar-wrap .iw-avail-field,
.booking-bar-wrap .iw-avail-field-submit {
  padding: 22px 28px;
  border-right: 1px solid var(--c-line-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: unset;
}
.booking-bar-wrap .iw-avail-field-submit { padding: 0; border-right: 0; }
.booking-bar-wrap .iw-avail-field--destination { flex: unset; min-width: 0; }

/* Label */
.booking-bar-wrap .iw-avail-label {
  font-family: var(--f-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 10px;
  color: var(--c-muted);
  font-weight: 400;
  margin-bottom: 0;
}

/* Input date */
.booking-bar-wrap .iw-avail-input {
  border: 0;
  background: transparent;
  font-family: var(--f-display);
  font-size: 22px;
  font-style: italic;
  color: var(--c-ink);
  outline: none;
  width: 100%;
  padding: 0;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  line-height: 1.2;
}
.booking-bar-wrap .iw-avail-input:focus { border: 0; box-shadow: none; outline: none; }

/* Select destinazione */
.booking-bar-wrap .iw-avail-select-wrap { position: relative; }

.booking-bar-wrap .iw-avail-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--f-display);
  font-size: 22px;
  font-style: italic;
  color: var(--c-ink);
  outline: none;
  width: 100%;
  padding: 0;
  height: auto;
  border-radius: 0;
  cursor: pointer;
  line-height: 1.2;
}
.booking-bar-wrap .iw-avail-select:focus { box-shadow: none; outline: none; }

.booking-bar-wrap .iw-avail-select-arrow {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  pointer-events: none;
  color: var(--c-muted);
}
.booking-bar-wrap .iw-avail-select-arrow svg { width: 16px; height: 16px; display: block; }

/* Counter ospiti */
.booking-bar-wrap .iw-counter {
  display: flex;
  align-items: center;
  gap: 12px;
}
.booking-bar-wrap .iw-counter-val {
  font-family: var(--f-display);
  font-size: 22px;
  font-style: italic;
  color: var(--c-ink);
  min-width: 24px;
  text-align: center;
  line-height: 1.2;
}
.booking-bar-wrap .iw-counter-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--c-line);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--c-ink);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.booking-bar-wrap .iw-counter-btn:hover {
  background: var(--c-cream-2);
  border-color: var(--c-ink);
}

/* Bottone cerca — sovrascrive colore teal del plugin */
.booking-bar-wrap .iw-avail-btn,
.booking-bar-wrap .iw-avail-btn.iw-avail-submit,
.booking-bar-wrap .iw-avail-btn:hover,
.booking-bar-wrap .iw-avail-btn:focus-visible {
  height: 100%;
  width: 100%;
  min-width: 140px;
  background: var(--c-ink) !important;
  color: var(--c-cream) !important;
  border: 0;
  font-family: var(--f-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 11px;
  cursor: pointer;
  transition: opacity 0.2s;
  border-radius: 0;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: none;
}
.booking-bar-wrap .iw-avail-btn:hover,
.booking-bar-wrap .iw-avail-btn:focus-visible { opacity: 0.85; }

.booking-bar-wrap .iw-avail-btn .iw-icon {
  width: 16px; height: 16px; flex-shrink: 0;
}

/* Loader */
.booking-bar-wrap .iw-avail-loader {
  padding: 20px 28px;
  font-family: var(--f-eyebrow);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.booking-bar-wrap .iw-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--c-line);
  border-top-color: var(--c-forest);
  border-radius: 50%;
  animation: iw-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes iw-spin { to { transform: rotate(360deg); } }

/* Area risultati — appare sotto la booking bar */
.booking-bar-wrap .iw-avail-search-results {
  border-top: 1px solid var(--c-line-2);
  padding: 40px 28px 48px;
}
.booking-bar-wrap .iw-avail-results-header {
  font-family: var(--f-eyebrow);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 24px;
}
.booking-bar-wrap .iw-avail-results-grid {
  display: grid;
  grid-template-columns: repeat(var(--iw-columns, 3), 1fr);
  gap: 24px;
}
.booking-bar-wrap .iw-empty-state {
  font-family: var(--f-eyebrow);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-muted);
  text-align: center;
  padding: 24px 0;
}
.booking-bar-wrap .iw-error {
  padding: 16px 28px;
  font-family: var(--f-body);
  font-size: 13px;
  color: #c0392b;
  border-top: 1px solid var(--c-line-2);
}

/* ---- Responsive ---- */
@media (max-width: 1023px) {
  .booking-bar-wrap .iw-avail-search-fields {
    grid-template-columns: 1fr 1fr !important;
    grid-template-areas:
      "destination checkin"
      "checkout    guests"
      "submit      submit" !important;
  }
  .booking-bar-wrap .iw-avail-field-submit { padding: 0; }
  .booking-bar-wrap .iw-avail-btn,
  .booking-bar-wrap .iw-avail-btn.iw-avail-submit {
    min-width: unset;
    padding: 20px !important;
  }
  .booking-bar-wrap .iw-avail-field { border-bottom: 1px solid var(--c-line-2); }
  .booking-bar-wrap .iw-avail-results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .booking-bar-wrap { margin-top: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .booking-bar-wrap .iw-avail-search-fields {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "destination"
      "checkin"
      "checkout"
      "guests"
      "submit" !important;
  }
  .booking-bar-wrap .iw-avail-field { border-right: 0; }
  .booking-bar-wrap .iw-avail-results-grid { grid-template-columns: 1fr; }
}
