/* E-pood listing (design pass D5) and product cards in WooCommerce loops. Template: woocommerce/archive-product.php. */

/* ---------- Layout: category sidebar from 1024 px ---------- */

.nx-shop__layout {
  padding-bottom: var(--nx-section);
  padding-top: var(--nx-3);
}

.nx-shop__sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .nx-shop__layout {
    align-items: start;
    display: grid;
    gap: var(--nx-5);
    grid-template-columns: 240px minmax(0, 1fr);
    padding-top: var(--nx-4);
  }

  .nx-shop__sidebar {
    display: block;
    position: sticky;
    top: calc(var(--nanolex-header-h, 72px) + var(--nx-3));
  }
}

.nx-shop__main > * + * {
  margin-top: var(--nx-3);
}

.nx-shop__header .woocommerce-breadcrumb {
  color: var(--nx-text-muted);
  font-size: 13px;
  margin: 0 0 var(--nx-1);
}

.nx-shop__header .woocommerce-breadcrumb a {
  color: var(--nx-text-muted);
}

.nx-shop__title {
  margin: 0;
}

.nx-shop__description {
  color: var(--nx-text-muted);
  margin-top: var(--nx-1);
  max-width: 70ch;
}

.nx-shop__description p {
  margin: 0;
}

.nx-shop__count {
  margin-bottom: 0;
}

.nx-shop__count + .nx-products {
  margin-top: var(--nx-2);
}

.nx-shop__empty {
  background: var(--nx-bg-alt);
  border-radius: var(--nx-radius);
  padding: var(--nx-4);
  text-align: center;
}

/* ---------- Category navigation (sidebar and phone sheet) ---------- */

.nx-catnav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nx-catnav__list .nx-catnav__list {
  border-left: 2px solid var(--nx-border);
  margin: 2px 0 6px 12px;
  padding-left: 6px;
}

.nx-catnav__item {
  margin: 0;
}

.nx-catnav__item::before {
  display: none;
}

.nx-catnav__link {
  align-items: center;
  border-radius: var(--nx-radius-sm);
  color: var(--nx-text);
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: var(--nx-1);
  justify-content: space-between;
  line-height: 1.3;
  min-height: 40px;
  padding: 6px 10px;
  text-decoration: none !important;
}

.nx-catnav__list .nx-catnav__list .nx-catnav__link {
  font-size: 14px;
  font-weight: 500;
  min-height: 36px;
}

.nx-catnav__link:hover {
  background: var(--nx-bg-alt);
  color: var(--nx-purple);
}

.nx-catnav__link[aria-current="page"] {
  background: var(--nx-lilac-soft);
  color: var(--nx-purple);
  font-weight: 800;
}

.nx-catnav__all {
  font-weight: 800;
  margin-bottom: 4px;
}

.nx-catnav__count {
  color: var(--nx-text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Desktop filter row ---------- */

.nx-filterbar {
  display: none;
}

@media (min-width: 1024px) {
  .nx-filterbar {
    align-items: center;
    border-bottom: 1px solid var(--nx-border);
    border-top: 1px solid var(--nx-border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--nx-1) var(--nx-2);
    justify-content: space-between;
    padding: 12px 0;
  }
}

.nx-filterbar .nx-chip {
  padding: 0 12px;
}

.nx-filterbar__form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-1);
}

.nx-filterbar__levels {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-1);
  margin: 0 var(--nx-1) 0 0;
}

.nx-filterbar__label {
  color: var(--nx-text-muted);
  font-size: var(--nx-small);
  font-weight: 700;
  margin-right: 4px;
}

/* Every item in the row is the same 40 px pill on one centre line */
.nx-filterbar .nx-chip,
.nx-filterbar .nx-dropdown summary {
  box-sizing: border-box;
  height: 40px;
  line-height: 1;
  margin: 0;
  min-height: 40px;
}

.nx-filterbar .nx-dropdown {
  display: flex;
}

/* Toggle chip: a checkbox styled as a chip */
.nx-chip--toggle {
  cursor: pointer;
  position: relative;
}

.nx-chip--toggle input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.nx-chip--toggle:has(input:checked) {
  background: var(--nx-purple);
  border-color: var(--nx-purple);
  color: #fff;
}

.nx-chip--toggle:has(input:focus-visible),
.nx-dropdown summary:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-level-dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.nx-level-dot--start { background: var(--nx-mint); }
.nx-level-dot--entusiast { background: var(--nx-lilac); }
.nx-level-dot--pro { background: var(--nx-purple); box-shadow: 0 0 0 1px #fff; }

.nx-chip__count {
  align-items: center;
  background: var(--nx-purple);
  border-radius: var(--nx-pill);
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 6px;
}

.nx-chip.is-active .nx-chip__count {
  background: #fff;
  color: var(--nx-purple);
}

.nx-chip__value {
  font-weight: 600;
}

/* Dropdown (details/summary) */
.nx-dropdown {
  position: relative;
}

.nx-dropdown summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}

.nx-dropdown summary::-webkit-details-marker {
  display: none;
}

.nx-dropdown summary .nx-icon {
  height: 16px;
  transition: transform 0.15s ease;
  width: 16px;
}

.nx-dropdown[open] summary .nx-icon {
  transform: rotate(180deg);
}

.nx-dropdown__panel {
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow-strong);
  display: grid;
  gap: 2px;
  left: 0;
  list-style: none;
  margin: 6px 0 0;
  max-height: 60vh;
  min-width: 220px;
  overflow: auto;
  padding: var(--nx-1);
  position: absolute;
  top: 100%;
  z-index: 30;
}

.nx-dropdown--right .nx-dropdown__panel {
  left: auto;
  right: 0;
}

/* Without JS the dropdown has a "Näita" button; with JS a change sends the form at once */
.nx-filterbar__apply {
  margin-top: var(--nx-1);
}

.nx-shop-js .nx-filterbar__apply {
  display: none;
}

/* Checkbox row */
.nx-check {
  align-items: center;
  border-radius: var(--nx-radius-sm);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  gap: 10px;
  min-height: 40px;
  padding: 4px 8px;
}

.nx-check:hover {
  background: var(--nx-bg-alt);
}

.nx-check input {
  accent-color: var(--nx-purple);
  height: 18px;
  margin: 0;
  width: 18px;
}

/* Sort list */
.nx-sortlist {
  list-style: none;
}

.nx-sortlist li {
  margin: 0;
}

.nx-sortlist li::before {
  display: none;
}

.nx-sortlist a {
  border-radius: var(--nx-radius-sm);
  color: var(--nx-text);
  display: flex;
  font-size: 15px;
  min-height: 40px;
  align-items: center;
  padding: 4px 10px;
  text-decoration: none !important;
}

.nx-sortlist a:hover {
  background: var(--nx-bg-alt);
}

.nx-sortlist a[aria-current="true"] {
  color: var(--nx-purple);
  font-weight: 800;
}

.nx-sortlist a[aria-current="true"]::after {
  content: "✓";
  margin-left: auto;
}

/* Chosen filters */
.nx-active-filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-1);
}

.nx-pill {
  align-items: center;
  background: var(--nx-lilac-soft);
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  display: inline-flex;
  font-size: var(--nx-small);
  font-weight: 700;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px 0 12px;
  text-decoration: none !important;
}

.nx-pill .nx-icon {
  height: 14px;
  width: 14px;
}

.nx-pill:hover {
  background: var(--nx-lilac);
}

.nx-active-filters__clear {
  font-size: var(--nx-small);
  margin-left: 4px;
}

/* ---------- Phones and tablets: sticky bar and bottom sheets ---------- */

.nx-shopbar {
  background: #fff;
  border-bottom: 1px solid var(--nx-border);
  position: sticky;
  top: var(--nanolex-header-h, 0px);
  z-index: 20;
}

@media (min-width: 1024px) {
  .nx-shopbar { display: none; }
}

.nx-shopbar__inner {
  display: grid;
  gap: var(--nx-1);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: 8px;
  padding-top: 8px;
}

.nx-shopbar__btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: var(--nx-small);
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
}

.nx-shopbar__btn:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-sheet-backdrop {
  background: rgba(44, 24, 68, 0.45);
  inset: 0;
  position: fixed;
  z-index: 200;
}

.nx-sheet {
  background: #fff;
  border-radius: 16px 16px 0 0;
  bottom: 0;
  box-shadow: 0 -8px 32px rgba(44, 24, 68, 0.2);
  display: flex;
  flex-direction: column;
  left: 0;
  margin: 0;
  max-height: 85vh;
  position: fixed;
  right: 0;
  z-index: 201;
}

.nx-sheet[hidden],
.nx-sheet-backdrop[hidden] {
  display: none;
}

html.nx-sheet-open,
html.nx-sheet-open body {
  overflow: hidden;
}

.nx-sheet__header {
  align-items: center;
  border-bottom: 1px solid var(--nx-border);
  display: flex;
  justify-content: space-between;
  padding: 12px var(--nx-gutter);
}

.nx-sheet__header .nx-h3 {
  margin: 0;
}

.nx-sheet__close {
  align-items: center;
  background: none;
  border: 0;
  color: var(--nx-purple);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin-right: -10px;
  width: 44px;
}

.nx-sheet__body {
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--nx-1) var(--nx-gutter) var(--nx-2);
}

.nx-sheet__group {
  border: 0;
  border-bottom: 1px solid var(--nx-border);
  margin: 0;
  padding: var(--nx-2) 0;
}

.nx-sheet__group:last-child {
  border-bottom: 0;
}

.nx-sheet__legend {
  color: var(--nx-purple);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  padding: 0;
}

.nx-sheet__footer {
  border-top: 1px solid var(--nx-border);
  display: grid;
  gap: var(--nx-1);
  grid-template-columns: 1fr 2fr;
  padding: 12px var(--nx-gutter) calc(12px + env(safe-area-inset-bottom));
}

/* ---------- Product grid and cards ---------- */

.nx-products {
  display: grid;
  gap: var(--nx-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 700px) {
  .nx-products { gap: var(--nx-3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .nx-products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.nx-products > li,
ul.products > li.nx-product {
  margin: 0;
  width: auto;
}

.nx-products > li::before,
ul.products > li.nx-product::before {
  display: none;
}

.nx-product .nx-product__name {
  color: var(--nx-purple);
  font-family: var(--nx-font);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  margin: 0;
  text-transform: none;
}

.nx-product .nx-product__name a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

/* The parent sets a lighter weight on links and price amounts */
.nx-product__price .amount,
.nx-product__price bdi {
  font-weight: inherit;
}

.nx-product__footer {
  align-items: flex-end;
}

.nx-product .nx-product__name a::after {
  /* the whole card body is clickable through the name link */
  content: "";
  inset: 0;
  position: absolute;
}

.nx-product__footer,
.nx-product__cart-mobile {
  position: relative;
  z-index: 1;
}

.nx-product__price del {
  color: var(--nx-text-muted);
  font-size: 0.8em;
  font-weight: 600;
  margin-right: 4px;
}

.nx-product__price ins {
  text-decoration: none;
}

/* WooCommerce adds a "Vaata ostukorvi" link after an AJAX add; the header cart shows it instead */
.nx-product .added_to_cart {
  display: none !important;
}

.nx-product .ajax_add_to_cart.loading {
  opacity: 0.6;
  pointer-events: none;
}

.nx-product .ajax_add_to_cart.added {
  background: var(--nx-mint);
  border-color: var(--nx-mint);
}

@media (max-width: 699px) {
  .nx-products .nx-card__body { gap: var(--nx-1); padding: 12px; }
  .nx-products .nx-product__name { font-size: 15px; }
  .nx-products .nx-product__subtitle { font-size: 13px; }
  .nx-products .nx-product__price { font-size: 17px; }
  .nx-products .nx-card__badge { left: var(--nx-1); top: var(--nx-1); }
}

/* ---------- Pagination ---------- */

.nx-shop .woocommerce-pagination {
  margin-top: var(--nx-5);
}

.nx-shop .woocommerce-pagination ul.page-numbers {
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nx-shop .woocommerce-pagination li {
  border: 0;
  margin: 0;
}

.nx-shop .woocommerce-pagination li::before {
  display: none;
}

.nx-shop .woocommerce-pagination .page-numbers a,
.nx-shop .woocommerce-pagination .page-numbers span {
  align-items: center;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  display: inline-flex;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  min-width: 44px;
  padding: 0 12px;
  text-decoration: none;
}

.nx-shop .woocommerce-pagination .page-numbers span.current {
  background: var(--nx-purple);
  border-color: var(--nx-purple);
  color: #fff;
}

/* ---------- Category tiles on /tooted/: one swipeable row on phones so the products start sooner ---------- */

@media (max-width: 699px) {
  .nx-shop .nx-tiles {
    display: flex;
    gap: var(--nx-1);
    margin-left: calc(-1 * var(--nx-gutter));
    margin-right: calc(-1 * var(--nx-gutter));
    overflow-x: auto;
    padding: 0 var(--nx-gutter) 4px;
    scroll-padding-left: var(--nx-gutter);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .nx-shop .nx-tiles::-webkit-scrollbar {
    display: none;
  }

  .nx-shop .nx-tiles__item {
    flex: 0 0 104px;
    scroll-snap-align: start;
  }


  .nx-shop .nx-tile__name {
    font-size: 13px;
    padding: 8px 4px;
  }
}

/* 1024–1279 px: keep the filter row on one line (narrower sidebar, sort without its current value) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nx-shop__layout {
    gap: var(--nx-4);
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .nx-filterbar .nx-chip__value {
    display: none;
  }

  .nx-filterbar .nx-chip {
    padding: 0 10px;
  }
}

