/* ============================================================
   HotelPack — Front Searchbar (FINAL CLEAN + FIXED STICKY)
   ============================================================ */

:root{
  --hp-front-sticky-top: 74px;
  --hp-front-sticky-top-mobile: 66px;

  --hp-search-max-width: 1540px;

  --hp-search-bg: rgba(255,255,255,0.96);
  --hp-search-border: #ff7a00;
  --hp-search-shadow: 0 14px 34px rgba(0,0,0,0.10);

  --hp-field-border: #d9dde3;
  --hp-field-border-focus: #ff7a00;

  --hp-pill-bg: #f3f5f7;

  --hp-submit-bg: #ff7a00;
}

/* WRAPPER */
.hp-frontpage .hp-search{
  position: relative; /* 🔥 FIX: niente sticky bloccato */
  width: 100%;
  padding: 24px 0 12px;
}

/* CONTAINER */
.hp-frontpage .hp-search-inner{
  width: min(var(--hp-search-max-width), calc(100% - 32px));
  margin-inline: auto;
}

/* BAR */
.hp-frontpage .hp-search-form{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;

  padding: 12px;
  border-radius: 14px;

  background: var(--hp-search-bg);
  border: 2px solid var(--hp-search-border);
  box-shadow: var(--hp-search-shadow);

  overflow: hidden;
}

/* SEGMENT */
.hp-frontpage .hp-search-segment{
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 4px;
  border-radius: 10px;
  background: var(--hp-pill-bg);

  flex: 0 0 auto;
}

.hp-frontpage .hp-search-segment label{
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.hp-frontpage .hp-search-segment input{
  display: none;
}

.hp-frontpage .hp-search-segment span{
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* ATTIVO */
.hp-frontpage .hp-search-segment input:checked + span{
  background: rgba(255,122,0,0.15);
  color: #ff7a00;
  font-weight: 700;
}

/* INPUT */
.hp-frontpage .hp-input{
  height: 46px;
  min-width: 0;
  width: 100%;

  padding: 0 14px;
  border-radius: 10px;

  border: 1px solid var(--hp-field-border);
  background: #fff;

  font-size: 14px;
}

/* PROPORZIONI */
.hp-frontpage .hp-input[name="location"]{
  flex: 1.8;
}

.hp-frontpage .hp-date-wrap{
  flex: 1;
  position: relative;
}

.hp-frontpage .hp-guests{
  flex: 0.8;
}

/* DATE FIX */
.hp-frontpage .hp-date-input{
  color: transparent;
}

.hp-frontpage .hp-date-input:focus,
.hp-frontpage .hp-date-input.has-value{
  color: #111;
}

.hp-frontpage .hp-date-fake{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #666;
  pointer-events: none;
}

.hp-frontpage .hp-date-input:focus + .hp-date-fake,
.hp-frontpage .hp-date-input.has-value + .hp-date-fake{
  opacity: 0;
}

/* BUTTON */
.hp-frontpage .hp-search-submit,
.hp-frontpage .hp-search-form > button[type="submit"]{
  height: 46px;
  padding: 0 22px;

  border: 0;
  border-radius: 10px;

  background: var(--hp-submit-bg);
  color: #fff;

  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}

/* Field wrappers (markup uses .hp-field inside the form) */
.hp-frontpage .hp-search-form > .hp-field{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hp-frontpage .hp-search-form > .hp-field label{
  font-size: 12px;
  color: #666;
  line-height: 1.2;
}

.hp-frontpage .hp-search-form > .hp-field input,
.hp-frontpage .hp-search-form > .hp-field select{
  box-sizing: border-box;
}

/* ============================================================
   Responsive — home search bar only (Patch 1)
   Desktop (769px+): rules above unchanged.
   ============================================================ */

/* Tablet: two-row layout, no horizontal overflow */
@media (max-width: 768px){
  .hp-frontpage .hp-search{
    padding: 20px 0 12px;
  }

  .hp-frontpage .hp-search-inner{
    width: min(var(--hp-search-max-width), calc(100% - 24px));
  }

  .hp-frontpage .hp-search-form{
    flex-wrap: wrap;
    align-items: stretch;
    align-content: flex-start;
    gap: 12px;
    padding: 14px;
    overflow: visible;
  }

  .hp-frontpage .hp-search-segment{
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .hp-frontpage .hp-search-form > .hp-field.hp-location{
    flex: 1 1 100%;
    width: 100%;
    min-width: 0 !important;
  }

  .hp-frontpage .hp-search-form > .hp-field.hp-date{
    flex: 1 1 calc(50% - 6px);
    width: auto !important;
    min-width: 0;
  }

  .hp-frontpage .hp-search-form > .hp-field.hp-guests{
    flex: 1 1 calc(50% - 6px);
    width: auto !important;
    min-width: 0;
  }

  .hp-frontpage .hp-search-form > .hp-field input,
  .hp-frontpage .hp-search-form > .hp-field select,
  .hp-frontpage .hp-input{
    width: 100%;
    min-height: 46px;
    height: 46px;
  }

  .hp-frontpage .hp-input[name="location"]{
    flex: none;
  }

  .hp-frontpage .hp-date-wrap{
    flex: none;
    width: 100%;
  }

  .hp-frontpage .hp-guests{
    flex: none;
    width: 100%;
  }

  .hp-frontpage .hp-search-submit,
  .hp-frontpage .hp-search-form > button[type="submit"]{
    flex: 1 1 calc(50% - 6px);
    width: auto;
    min-width: 0;
    min-height: 46px;
    align-self: stretch;
  }
}

/* Mobile: stacked full-width controls */
@media (max-width: 480px){
  .hp-frontpage .hp-search-inner{
    width: min(var(--hp-search-max-width), calc(100% - 20px));
  }

  .hp-frontpage .hp-search-form{
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 14px 12px;
  }

  .hp-frontpage .hp-search-segment{
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
  }

  .hp-frontpage .hp-search-segment label{
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
  }

  .hp-frontpage .hp-search-segment span{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 6px;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.2;
  }

  .hp-frontpage .hp-search-form > .hp-field,
  .hp-frontpage .hp-search-form > .hp-field.hp-location,
  .hp-frontpage .hp-search-form > .hp-field.hp-date,
  .hp-frontpage .hp-search-form > .hp-field.hp-guests{
    flex: 1 1 100%;
    width: 100% !important;
    min-width: 0 !important;
  }

  .hp-frontpage .hp-search-form > .hp-field input,
  .hp-frontpage .hp-search-form > .hp-field select,
  .hp-frontpage .hp-input{
    width: 100%;
    min-height: 46px;
    height: 46px;
    font-size: 16px;
  }

  .hp-frontpage .hp-search-submit,
  .hp-frontpage .hp-search-form > button[type="submit"]{
    width: 100%;
    min-height: 48px;
    height: 48px;
    padding: 0 18px;
  }
}

/* Narrow phones: keep tipo soggiorno pills from crowding */
@media (max-width: 390px){
  .hp-frontpage .hp-search-segment label{
    flex: 1 1 100%;
  }

  .hp-frontpage .hp-search-segment span{
    min-height: 44px;
  }
}
