/* RTL Amazon-style product search autocomplete */
.btm-search {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  z-index: 1060;
}

@media (min-width: 992px) {
  .btm-header-toolbar > .btm-header-search {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    width: auto;
  }

  .btm-header-search .btm-search,
  .btm-header-search #searchCollapse {
    width: 100%;
    max-width: 100%;
  }

  /* Bootstrap .collapse hides without .show — always show search on desktop */
  #searchCollapse.collapse {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
  }
}

@media (max-width: 991.98px) {
  #searchCollapse.collapse:not(.show) {
    display: none;
  }
}

.btm-search__bar {
  display: flex;
  flex-direction: row-reverse;
  align-items: stretch;
  width: 100%;
  border: 1px solid #d5d9d9;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 17, 17, 0.08);
}

.btm-search__bar:focus-within {
  border-color: #850102;
  box-shadow: 0 0 0 3px rgba(133, 1, 2, 0.15);
}

.btm-search__input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 8rem;
  border: none;
  padding-block: 0.65rem;
  padding-inline-start: 1rem;
  padding-inline-end: 0.85rem;
  font-size: 0.9rem;
  direction: rtl;
  text-align: right;
  outline: none;
  box-sizing: border-box;
}

/* row-reverse puts submit on the right; keep typed text clear of the icon */
.btm-search[dir="rtl"] .btm-search__input {
  padding-inline-start: 1rem;
  padding-inline-end: 0.85rem;
}

@media (min-width: 992px) {
  .btm-search__input {
    padding-block: 0.7rem;
    padding-inline-start: 1.1rem;
    padding-inline-end: 0.95rem;
    font-size: 0.92rem;
  }
}

.btm-search__input::placeholder {
  color: #888;
}

.btm-search__submit,
a.btm-search__submit,
a.btm-search__submit:link,
a.btm-search__submit:visited,
a.btm-search__submit:hover,
a.btm-search__submit:focus,
a.btm-search__submit:active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.85rem;
  border: none;
  background: #850102;
  color: #fff !important;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btm-search__submit i,
.btm-search__submit i::before,
a.btm-search__submit i,
a.btm-search__submit i::before {
  color: #fff !important;
}

.btm-search__submit:hover,
a.btm-search__submit:hover {
  background: #6a0101;
  color: #fff !important;
}

.btm-search__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 100%;
  min-width: 100%;
  z-index: 1050;
  background: #fff;
  border: 1px solid #e3e6e6;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 17, 17, 0.12);
  max-height: min(70vh, 560px);
  overflow: hidden;
  direction: rtl;
  text-align: right;
}

@media (min-width: 992px) {
  .btm-search__panel {
    width: min(920px, calc(100vw - 2.5rem));
    min-width: max(100%, 36rem);
  }
}

.btm-search__panel.is-open {
  display: block;
}

/* Products left, category/brand sidebar right (RTL site) */
.btm-search__layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-height: inherit;
}

.btm-search__body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  direction: ltr;
}

.btm-search__main {
  flex: 1 1 320px;
  min-width: 0;
  order: 1;
  position: relative;
  z-index: 1;
  padding: 0.85rem 1.1rem;
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
}

.btm-search__aside {
  flex: 0 0 260px;
  order: 2;
  position: relative;
  z-index: 2;
  border-left: 1px solid #eef0f0;
  border-right: none;
  background: #fafafa;
  padding: 0.85rem 0.9rem;
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
}

.btm-search__section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f1111;
  margin: 0 0 0.55rem;
}

.btm-search__section-title::before {
  content: "";
  width: 3px;
  height: 1rem;
  background: #850102;
  border-radius: 2px;
}

.btm-search__section + .btm-search__section {
  margin-top: 1rem;
}

.btm-search__cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.btm-search__cat-list li {
  margin: 0;
  padding: 0;
  cursor: pointer;
  list-style: none;
}

.btm-search__cat-list li[data-cat-row] {
  display: block;
  width: 100%;
}

.btm-search__cat-list li[data-cat-row]:hover a,
.btm-search__cat-list li[data-cat-row]:focus-within a {
  background: #fff;
  color: #850102;
  box-shadow: inset 3px 0 0 #850102;
}

.btm-search__cat-list a {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  color: #007185;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.btm-search__cat-list a:hover,
.btm-search__cat-list a.is-preview-active {
  background: #fff;
  color: #850102;
  box-shadow: inset 3px 0 0 #850102;
}

.btm-search__brand {
  cursor: pointer;
}

.btm-search__brand.is-preview-active {
  border-color: #850102;
  box-shadow: 0 0 0 2px rgba(133, 1, 2, 0.2);
}

.btm-search__cat-count {
  color: #565959;
  font-size: 0.8rem;
}

.btm-search__brands {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.btm-search__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 44px;
  padding: 4px;
  border: 1px solid #e3e6e6;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.btm-search__brand:hover {
  border-color: #850102;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btm-search__brand img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.btm-search__brand-fallback {
  font-size: 0.65rem;
  color: #565959;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.btm-search__products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.btm-search__product {
  border-bottom: 1px solid #f0f2f2;
}

.btm-search__product:last-child {
  border-bottom: none;
}

.btm-search__product a {
  display: flex;
  flex-direction: row;
  direction: rtl;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0.25rem;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
}

.btm-search__product a:hover {
  background: #f7fafa;
}

.btm-search__thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border: 1px solid #e3e6e6;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.btm-search__main-hint {
  font-size: 0.75rem;
  color: #565959;
  margin: -0.25rem 0 0.5rem;
  min-height: 1.1em;
}

.btm-search__product-body {
  flex: 1;
  min-width: 0;
}

.btm-search__product-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f1111;
  line-height: 1.35;
  margin: 0 0 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btm-search__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.btm-search__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.btm-search__tag--brand {
  background: #e8f4ea;
  color: #067d62;
}

.btm-search__tag--brand img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.btm-search__tag--cat {
  background: #f3f3f3;
  color: #565959;
}

.btm-search__tag--views {
  background: #e7f4ff;
  color: #007185;
}

.btm-search__tag--rating {
  background: #fff8e7;
  color: #b98900;
}

.btm-search__footer {
  border-top: 1px solid #eef0f0;
  padding: 0.65rem 1rem;
  text-align: center;
  background: #fafafa;
}

.btm-search__more {
  color: #007185;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.btm-search__more:hover {
  color: #850102;
  text-decoration: underline;
}

.btm-search__empty,
.btm-search__loading {
  padding: 1.25rem;
  text-align: center;
  color: #565959;
  font-size: 0.9rem;
}

.btm-search__loading i {
  margin-left: 0.35rem;
}

@media (max-width: 991.98px) {
  .btm-search__body {
    flex-direction: column;
  }

  .btm-search__aside {
    flex: none;
    order: 2;
    border-left: none;
    border-bottom: 1px solid #eef0f0;
    max-height: 180px;
  }

  .btm-search__main {
    order: 1;
  }

  .btm-search__panel {
    max-height: min(80vh, 560px);
  }
}
