/* Shared AI Mode search chrome: home hero + AI results pages */
@property --ai-mode-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes aiModeAngleSpin {
  to { --ai-mode-angle: 360deg; }
}

.hero-ai-row.is-ai-mode,
.ai-box-row.is-ai-mode {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0;
  align-items: stretch;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(236, 72, 153, .10),
    0 0 18px rgba(239, 68, 68, .16),
    0 0 22px rgba(34, 197, 94, .12);
}

.hero-ai-row.is-ai-mode {
  display: grid;
  grid-template-columns: 1fr auto;
}

.hero-ai-row.is-ai-mode::before,
.ai-box-row.is-ai-mode::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  padding: 3px;
  background: conic-gradient(
    from var(--ai-mode-angle),
    #ef4444 0deg,
    #f97316 55deg,
    #eab308 110deg,
    #22c55e 175deg,
    #ec4899 250deg,
    #f43f5e 310deg,
    #ef4444 360deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: aiModeAngleSpin 1.05s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.hero-ai-row.is-ai-mode input,
.ai-box-row.is-ai-mode input {
  border: 0 !important;
  border-radius: 12px 0 0 12px !important;
  background: #fff !important;
  box-shadow: none !important;
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
}

.hero-ai-row button.is-ai-mode,
.ai-box-row button.is-ai-mode,
.ai-box-go.is-ai-mode {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-width: 4.85rem;
  height: 32px;
  margin: 3px 3px 3px 0;
  padding: 0 11px;
  border: 0 !important;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.1;
  color: #fff !important;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 55%, #7c3aed 100%) !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .22);
}

.hero-ai-row button.is-ai-mode::before,
.hero-ai-row button.is-ai-mode::after,
.ai-box-go.is-ai-mode::before,
.ai-box-go.is-ai-mode::after {
  content: none !important;
  display: none !important;
}

/* Results page card: keep outer shell calm when inner row is in AI Mode */
.listing-top-search-row .ai-box:has(.ai-box-row.is-ai-mode),
form.ai-box:has(.ai-box-row.is-ai-mode) {
  background: #fff;
  border-color: transparent;
  box-shadow: none;
}

@media (max-width: 991px) {
  .home-shell--mobile-ai .hero-ai-row--mobile.is-ai-mode {
    overflow: visible;
    background: #fff;
    box-shadow:
      0 0 0 1px rgba(236, 72, 153, .12),
      0 0 20px rgba(239, 68, 68, .18),
      0 0 24px rgba(34, 197, 94, .12);
  }

  .home-shell--mobile-ai .hero-ai-row--mobile.is-ai-mode::before {
    inset: -3px;
    border-radius: 16px;
    padding: 3px;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile.is-ai-mode input {
    height: 52px;
    border-radius: 14px 0 0 14px !important;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile button.is-ai-mode {
    height: 40px;
    min-width: 5rem;
    margin: 6px 6px 6px 0;
    padding: 0 12px;
    border-radius: 10px;
    font-size: .82rem;
  }

  .ai-box-row.is-ai-mode {
    min-height: 48px;
  }

  .ai-box-row.is-ai-mode input {
    min-height: 48px;
    padding-left: 12px;
    padding-right: 10px;
  }

  .ai-box-go.is-ai-mode {
    height: 40px;
    margin: 4px 4px 4px 0;
    font-size: .82rem;
  }
}
