/* MON-250: the live search block under the header search field (markup: common/search.twig and the
   extension/module/molfar_live_search_*.twig templates; behaviour: catalog/view/javascript/molfar_live_search.js). */
.mls-form {
  --mls-text: var(--osnovniy-tekst, #363636);
  --mls-muted: var(--dodatkoviy-tekst, #838383);
  --mls-accent: var(--accent-1, #fa8072);
  --mls-side: var(--fon-sekcіy-kartok, #fafaf9);
  --mls-pill: var(--fon-kartok, #f0f0f0);
  --mls-line: #ececec;
  --mls-contour: var(--kontur-polіv-formi, #a0a0a0);
}
.mls[hidden], .mls-state[hidden], .mls [hidden] { display: none !important; }
.mls-back { display: none; }
.mls-form .header-search__input { padding-right: 36px; }
.mls-form:not(.mls-has-value) .header-search__close { display: none; }
.mls-form.mls-has-value .header-search__close { display: flex; }

.mls {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 1001;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
  color: var(--mls-text);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.2);
}
.mls ul { margin: 0; padding: 0; list-style: none; }
.mls button { font-family: inherit; color: inherit; }
.mls a { color: inherit; text-decoration: none; }
.mls b { font-weight: 700; }
.mls-dim {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.mls-dim.is-active { opacity: 1; visibility: visible; }

.mls-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mls-muted);
}
.mls-group + .mls-group { margin-top: 18px; }
.mls-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mls-note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--mls-muted); }
.mls-link {
  display: inline;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 600 !important;
  color: var(--mls-accent) !important;
  text-decoration: underline;
}
.mls-link--small { font-size: 12px; font-weight: 400 !important; color: var(--mls-muted) !important; }

/* Results: hints and categories on the left, products on the right, the button below. */
.mls-results { display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.mls-results--single { grid-template-columns: minmax(0, 1fr); }
.mls-side { padding: 16px 12px; border-right: 1px solid var(--mls-line); background: var(--mls-side); }
.mls-side .mls-title { padding: 0 8px; }
.mls-hint, .mls-category {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
}
.mls-hint__icon { flex: none; margin-top: 2px; color: var(--mls-muted); }
.mls-category { align-items: center; justify-content: space-between; }
.mls-category svg { flex: none; color: var(--mls-contour); }
.mls-hint:hover, .mls-hint:focus-visible, .mls-category:hover, .mls-category:focus-visible { background: #fff; outline: none; box-shadow: 0 0 0 1px var(--mls-line); }
.mls-main { min-width: 0; padding: 16px 16px 6px; }
.mls-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--mls-line);
}
.mls-product:last-child { border-bottom: 0; }
.mls-product__link { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mls-product__image { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--mls-pill); }
.mls-product__info { min-width: 0; }
.mls-product__name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mls-product__link:hover .mls-product__name { text-decoration: underline; }
.mls-product__packaging { display: block; margin-top: 3px; font-size: 11px; line-height: 1.2; color: var(--mls-muted); }
.mls-product__price { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.mls-product__new { font-size: 14px; font-weight: 700; color: var(--mls-accent); }
.mls-product__old { font-size: 11px; color: var(--mls-muted); }
.mls-product__cart {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--mls-accent);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: var(--mls-accent) !important;
  transition: background 0.2s, color 0.2s;
}
.mls-product__cart:hover, .mls-product__cart:focus-visible { background: var(--mls-accent); color: #fff !important; outline: none; }
.mls-footer {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--mls-line);
  background: #fff;
}
.mls-all {
  padding: 11px 18px;
  border: 1px solid var(--mls-accent);
  border-radius: 6px;
  background: var(--mls-accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff !important;
  transition: background 0.2s, color 0.2s;
}
.mls-all:hover, .mls-all:focus-visible { background: transparent; color: var(--mls-text) !important; border-color: var(--mls-text); outline: none; }

/* The empty field and «nothing found». */
.mls-empty, .mls-none { padding: 18px 20px 20px; }
.mls-none__text { margin: 0 0 6px; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.mls-none__correction { margin: 0; font-size: 13px; }
.mls-none .mls-group--popular-categories { margin-top: 18px; }
.mls-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mls-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--mls-pill);
  border-radius: 999px;
  background: var(--mls-pill);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.mls-pill svg { flex: none; color: var(--mls-muted); }
.mls-pill--popular { border-color: #e0e0e0; background: #fff; }
.mls-pill--popular svg { color: var(--mls-accent); }
.mls-pill:hover, .mls-pill:focus-visible { border-color: var(--mls-contour); outline: none; }
.mls-empty > .mls-group[hidden] + .mls-group { margin-top: 0; }
.mls-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mls-tile { display: block; height: 100%; padding: 6px; border-radius: 8px; background: var(--mls-side); box-shadow: inset 0 0 0 1px var(--mls-line); }
.mls-tile img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 6px; }
.mls-tile span { display: block; padding: 8px 4px 4px; font-size: 12px; font-weight: 600; line-height: 1.3; }
.mls-tile:hover span { text-decoration: underline; }

/* Loading: grey placeholders in the shape of the results. */
.mls-skeleton { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 260px; }
.mls-skeleton__side { display: flex; flex-direction: column; gap: 12px; padding: 20px; background: var(--mls-side); border-right: 1px solid var(--mls-line); }
.mls-skeleton__main { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.mls-skeleton__row { display: flex; align-items: center; gap: 12px; }
.mls-skeleton__row span { display: flex; flex: 1; flex-direction: column; gap: 8px; }
.mls-skeleton i, .mls-skeleton b {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eee 25%, #f6f6f6 50%, #eee 75%);
  background-size: 200% 100%;
  animation: mls-shimmer 1.2s linear infinite;
}
.mls-skeleton__side i:nth-child(odd) { width: 70%; }
.mls-skeleton b { flex: none; width: 48px; height: 48px; border-radius: 6px; }
.mls-skeleton__row i:last-child { width: 45%; }
@keyframes mls-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .mls-skeleton i, .mls-skeleton b { animation: none; }
}

@media (min-width: 1221px) {
  .mls-form { position: relative; }
}

/* Tablet: the field is a bar over the header; the block takes its width. */
@media (max-width: 1220px) {
  .mls {
    left: 0;
    right: 0;
    top: 100%;
    border-radius: 0 0 10px 10px;
    max-height: calc(100vh - var(--mls-header, 91px));
    max-height: calc(100dvh - var(--mls-header, 91px));
  }
}

/* Phone: the search takes the whole screen; back arrow, the field with its clear button, the button at the bottom. */
@media (max-width: 720px) {
  html.mls-active, html.mls-active body { overflow: hidden; }
  .mls-dim { display: none; }
  .mls-form.mls-open .header-search-wrap { grid-template-columns: 36px minmax(0, 1fr); gap: 4px; }
  .mls-form.mls-open .mls-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--mls-text);
    cursor: pointer;
  }
  .mls-form.mls-open .header-search-button, .mls-form.mls-open .header-search-close { display: none; }
  .mls-form.mls-open .header-search__input { border-radius: 5px; font-size: 16px; }
  .mls {
    position: fixed;
    top: var(--mls-header, 61px);
    bottom: 0;
    max-height: none;
    border-top: 1px solid var(--mls-line);
    border-radius: 0;
    box-shadow: none;
  }
  .mls-state[data-mls-results]:not([hidden]) { display: flex; flex-direction: column; min-height: 100%; }
  .mls-results { display: flex; flex: 1; flex-direction: column; }
  .mls-side { padding: 12px 16px 0; border-right: 0; background: #fff; }
  .mls-side .mls-title { padding: 0; }
  .mls-group--hints .mls-title { display: none; }
  .mls-group--hints + .mls-group { margin-top: 14px; }
  .mls-hints { display: flex; gap: 8px; margin: 0 -16px; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .mls-hints::-webkit-scrollbar { display: none; }
  .mls-hints li { flex: none; }
  .mls-hint { width: auto; padding: 8px 12px; border-radius: 999px; background: var(--mls-pill); white-space: nowrap; font-size: 12px; }
  .mls-hint__icon { display: none; }
  .mls-categories li:nth-child(n+4) { display: none; }
  .mls-category { padding: 11px 0; border-bottom: 1px solid var(--mls-line); border-radius: 0; }
  .mls-category:hover, .mls-category:focus-visible { background: none; box-shadow: none; }
  .mls-main { flex: 1; padding: 14px 16px 6px; }
  .mls-product:nth-child(n+5) { display: none; }
  .mls-product:nth-child(4) { border-bottom: 0; }
  .mls-product { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "link cart" "price cart"; row-gap: 2px; }
  .mls-product__link { grid-area: link; align-items: flex-start; }
  .mls-product__price { grid-area: price; flex-direction: row-reverse; align-items: baseline; justify-content: flex-end; gap: 6px; padding-left: 60px; }
  .mls-product__cart { grid-area: cart; width: 40px; height: 40px; }
  .mls-footer { position: sticky; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .mls-all { width: 100%; padding: 14px 16px; font-size: 14px; }
  .mls-empty, .mls-none { padding: 16px; }
  .mls-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mls-skeleton { grid-template-columns: minmax(0, 1fr); }
  .mls-skeleton__side { flex-direction: row; padding: 16px 16px 0; border-right: 0; background: #fff; }
  .mls-skeleton__side i { flex: 1; height: 28px; border-radius: 999px; }
  .mls-skeleton__side i:nth-child(n+4) { display: none; }
}
