/* --- ID 233: AI search (clean) ----------------------------------------- */

.hp-form--listing-search {
  position: relative;
}

/* Keep native fields visually hidden while AI mode is open (desktop/tablet). */
.hp-form--listing-search.hr-ai-active .hp-form__field,
.hp-form--listing-search.hr-ai-active .hp-form__footer {
  opacity: 0;
  filter: blur(2px);
  pointer-events: none;
  transition: opacity 0.24s ease, filter 0.24s ease;
}

/* ---------- AI toggle button ---------- */
.hr-ai-toggle {
  position: absolute;
  top: 50%;
  right: -4.5rem;
  transform: translateY(-50%);
  z-index: 30;

  width: 60px;
  height: 60px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: #f9fafb;
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.18),
    0 0 0 4px rgba(148, 163, 184, 0.1);

  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.hr-ai-toggle:hover,
.hr-ai-toggle:focus-visible {
  box-shadow:
    0 14px 40px rgba(15, 23, 42, 0.24),
    0 0 0 5px rgba(148, 163, 184, 0.16);
}

.hp-form--listing-search.hr-ai-active .hr-ai-toggle {
  opacity: 0;
  pointer-events: none;
}

.hr-ai-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
}

.hr-ai-toggle__icon svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

/* ---------- AI inline bar ---------- */
.hr-ai-bar {
  position: absolute;
  inset: 0;
  z-index: 25;

  display: flex;
  align-items: center;
  padding: 0 2.2rem;
  border-radius: 999px;

  opacity: 0;
  pointer-events: none;
  transform: scale(0.99);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.hr-ai-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.hr-ai-bar__inner {
  width: 100%;
}

/* Accessible label only. */
.hr-ai-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.hr-ai-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hr-ai-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: #111827;
  font-size: 1.05rem;
  line-height: 1.45;
  padding: 0;
  margin: 0;
  outline: none;
}

.hr-ai-input::placeholder {
  color: #9ca3af;
}

.hr-ai-submit.button-primary {
  border-radius: 999px;
  white-space: nowrap;
}

.hr-ai-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  margin: 0;

  background: #f3f4f6;
  color: #4b5563;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;

  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.hr-ai-close:hover,
.hr-ai-close:focus-visible {
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

/* ---------- Mobile experience ---------- */
@media (max-width: 768px) {
  .hp-form--listing-search {
    transition:
      background-color 0.22s ease-out,
      box-shadow 0.22s ease-out,
      border-color 0.22s ease-out,
      padding 0.22s ease-out,
      border-radius 0.22s ease-out;
  }

  .hp-form--listing-search .hp-form__fields {
    transition: min-height 0.22s ease-out, padding 0.22s ease-out, margin 0.22s ease-out;
  }

  .hp-form--listing-search .hp-form__field,
  .hp-form--listing-search .hp-form__footer {
    transition:
      opacity 0.18s ease-out,
      max-height 0.22s ease-out,
      margin 0.22s ease-out,
      padding 0.22s ease-out,
      border-color 0.22s ease-out;
  }

  .hp-form--listing-search .hp-form__footer {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding-inline: 1.1rem;
  }

  .hp-form--listing-search .hp-form__footer .hp-form__button {
    flex: 1 1 auto;
    width: 100%;
  }

  .hp-form--listing-search .hp-form__footer .hr-ai-toggle {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    width: 50px;
    height: 50px;
    margin: 0;
  }

  .hp-form--listing-search .hr-ai-bar {
    position: relative;
    inset: auto;
    padding: 0;
    border-radius: 24px;
    max-height: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transform: none;
    transition:
      max-height 0.24s ease-out,
      opacity 0.20s ease-out;
  }

  /* Remove classic shell in AI mode to avoid the oversized empty wrapper. */
  .hp-form--listing-search.hr-ai-active {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  /* Collapse native search controls in AI mode to remove the oversized empty block. */
  .hp-form--listing-search.hr-ai-active .hp-form__field,
  .hp-form--listing-search.hr-ai-active .hp-form__footer {
    opacity: 0;
    filter: none;
    pointer-events: none;
    max-height: 0 !important;
    min-height: 0 !important;
    transform: none;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden;
  }

  .hp-form--listing-search.hr-ai-active .hp-form__fields {
    display: block;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-bar {
    max-height: 340px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    border-radius: 24px;
    background:
      radial-gradient(120% 120% at 10% 8%, rgba(148, 189, 255, 0.22) 0%, rgba(148, 189, 255, 0) 58%),
      radial-gradient(100% 100% at 88% 92%, rgba(111, 157, 255, 0.16) 0%, rgba(111, 157, 255, 0) 62%),
      linear-gradient(145deg, rgba(248, 251, 255, 0.98), rgba(239, 245, 255, 0.97));
    border: 1px solid rgba(179, 199, 234, 0.7);
    box-shadow:
      0 16px 36px rgba(40, 70, 128, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-bar__inner {
    padding: 0.78rem;
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-bar__inner::before {
    content: "Assistant voyage HomerentAI";
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.72rem;
    margin-bottom: 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #33518a;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(166, 188, 226, 0.58);
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    align-items: center;
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-input {
    grid-column: 1 / -1;
    min-height: 58px;
    border-radius: 17px;
    border: 1px solid rgba(166, 186, 222, 0.7);
    background: rgba(255, 255, 255, 0.78);
    padding: 0 1rem;
    font-size: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-submit.button-primary {
    grid-column: 1 / 2;
    width: 100%;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0;
    border-radius: 999px;
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-close {
    grid-column: 2 / 3;
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    flex: 0 0 48px !important;
    margin: 0;
    border-radius: 999px;
  }

  .hp-form--listing-search.hr-ai-active .hr-ai-close:hover,
  .hp-form--listing-search.hr-ai-active .hr-ai-close:focus-visible {
    transform: none;
  }
}
