/* Header search — Pooster / Artwala pill field + suggestions panel */

.header-search {
  --hs-brand: var(--brand-primary, #C51605);
  --hs-brand-hover: var(--brand-primary-hover, #A01204);
  --hs-brand-soft: var(--brand-primary-light, #fdeceb);
  --hs-brand-rgb: var(--brand-primary-rgb, 197, 22, 5);
  --hs-ink: var(--pooster-ink, #03000c);
  --hs-muted: var(--pooster-muted, #5c5c5c);
  --hs-line: var(--pooster-line, #e8e6df);
  --hs-surface: var(--pooster-sand, #f3f0e6);
  --hs-hover: #f3f4f6;

  position: relative;
  flex: 1 1 220px;
  max-width: none;
  min-width: 160px;
  margin-inline: 8px;
  z-index: 1205;
}

.header-search--mobile {
  display: none;
  flex: none;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 12px 12px;
  z-index: 1005;
}

.header-search__form {
  position: relative;
  margin: 0;
}

.header-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding-block: 4px;
  padding-inline-start: 4px;
  padding-inline-end: 16px;
  background: var(--hs-surface);
  border: 1px solid transparent;
  border-radius: 999px;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.header-search.is-open .header-search__field,
.header-search__field:focus-within {
  background: #fff;
  border-color: rgba(var(--hs-brand-rgb), 0.35);
  box-shadow:
    0 0 0 3px rgba(var(--hs-brand-rgb), 0.12),
    0 8px 24px rgba(3, 0, 12, 0.05);
}

.header-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--hs-brand);
  color: #fff;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.header-search__submit:hover {
  background: var(--hs-brand-hover);
}

.header-search__submit:active {
  transform: scale(0.96);
}

.header-search__icon {
  display: block;
}

.header-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--hs-ink);
  font-size: 14px;
  line-height: 1.4;
}

.header-search__input::placeholder {
  color: #8a8a8a;
}

.header-search__input::-webkit-search-decoration,
.header-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.header-search__panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--hs-line);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(3, 0, 12, 0.1);
  z-index: 1210;
  animation: header-search-panel-in 0.18s ease;
}

@keyframes header-search-panel-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-search__panel[hidden] {
  display: none !important;
}

.header-search__hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--hs-line);
  color: var(--hs-muted);
  font-size: 13px;
}

.header-search__hint-icon {
  display: inline-flex;
  color: #8a8a8a;
}

.header-search__hint-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.header-search__hint-text strong {
  color: var(--hs-ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.header-search__section-title {
  margin-bottom: 12px;
  color: var(--hs-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.header-search__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.header-search__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 14px;
  border: 1px solid var(--hs-line);
  border-radius: 999px;
  background: #fff;
  color: var(--hs-muted);
  font-size: 12px;
  line-height: 1.3;
  text-decoration: none !important;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.header-search__chip:hover {
  border-color: var(--hs-ink);
  color: var(--hs-ink);
  background: var(--hs-brand-soft);
}

.header-search__results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 4px;
}

.header-search__results[hidden],
.header-search__popular[hidden] {
  display: none !important;
}

.header-search__result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--hs-ink);
  text-decoration: none !important;
  transition: background-color 0.15s ease;
}

.header-search__result:hover,
.header-search__result:focus-visible {
  background: var(--hs-hover);
}

.header-search__result-img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  background: var(--hs-surface);
}

.header-search__result-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-search__empty {
  padding: 8px 4px 12px;
  color: #8a8a8a;
  font-size: 13px;
}

/* Desktop layout: search sits in the primary header row */
.header-desktop__primary .header-search {
  flex: 1 1 auto;
  max-width: none;
}

.header-desktop__nav .menu-desktop {
  flex: 0 1 auto;
  min-width: 0;
}

.header-desktop__primary .wrap-icon-header {
  margin-inline-start: auto;
  flex-shrink: 0;
}

.header-desktop__primary .logo {
  margin-right: 0;
  margin-inline-end: 12px;
  flex-shrink: 0;
}

@media (max-width: 1199.98px) {
  .header-desktop__primary .header-search {
    min-width: 140px;
  }
}

@media (max-width: 991.98px) {
  .header-search--desktop {
    display: none !important;
  }

  .header-search--mobile {
    display: block;
  }

  .wrap-header-mobile-search {
    display: block;
    background: #fff;
    border-bottom: 1px solid #ececec;
  }

  .header-search--mobile .header-search__field {
    height: 44px;
    padding-inline-end: 14px;
  }

  .header-search--mobile .header-search__submit {
    width: 36px;
    height: 36px;
  }
}

@media (min-width: 992px) {
  .wrap-header-mobile-search {
    display: none !important;
  }
}

[dir="rtl"] .header-search__input,
[dir="rtl"] .header-search__input::placeholder,
[dir="rtl"] .header-search__section-title,
[dir="rtl"] .header-search__hint,
[dir="rtl"] .header-search__chip,
[dir="rtl"] .header-search__result-name {
  font-family: var(--app-font-rtl) !important;
}
