/* =========================================================
   MyLavida – product category buttons (chips)
   Homepage (above the first product grid), shop / category pages, [mylavida_categories].
   One horizontal row: wraps and centres on desktop, swipes sideways on phones.
   Logical properties → same file for English (LTR) and Arabic (RTL).
========================================================= */

.mlv-cats {
  width: 100%;
  margin: 0 0 22px;
}

.mlv-cats__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.mlv-cats--shop .mlv-cats__list {
  justify-content: flex-start;
}

.mlv-cats__item {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.mlv-cats__item::before,
.mlv-cats__item::marker {
  content: none;
}

.mlv-cats__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px;
  box-sizing: border-box;
  border: 1.5px solid var(--mlv-line, #dbeee7);
  border-radius: 999px;
  background: #fff;
  color: var(--mlv-ink, #0f172a) !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.mlv-cats__chip.has-img {
  padding-inline-start: 5px;
}

.mlv-cats__img {
  flex: 0 0 34px;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: cover;
  border-radius: 50% !important;
  background: var(--mlv-tint, #f3fbf7);
}

.mlv-cats__count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--mlv-tint, #f3fbf7);
  color: var(--mlv-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.mlv-cats__chip:hover {
  border-color: var(--mlv-primary, #1fbf75);
  color: var(--mlv-primary-deep, #0b7a4d) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(var(--mlv-primary-rgb, 31, 191, 117), .14);
}

.mlv-cats__chip:focus-visible {
  outline: 3px solid rgba(var(--mlv-primary-rgb, 31, 191, 117), .45);
  outline-offset: 2px;
}

.mlv-cats__chip.is-current {
  border-color: var(--mlv-primary-strong, #0f9460);
  background: var(--mlv-primary-strong, #0f9460);
  color: #fff !important;
}

.mlv-cats__chip.is-current .mlv-cats__count {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

/* Phones: one swipeable row instead of several wrapped lines */
@media (max-width: 767px) {
  .mlv-cats {
    margin-bottom: 16px;
  }

  .mlv-cats__list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-block: 4px 8px !important;
    padding-inline: 2px !important;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }

  html[dir="rtl"] .mlv-cats__list {
    -webkit-mask-image: linear-gradient(to left, #000 88%, transparent);
    mask-image: linear-gradient(to left, #000 88%, transparent);
  }

  .mlv-cats__list::-webkit-scrollbar {
    display: none;
  }

  .mlv-cats__item {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .mlv-cats__chip {
    min-height: 40px;
    padding: 7px 14px;
    font-size: 13px;
  }

  .mlv-cats__img {
    flex-basis: 30px;
    width: 30px !important;
    height: 30px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mlv-cats__chip {
    transition: none;
  }
  .mlv-cats__chip:hover {
    transform: none;
  }
}

/* Safety: automatic <p>/<br> tags if the chips end up inside a Text Editor block */
.mlv-cats br {
  display: none !important;
}

.mlv-cats p {
  display: contents;
}
