/* pacco-sort-menu.css (v1.0.0) — "Sort products" pill + panel.
 * Matches the storefront select pill (store.css .select-field) and the
 * currency selector panel (pacco-currency.css), so the toolbar reads as one
 * set. Scoped to .sm-wrap; the native select is kept for its value only. */

.sm-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.sm-wrap .sm-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
  border: 0 !important;
}

.sm-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  box-sizing: border-box;
  padding: 0 14px 0 18px;
  border: 2px solid #d8d8df;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}

.sm-btn:hover,
.sm-wrap.is-open .sm-btn {
  border-color: #111;
}

.sm-btn:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.sm-chev {
  flex: 0 0 auto;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1);
}

.sm-wrap.is-open .sm-chev {
  transform: rotate(180deg);
}

.sm-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 900;
  min-width: 100%;
  width: max-content;
  box-sizing: border-box;
  padding: 6px;
  background: #fff;
  color: #111;
  border: 1px solid #e3e7ec;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  transform-origin: top right;
  animation: sm-panel-in .22s cubic-bezier(.16, 1, .3, 1);
}

.sm-panel[hidden] {
  display: none;
}

@keyframes sm-panel-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sm-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1e2733;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.sm-opt:hover,
.sm-opt:focus-visible {
  background: #f2f4f7;
  outline: none;
}

.sm-opt.is-selected {
  font-weight: 800;
  color: #111;
}

.sm-check {
  flex: 0 0 auto;
  opacity: 0;
}

.sm-opt.is-selected .sm-check {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .sm-panel,
  .sm-chev,
  .sm-btn {
    animation: none;
    transition: none;
  }
}

/* Stacked toolbar (store.css, <= 820px): the control takes the full row, as
 * the old native select did, and the panel drops down across the same width. */
@media (max-width: 820px) {
  .toolbar > .sm-wrap {
    display: flex;
    width: 100%;
  }

  .toolbar > .sm-wrap .sm-btn {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar > .sm-wrap .sm-panel {
    left: 0;
    right: 0;
    width: auto;
  }
}
