:root {
  --bss-accent: #ED6A20;
  --bss-navy: #0b2d5c;
  --bss-text: #253446;
  --bss-muted: #8a96a5;
  --bss-line: #eceff3;
  --bss-soft: #f4f5f6;
}

html.bargchi-search-open,
body.bargchi-search-open {
  overflow: hidden;
}

.bargchi-smart-search {
  position: fixed;
  inset: 0;
  z-index: 999999;
  direction: rtl;
  visibility: hidden;
  opacity: 0;
  transition: opacity .13s ease, visibility 0s linear .13s;
}

.bargchi-smart-search.is-open,
.bargchi-smart-search.is-closing {
  visibility: visible;
  transition-delay: 0s;
}

.bargchi-smart-search.is-open {
  opacity: 1;
}

.bargchi-smart-search.is-closing {
  opacity: 0;
  pointer-events: none;
}

.bargchi-smart-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.30);
}

.bargchi-smart-search__panel {
  --bss-panel-top: 100px;
  --bss-panel-left: calc(50vw - 260px);
  --bss-panel-width: 520px;
  position: fixed;
  top: var(--bss-panel-top);
  left: var(--bss-panel-left);
  width: var(--bss-panel-width);
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  transform: none !important;
  transition: none !important;
}

/* The panel never translates/scales on open or close. The whole overlay only fades. */
.bargchi-smart-search.is-open .bargchi-smart-search__panel,
.bargchi-smart-search.is-closing .bargchi-smart-search__panel {
  transform: none !important;
}

.bargchi-smart-search__top {
  position: relative;
  padding: 0;
}

.bargchi-smart-search__search-mount {
  min-height: var(--bss-search-height, 42px);
}

/* The exact header search form is temporarily moved into the panel.
   Its computed pre-focus visual style is preserved by JavaScript. */
.bargchi-smart-search .bargchi-search-source-form {
  margin: 0 !important;
  transform: none !important;
}

.bargchi-smart-search__close {
  position: absolute !important;
  left: 18px !important;
  right: auto !important;
  top: calc(var(--bss-search-height, 42px) / 2 - 13px) !important;
  z-index: 4;
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: #aab2bc !important;
  font-size: 23px !important;
  line-height: 23px !important;
  font-weight: 300 !important;
  cursor: pointer;
  box-shadow: none !important;
}

.bargchi-smart-search__close:hover {
  color: var(--bss-navy) !important;
  background: transparent !important;
}

.bargchi-smart-search__body {
  margin-top: 6px;
  padding: 0 16px 16px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(16, 30, 47, .14);
  overflow: hidden;
}

.bargchi-smart-search__state {
  padding-top: 14px;
}

.bargchi-smart-search__state.is-hidden,
.bargchi-smart-search .is-hidden {
  display: none !important;
}

.bargchi-smart-search__section + .bargchi-smart-search__section {
  margin-top: 17px;
}

.bargchi-smart-search__section-head,
.bargchi-smart-search__results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.bargchi-smart-search__section-head h3,
.bargchi-smart-search__results-head h3 {
  margin: 0;
  color: var(--bss-text);
  font-size: 15px;
  font-weight: 750;
}

.bargchi-smart-search__clear-recent,
.bargchi-smart-search__view-all {
  border: 0 !important;
  background: transparent !important;
  color: #8e99a8 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 0 !important;
  text-decoration: none !important;
  cursor: pointer;
}

.bargchi-smart-search__clear-recent:hover,
.bargchi-smart-search__view-all:hover {
  color: var(--bss-accent) !important;
}

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

.bargchi-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-height: 33px !important;
  padding: 0 12px !important;
  border: 1px solid #dfe3e8 !important;
  border-radius: 999px !important;
  background: #fff !important;
  box-shadow: none !important;
  color: #4d5a69 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}

.bargchi-chip svg {
  color: #818c99;
  flex: 0 0 auto;
}

.bargchi-chip--popular .bargchi-trending-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  display: block;
  color: rgba(11, 45, 92, .72) !important;
  overflow: visible;
}

.bargchi-chip--popular:hover .bargchi-trending-icon {
  color: var(--bss-accent) !important;
}

.bargchi-chip:hover {
  border-color: #c8ced6 !important;
  color: var(--bss-navy) !important;
  background: #fafafa !important;
}

.bargchi-smart-search__banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 188px;
  margin-top: 19px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none !important;
  background: #0b2d5c;
  color: #fff !important;
}

.bargchi-smart-search__banner.has-image {
  background: #f4f5f7;
}

.bargchi-smart-search__banner img {
  width: 100%;
  height: 188px;
  display: block;
  object-fit: cover;
}

.bargchi-smart-search__banner-copy {
  display: grid;
  gap: 7px;
  padding: 24px;
}

.bargchi-smart-search__banner-copy strong {
  font-size: 19px;
  color: #fff;
}

.bargchi-smart-search__banner-copy small {
  font-size: 12px;
  color: rgba(255,255,255,.72);
}

.bargchi-smart-search__banner-action {
  margin-left: 24px;
  padding: 7px 20px;
  border-radius: 999px;
  background: #fff;
  color: var(--bss-navy);
  font-size: 12px;
  font-weight: 700;
}

/* -------------------------------------------------------------------------
   Typing state: suggestion list, intentionally no product cards/images/prices.
   ------------------------------------------------------------------------- */
.bargchi-smart-search.has-query .bargchi-smart-search__body {
  padding: 0 16px 8px;
}

.bargchi-smart-search.has-query .bargchi-smart-search__state--results {
  padding-top: 5px;
}

.bargchi-smart-search.has-query .bargchi-smart-search__results-head {
  display: none;
}

.bargchi-smart-search__results-scroll {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d3d8df transparent;
  padding-left: 3px;
}

.bargchi-smart-search__results-scroll::-webkit-scrollbar {
  width: 5px;
}

.bargchi-smart-search__results-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.bargchi-smart-search__results-scroll::-webkit-scrollbar-thumb {
  background: #d1d6dc;
  border-radius: 999px;
}

.bargchi-smart-search__products {
  display: block;
}

.bargchi-suggestion {
  display: grid;
  grid-template-columns: 28px minmax(120px, 170px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 47px;
  padding: 0 4px;
  border: 0 !important;
  border-bottom: 1px solid var(--bss-line) !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  color: var(--bss-text) !important;
  text-decoration: none !important;
  transition: background .12s ease;
}

.bargchi-suggestion:last-child {
  border-bottom: 0 !important;
}

.bargchi-suggestion:hover {
  background: #fafafa !important;
  color: var(--bss-text) !important;
}

.bargchi-suggestion__icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c6570;
}

.bargchi-suggestion__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #3b434c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.bargchi-suggestion__context {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bss-accent);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.bargchi-suggestion--query {
  grid-template-columns: 28px minmax(0, 1fr);
}

.bargchi-suggestion--query .bargchi-suggestion__title {
  font-size: 13px;
  font-weight: 500;
}

.bargchi-suggestion--product .bargchi-suggestion__title {
  font-weight: 600;
}

.bargchi-suggestion--all {
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 52px;
}

.bargchi-suggestion--all .bargchi-suggestion__title {
  color: var(--bss-accent);
  font-weight: 650;
}

.bargchi-search-loading {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.bargchi-search-loading span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #bfc6ce;
  animation: bss-dot 1s infinite ease-in-out;
}

.bargchi-search-loading span:nth-child(2) { animation-delay: .12s; }
.bargchi-search-loading span:nth-child(3) { animation-delay: .24s; }

@keyframes bss-dot {
  0%,80%,100% { transform: scale(.7); opacity: .45; }
  40% { transform: scale(1); opacity: 1; }
}

.bargchi-search-empty {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  color: var(--bss-muted);
}

.bargchi-search-empty strong {
  color: var(--bss-text);
  font-size: 13px;
}

.bargchi-search-empty span {
  font-size: 12px;
}

@media (max-width: 767px) {
  .bargchi-smart-search__panel {
    position: fixed;
    top: var(--bss-panel-top) !important;
    left: var(--bss-panel-left) !important;
    right: auto !important;
    width: var(--bss-panel-width) !important;
    max-height: calc(100vh - 16px);
    margin: 0;
  }

  .bargchi-smart-search__top {
    padding: 0;
  }

  .bargchi-smart-search__body {
    padding: 0 12px 12px;
  }

  .bargchi-smart-search__banner,
  .bargchi-smart-search__banner img {
    min-height: 132px;
    height: 132px;
  }

  .bargchi-smart-search__results-scroll {
    max-height: calc(100vh - 82px);
  }

  .bargchi-suggestion {
    grid-template-columns: 28px minmax(105px, 145px) minmax(0, 1fr);
    min-height: 50px;
    gap: 7px;
  }

  .bargchi-suggestion__title {
    font-size: 12.5px;
  }

  .bargchi-suggestion__context {
    font-size: 11.5px;
  }
}

/* ========================================================================
   V5 relevance + icon polish
   ======================================================================== */

/* Popular searches use a real trending-search symbol, not a generic arrow. */
.bargchi-chip--popular svg,
.bargchi-chip--recent svg {
  flex: 0 0 auto;
  color: #7d8896;
}

.bargchi-chip--popular:hover svg,
.bargchi-chip--recent:hover svg {
  color: var(--bss-accent);
}

/* Search suggestions: icon at the RTL start, title next to it, orange context
   anchored completely to the visual left edge like the reference UI. */
.bargchi-suggestion {
  grid-template-columns: 28px minmax(155px, 1fr) minmax(145px, .9fr);
}

.bargchi-suggestion__icon svg {
  display: block;
}

.bargchi-suggestion__context {
  justify-self: stretch;
  width: 100%;
  text-align: left !important;
  direction: rtl;
  unicode-bidi: plaintext;
  padding-left: 2px;
}

.bargchi-suggestion--category .bargchi-suggestion__icon {
  color: #66717f;
}

.bargchi-suggestion--product .bargchi-suggestion__icon {
  color: #66717f;
}

.bargchi-suggestion--query .bargchi-suggestion__icon {
  color: #65717f;
}

.bargchi-suggestion--all .bargchi-suggestion__icon,
.bargchi-suggestion--all .bargchi-suggestion__title {
  color: var(--bss-accent);
}

@media (max-width: 767px) {
  .bargchi-suggestion {
    grid-template-columns: 27px minmax(110px, 1fr) minmax(105px, .86fr);
  }

  .bargchi-suggestion__context {
    padding-left: 0;
  }
}


/* V7 minimal cleanup */
.bargchi-smart-search__results-head,
.bargchi-smart-search__view-all {
  display: none !important;
}

.bargchi-smart-search.has-query .bargchi-smart-search__state--results {
  padding-top: 0;
}

.bargchi-smart-search.has-query .bargchi-smart-search__body {
  padding-top: 0;
}

.bargchi-suggestion__context {
  color: var(--bss-accent);
  font-weight: 500;
}

/* ========================================================================
   V8 — Digikala-style suggestion semantics
   Autocomplete rows are ONLY search phrases or category destinations.
   No product rows are rendered in the dropdown.
   ======================================================================== */

.bargchi-suggestion--product {
  display: none !important;
}

.bargchi-suggestion--search,
.bargchi-suggestion--query {
  grid-template-columns: 28px minmax(0, 1fr) !important;
}

.bargchi-suggestion--search .bargchi-suggestion__context,
.bargchi-suggestion--query .bargchi-suggestion__context {
  display: none !important;
}

.bargchi-suggestion--category {
  grid-template-columns: 28px minmax(155px, 1fr) minmax(145px, .9fr) !important;
}

.bargchi-suggestion--category .bargchi-suggestion__title {
  font-weight: 600;
  color: #3b434c;
}

.bargchi-suggestion--category .bargchi-suggestion__context {
  justify-self: stretch;
  width: 100%;
  text-align: left !important;
  direction: rtl;
  unicode-bidi: plaintext;
  color: var(--bss-accent);
  font-size: 12px;
  font-weight: 500;
  padding-left: 2px;
}

.bargchi-suggestion--search .bargchi-suggestion__icon,
.bargchi-suggestion--query .bargchi-suggestion__icon {
  color: #5d6874;
}

.bargchi-suggestion--category .bargchi-suggestion__icon {
  color: #5d6874;
}

.bargchi-suggestion--search:hover .bargchi-suggestion__icon,
.bargchi-suggestion--query:hover .bargchi-suggestion__icon,
.bargchi-suggestion--category:hover .bargchi-suggestion__icon {
  color: var(--bss-navy);
}

@media (max-width: 767px) {
  .bargchi-suggestion--category {
    grid-template-columns: 27px minmax(110px, 1fr) minmax(105px, .86fr) !important;
  }

  .bargchi-suggestion--search,
  .bargchi-suggestion--query {
    grid-template-columns: 27px minmax(0, 1fr) !important;
  }
}
