/* =========================
   Mobile Price & Brand Filter
   Complete CSS (LookFantastic-style)
   ========================= */

/* ---------- Variables (easy to tweak) ---------- */
:root{
  --mpbf-bg: #ffffff;
  --mpbf-border: #e8e8e8;
  --mpbf-border-strong: #d0d0d0;
  --mpbf-text: #111111;
  --mpbf-muted: #888888;
  --mpbf-accent: #ef7676; /* clear-all tint */
  --mpbf-button-bg: #000000;
  --mpbf-button-text: #ffffff;
  --mpbf-gap: 12px;
  --mpbf-radius: 4px;
  --mpbf-z: 99999;
}

/* ---------- Trigger Button (LookFantastic-style) ---------- */
.mpbf-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 12px 16px;
  min-width: 120px;
  height: 48px;

  background: var(--mpbf-bg);
  border: 1px solid var(--mpbf-border);
  border-radius: 0; /* squared corners like LookFantastic */
  box-shadow: none;

  font-size: 15px;
  line-height: 1;
  font-weight: 500;
  color: var(--mpbf-text);
  cursor: pointer;

  -webkit-tap-highlight-color: transparent;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}

.mpbf-filter-trigger .mpbf-filter-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  stroke: var(--mpbf-text);
  fill: none;
}

/* Hover / Active */
.mpbf-filter-trigger:hover {
  background: #fbfbfb;
  border-color: var(--mpbf-border-strong);
}
.mpbf-filter-trigger:active {
  background: #f3f3f3;
}

/* Focus (keyboard accessible) */
.mpbf-filter-trigger:focus {
  outline: 3px solid rgba(17,17,17,0.08);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(17,17,17,0.04);
}

/* Compact / icon-only (optional) */
.mpbf-filter-trigger.mpbf-icon-only {
  padding-left: 12px;
  padding-right: 12px;
  min-width: 44px;
}

/* ---------- Full-screen Modal (mobile) ---------- */
.mpbf-modal {
  position: fixed;
  inset: 0;
  background: var(--mpbf-bg);
  z-index: var(--mpbf-z);
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-family: inherit;
  color: var(--mpbf-text);
  padding-bottom: 96px; /* room for sticky action */
}

/* Hide when inactive if code toggles .active */
.mpbf-modal:not(.active) {
  display: none;
}

/* ---------- Header (X, title, Clear All) ---------- */
.mpbf-modal-header {
  display: grid;
  grid-template-columns: 48px 1fr 80px;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--mpbf-border);
  position: sticky;
  top: 0;
  background: var(--mpbf-bg);
  z-index: calc(var(--mpbf-z) + 10);
}

.mpbf-close {
  justify-self: start;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--mpbf-text);
  padding: 6px;
}

#mpbfTitle {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  justify-self: center;
}

.mpbf-clear {
  justify-self: end;
  background: none;
  border: none;
  color: var(--mpbf-accent);
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
}

/* ---------- Sections (row list look) ---------- */
.mpbf-section {
  border-bottom: 1px solid var(--mpbf-border);
  background: var(--mpbf-bg);
}

.mpbf-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
}

.mpbf-section-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--mpbf-text);
}

.mpbf-section-chevron {
  color: var(--mpbf-muted);
  font-size: 16px;
  transition: transform .18s ease;
}

/* Rotate the chevron on expanded */
.mpbf-section-toggle[aria-expanded="true"] .mpbf-section-chevron {
  transform: rotate(180deg);
}

/* Section body (hidden/shown) */
.mpbf-section-body {
  display: none;
  padding: 0 16px 16px 16px;
}

/* When expanded, reveal body (if JS toggles .open) */
.mpbf-section-toggle[aria-expanded="true"] + .mpbf-section-body,
.mpbf-section-body.mpbf-open {
  display: block;
}

/* ---------- Choice list styles ---------- */
.mpbf-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.mpbf-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--mpbf-radius);
  background: var(--mpbf-bg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

.mpbf-choice:hover {
  background: #fbfbfb;
  border-color: var(--mpbf-border);
}

.mpbf-choice input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
}

.mpbf-choice-label {
  font-size: 15px;
  color: var(--mpbf-text);
}

.mpbf-choice-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--mpbf-muted);
}

/* Empty state */
.mpbf-empty {
  padding: 12px 16px;
  color: var(--mpbf-muted);
  font-size: 14px;
}

/* ---------- Sticky bottom action (View N products) ---------- */
.mpbf-sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  background: linear-gradient(rgba(255,255,255,0.02), rgba(255,255,255,0.6)); /* subtle */
  z-index: calc(var(--mpbf-z) + 20);
  pointer-events: none;
}

.mpbf-sticky-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
  pointer-events: auto;
}

.mpbf-view-button {
  width: 100%;
  padding: 14px 16px;
  background: var(--mpbf-button-bg);
  color: var(--mpbf-button-text);
  border: none;
  font-size: 16px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0,0,0,0.06);
}

/* Focus for the main action */
.mpbf-view-button:focus {
  outline: 3px solid rgba(255,255,255,0.08);
  outline-offset: 2px;
}

/* ---------- Small screens tweaks ---------- */
@media (max-width: 420px) {
  .mpbf-filter-trigger { padding: 10px 12px; gap: 8px; min-width: 92px; height: 44px; font-size: 14px; }
  #mpbfTitle { font-size: 17px; }
  .mpbf-section-toggle { padding: 14px 12px; }
  .mpbf-view-button { padding: 12px 14px; font-size: 15px; }
}

/* ---------- Desktop: don't show modal (preserve original behavior) ---------- */
@media (min-width: 1025px) {
  .mpbf-modal { display: none !important; }
}

/* ---------- Reduced motion support ---------- */
@media (prefers-reduced-motion: reduce) {
  .mpbf-section-body,
  .mpbf-section-toggle,
  .mpbf-view-button,
  .mpbf-filter-trigger {
    transition: none !important;
  }
}
