/* ====================================================
   Brand Search Autocomplete – polished dropdown
   ==================================================== */

.ia-suggest-anchor {
  position: relative;
}

/* ---------- Mobile brand search bar (under header) ---------- */
.ia-mobile-search-bar {
  display: none;
  position: relative;
  /* Must sit above #wrapper (z-index:25) and below .main-header (31) */
  z-index: 30;
  width: 100%;
  padding: 10px 12px 14px;
  background: #f0f2f6;
  border-bottom: 1px solid #e8e8e8;
  box-sizing: border-box;
  overflow: visible;
}

.ia-mobile-search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: rtl;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  margin: 0;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  box-sizing: border-box;
  float: none;
  position: relative;
  z-index: 1;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.ia-mobile-search-icon {
  flex: 0 0 auto;
  color: #777;
  font-size: 15px;
  line-height: 1;
}

.ia-mobile-search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: #fff;
  color: #222;
  font-size: 14px;
  font-weight: 500;
  line-height: 44px;
  direction: rtl;
  float: none;
  -webkit-appearance: none;
  appearance: none;
}

.ia-mobile-search-input::placeholder {
  color: #999;
  font-weight: 400;
}

@media (max-width: 1023px) {
  .ia-mobile-search-bar {
    display: block;
  }

  /* Fixed header is out of flow — offset search so it sits under the header */
  #main.sticky-header .ia-mobile-search-bar {
    margin-top: 80px;
  }

  /* Search already clears the header; don't double the wrapper offset */
  #main.sticky-header.has-ia-mobile-search #wrapper {
    padding-top: 0 !important;
  }
}

@media (min-width: 1024px) {
  .ia-mobile-search-bar {
    display: none !important;
  }
}

/* ---------- Panel ---------- */
.ia-suggest-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 9999;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.02),
    0 12px 28px rgba(0, 0, 0, 0.10);
  overflow: hidden;
  direction: rtl;
  padding: 6px;

  opacity: 0;
  transform: translateY(-8px);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.ia-suggest-drop.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Align panel with the actual pill form (wrapper has 40px side padding) */
@media (min-width: 1024px) {
  .ia-header-search.ia-suggest-anchor .ia-suggest-drop {
    left: 40px;
    right: 40px;
    width: auto;
  }
}

/* ---------- Row ---------- */
.ia-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #1f2328;
  text-decoration: none !important;
  transition: background .14s ease, transform .14s ease;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
}

.ia-suggest-item:hover,
.ia-suggest-item:focus {
  background: #f7f4ec;
  outline: none;
}

.ia-suggest-item:active {
  background: #f1ecd8;
}

/* ---------- Primary CTA: خرید [keyword] ---------- */
.ia-suggest-item--top {
  background: linear-gradient(135deg, #f0c14a 0%, #efbc33 55%, #e5b02a 100%);
  color: #fff;
  font-weight: 700;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(239, 188, 51, 0.28);
}

.ia-suggest-item--top:hover,
.ia-suggest-item--top:focus {
  background: linear-gradient(135deg, #f3cb5c 0%, #f0c14a 55%, #efbc33 100%);
  color: #fff;
}

.ia-suggest-item--top .ia-suggest-title {
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ia-suggest-item--top .ia-suggest-sub {
  color: rgba(255, 255, 255, 0.82);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 2px;
}

.ia-suggest-item--top .ia-suggest-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.ia-suggest-item--top .ia-suggest-icon i {
  font-size: 14px;
  color: #fff;
}

.ia-suggest-item--top .ia-suggest-arrow {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- Brand avatar ---------- */
.ia-suggest-thumb,
.ia-suggest-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.ia-suggest-thumb {
  object-fit: cover;
  background: #f0f2f6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e8e8e8;
  opacity: 0;
  transition: opacity .2s ease;
}

.ia-suggest-thumb.loaded {
  opacity: 1;
}

.ia-suggest-thumb-placeholder {
  background: linear-gradient(145deg, #efbc33 0%, #f6d56f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(239, 188, 51, 0.25);
}

.ia-suggest-thumb-placeholder span {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

/* ---------- Text block ---------- */
.ia-suggest-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: right;
  overflow: hidden;
}

.ia-suggest-title {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: #1f2328;
  line-height: 1.35;
}

.ia-suggest-sub {
  display: block;
  width: 100%;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: #9aa0a6;
  line-height: 1.3;
}

/* Matched keyword: bold gold text, no blocky background */
.ia-suggest-text mark {
  background: transparent;
  color: #c99200;
  font-weight: 800;
  padding: 0;
  border-radius: 0;
}

/* ---------- Chevron ---------- */
.ia-suggest-arrow {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c5c9ce;
  font-size: 14px;
  transition: color .14s ease, transform .14s ease;
}

.ia-suggest-item:hover .ia-suggest-arrow,
.ia-suggest-item:focus .ia-suggest-arrow {
  color: #efbc33;
  transform: translateX(-2px);
}

/* ---------- Loading ---------- */
@keyframes ia-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.ia-suggest-item--loading {
  height: 52px;
  margin: 2px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f3f4f6 20%, #ebecef 50%, #f3f4f6 80%);
  background-size: 800px 100%;
  animation: ia-shimmer .9s infinite linear;
  pointer-events: none;
}

/* Mobile bar dropdown — float above page content */
.ia-mobile-search-bar .ia-suggest-drop {
  left: 12px;
  right: 12px;
  width: auto;
  z-index: 100;
}

/* When dropdown is portaled to body */
.ia-suggest-drop.ia-suggest-drop--portal {
  position: fixed;
  z-index: 10050;
  margin: 0;
}
