.live-search {
  font-family: var(--main-font);
  width: 390px;
  position: absolute;
  top: 100%;
  margin-top: 15px;
  background-color: #fff;
  overflow: hidden;
  left: 0;
  z-index: 10;
  display: none;
}

.mobile .live-search {
  /* position:absolute (не fixed) відносно #search (position:relative) —
     top:100% від base-правила вище сам собою ставить список РІВНО під
     #search, без жодних розрахунків у JS. Раніше тут був position:fixed
     з top, який JS рахував вручну (getBoundingClientRect) — і той
     розрахунок раз у раз не збігався зі справжньою нижньою межею блоку
     пошуку, залишаючи видимий проміжок. */
  left: 0;
  right: 0;
  width: auto;
  max-width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  /* Поки пошук відкрито, html.lock ставить body { touch-action: none },
     щоб заблокувати скрол сторінки під панеллю (main.css). Без явного
     touch-action тут це блокує й свайп усередині самого списку на
     Android (в Safari/iOS цього не помітно, бо там спрацьовує момент
     touch-scrolling, але Android послідовно ігнорує nested-скрол, поки
     є touch-action:none у предка) — тож дозволяємо саме вертикальний пан. */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  margin-top: 0;
}

.live-search .search-loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 10px;
}

/* Замість animated GIF: у Safari/iOS повторне вставлення того самого
   закешованого <img src="loading.gif"> через .html() раз у раз не
   перезапускає анімацію (WebKit показує статичний останній кадр) — тому
   спінер робимо чистим CSS (border + rotate), який завжди анімований
   однаково в усіх браузерах і має фіксований розмір без "стрибка" верстки. */
.live-search .search-loading {
  width: 22px;
  height: 22px;
  border: 3px solid #e7e7e7;
  border-top-color: #1e1e1e;
  border-radius: 50%;
  animation: live-search-spin 0.7s linear infinite;
}

@keyframes live-search-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-search .search-loading {
    animation: none;
  }
}

.live-search ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.live-search ul li {
  display: flex;
  cursor: pointer;
  padding: 10px;
  background-color: #fff;
  transition: 0.2s;
}

.live-search ul li:not(:last-child) {
  border-bottom: none;
  background-image: linear-gradient(#e7e7e7, #e7e7e7);
  background-size: calc(100% - 20px) 1px;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.live-search ul li:hover {
  background-color: #f5f5f5;
}

.live-search ul li > div {
  flex: 1;
  min-width: 0;
}

.live-search ul li a {
  display: flex;
  align-items: center;
  text-decoration: none;
  width: 100%;
}

.live-search ul li .product-image {
  width: 80px;
  flex-shrink: 0;
  margin-right: 20px;
}

.live-search ul li .product-image img {
  width: 100%;
  height: auto;
  display: block;
}

.live-search ul li .product-name {
  flex: 1;
  min-width: 0;
  color: #0f0f0f;
  font-family: var(--main-font);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.4;
}

.live-search ul li .product-name p {
  font-weight: normal;
  font-size: 10px;
  color: #555;
  margin: 0;
  padding: 0;
}

.live-search ul li .product-add-cart {
  flex-shrink: 0;
  padding: 7px;
}

.live-search ul li .product-price {
  flex-shrink: 0;
  text-align: right;
  margin-left: 10px;
  white-space: nowrap;
}

.live-search ul li .product-price .price {
  display: block;
  color: #0f0f0f;
  font-family: var(--main-font);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
}

.live-search ul li .product-price .price:has(+ .special) {
  color: #a31022;
}

.live-search ul li .product-price .special {
  display: block;
  color: #696969;
  font-family: var(--main-font);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.5;
  text-decoration: line-through;
}

.live-search .result-text {
  width: 100%;
}

.live-search .result-text:empty {
  display: none;
}

.live-search .result-text a {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 40px;
  width: 100%;
  margin: 10px;
  width: calc(100% - 20px);
  border-radius: 0;
  padding: 0 32px;
  background: #121212;
  font-family: var(--main-font);
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  transition: 0.2s;
}

.live-search .result-text a:hover {
  background: #000;
}
