/* Header search — Digikala-style input + dropdown */

.header-search {
  position: relative;
  flex: 1 1 320px;
  max-width: 640px;
  min-width: 200px;
  margin-inline: 16px;
  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: 8px;
  height: 44px;
  padding: 0 14px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  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: #d1d5db;
  box-shadow: 0 0 0 3px rgba(103, 67, 131, 0.08);
}

.header-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.header-search__submit:hover {
  color: #674383;
}

.header-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #111827;
  font-size: 13px;
  line-height: 1.4;
}

.header-search__input::placeholder {
  color: #9ca3af;
}

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

.header-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  z-index: 1210;
}

.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 #e8edf3;
  color: #6b7280;
  font-size: 13px;
}

.header-search__hint-icon {
  display: inline-flex;
  color: #9ca3af;
}

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

.header-search__hint-text strong {
  color: #111827;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.header-search__section-title {
  margin-bottom: 12px;
  color: #111827;
  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 #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  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: #674383;
  color: #674383;
  background: #f5f0f8;
}

.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: 10px;
  color: #111827;
  text-decoration: none !important;
  transition: background-color 0.15s ease;
}

.header-search__result:hover {
  background: #f9fafb;
}

.header-search__result-img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
}

.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: #9ca3af;
  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: 1 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;
  }
}

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

[dir="rtl"] .header-search__input,
[dir="rtl"] .header-search__section-title,
[dir="rtl"] .header-search__hint,
[dir="rtl"] .header-search__chip,
[dir="rtl"] .header-search__result-name {
  font-family: "Vazirmatn", Arial, sans-serif;
}
