/*****************************
M3yar — Live header search
*****************************/

.header-search__content,
.m3-mnav__search {
  position: relative;
}

.m3-live-search {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  z-index: 10080;
  background: #fff;
  border: 1px solid rgba(74, 44, 42, 0.1);
  border-radius: 16px;
  box-shadow:
    0 18px 48px rgba(44, 24, 16, 0.14),
    0 2px 0 rgba(255, 255, 255, 0.8) inset;
  overflow: hidden;
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  text-align: start;
}

.m3-live-search[hidden] {
  display: none !important;
}

.m3-live-search--drawer {
  top: calc(100% + 6px);
  z-index: 30;
  max-height: min(52vh, 420px);
}

.m3-live-search__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2C1810 0%, #4A2C2A 100%);
  color: #F5F0EB;
}

.m3-live-search__head-label {
  font-family: "Cairo", sans-serif;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}

.m3-live-search__head-meta {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(196, 165, 116, 0.22);
  color: #E8D5B5;
}

.m3-live-search__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.m3-live-search__section {
  padding: 10px 8px 6px;
}

.m3-live-search__section + .m3-live-search__section {
  border-top: 1px solid rgba(74, 44, 42, 0.08);
}

.m3-live-search__section-title {
  margin: 0 8px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(44, 24, 16, 0.55);
  text-transform: uppercase;
}

.m3-live-search__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.m3-live-search__item {
  margin: 0;
}

.m3-live-search__link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.18s ease;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: start;
}

.m3-live-search__link:hover,
.m3-live-search__link.is-active,
.m3-live-search__link:focus-visible {
  background: #F5F0EB;
  outline: none;
}

.m3-live-search__thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: #F5F0EB;
  border: 1px solid rgba(74, 44, 42, 0.08);
}

.m3-live-search__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m3-live-search__thumb--cat {
  display: grid;
  place-items: center;
  color: #8B5A2B;
  font-size: 18px;
  background: linear-gradient(145deg, #F5F0EB, #ebe2d8);
}

.m3-live-search__copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.m3-live-search__name {
  font-family: "Cairo", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: #2C1810;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m3-live-search__name mark {
  background: rgba(196, 165, 116, 0.35);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.m3-live-search__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 11.5px;
  color: rgba(44, 24, 16, 0.58);
}

.m3-live-search__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  direction: ltr;
  unicode-bidi: isolate;
}

.m3-live-search__stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.m3-live-search__stock.is-in {
  color: #2f6b4f;
}

.m3-live-search__stock.is-out {
  color: #9b3b3b;
}

.m3-live-search__stock i {
  font-size: 6px;
}

.m3-live-search__side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.m3-live-search__price {
  font-family: "Cairo", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #7a3333;
  white-space: nowrap;
}

.m3-live-search__price small {
  font-size: 11px;
  font-weight: 700;
  margin-inline-start: 2px;
}

.m3-live-search__was {
  font-size: 11px;
  color: rgba(44, 24, 16, 0.45);
  text-decoration: line-through;
}

.m3-live-search__badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(196, 165, 116, 0.2);
  color: #5c3d1e;
}

.m3-live-search__count {
  font-size: 11px;
  font-weight: 800;
  color: #7a3333;
  background: rgba(122, 51, 51, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
}

.m3-live-search__foot {
  border-top: 1px solid rgba(74, 44, 42, 0.08);
  padding: 10px;
  background: #faf7f4;
}

.m3-live-search__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  background: linear-gradient(135deg, #4A2C2A 0%, #2C1810 100%);
  color: #F5F0EB;
  font-family: "Cairo", sans-serif;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.m3-live-search__all:hover,
.m3-live-search__all.is-active {
  color: #fff;
  box-shadow: 0 8px 20px rgba(44, 24, 16, 0.22);
  transform: translateY(-1px);
}

.m3-live-search__all-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(196, 165, 116, 0.25);
  color: #E8D5B5;
}

.m3-live-search__empty,
.m3-live-search__loading,
.m3-live-search__error {
  padding: 28px 20px;
  text-align: center;
}

.m3-live-search__empty-icon,
.m3-live-search__error-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #F5F0EB;
  color: #8B5A2B;
  font-size: 18px;
}

.m3-live-search__empty strong,
.m3-live-search__error strong {
  display: block;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #2C1810;
  margin-bottom: 4px;
}

.m3-live-search__empty p,
.m3-live-search__error p {
  margin: 0;
  font-size: 12.5px;
  color: rgba(44, 24, 16, 0.58);
  line-height: 1.5;
}

.m3-live-search__spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 2.5px solid rgba(74, 44, 42, 0.12);
  border-top-color: #8B5A2B;
  border-radius: 50%;
  animation: m3-live-spin 0.7s linear infinite;
}

.m3-live-search__loading p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(44, 24, 16, 0.65);
}

.m3-live-search__skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 16px;
}

.m3-live-search__skel-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.m3-live-search__skel-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0ebe6 25%, #f7f3ef 50%, #f0ebe6 75%);
  background-size: 200% 100%;
  animation: m3-live-shimmer 1.1s ease infinite;
}

.m3-live-search__skel-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m3-live-search__skel-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0ebe6 25%, #f7f3ef 50%, #f0ebe6 75%);
  background-size: 200% 100%;
  animation: m3-live-shimmer 1.1s ease infinite;
}

.m3-live-search__skel-line--sm {
  width: 42%;
  height: 8px;
}

@keyframes m3-live-spin {
  to { transform: rotate(360deg); }
}

@keyframes m3-live-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.header-search.is-searching .header-search__content button i,
.m3-mnav__search.is-searching > i {
  opacity: 0.35;
}

.header-search.is-open .header-search__content input,
.m3-mnav__search.is-open input {
  border-color: rgba(139, 90, 43, 0.35);
  box-shadow: 0 0 0 3px rgba(196, 165, 116, 0.18);
}

@media (max-width: 991px) {
  .m3-mobile-search-row .m3-live-search {
    z-index: 1010;
    max-height: min(62vh, 460px);
  }
}
