/*
 * SIRKULE — Custom Shop Page CSS
 * Production-grade. Mobile-first. All bugs fixed.
 *
 * FIX LOG:
 * 1. csp-sidebar-overlay → position:fixed + display:none default
 *    (was leaking as a ghost grid item causing 2 blank columns)
 * 2. Grid proportions → sidebar 3col / main 9col (was 4/8, too cramped)
 * 3. Product grid → 3 col default, 4 col at 1280px+
 * 4. Mobile drawer → z-index, scroll lock, smooth animation
 * ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ================================================================
   DESIGN TOKENS
   ================================================================ */
:root {
  /* Colors */
  --c-bg:          #ffffff;
  --c-surface:     #fafaf9;
  --c-ink:         #111111;
  --c-ink-2:       #3d3d3d;
  --c-ink-3:       #6b6b6b;
  --c-ink-4:       #9b9b9b;
  --c-border:      #e8e6e2;
  --c-border-soft: #f0eeea;
  --c-accent:      #1a1a1a;
  --c-accent-hover:#333333;
  --c-sale:        #b91c1c;
  --c-new:         #166534;
  --c-tag-bg:      #f4f3f0;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 48px;
  --sp-10: 64px;
  --sp-11: 80px;

  /* Typography */
  --f-xs:   0.6875rem;  /* 11px */
  --f-sm:   0.8125rem;  /* 13px */
  --f-base: 0.9375rem;  /* 15px */
  --f-md:   1.0625rem;  /* 17px */
  --f-lg:   1.25rem;    /* 20px */

  /* Radius */
  --r-sm:   3px;
  --r-md:   6px;
  --r-lg:   10px;
  --r-full: 9999px;

  /* Shadows */
  --sh-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --sh-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);

  /* Motion */
  --ease: cubic-bezier(.25, .46, .45, .94);
  --t-fast: 150ms;
  --t-base: 220ms;
  --t-slow: 350ms;

  /* Layout */
  --sidebar-w: 260px;
}

/* ================================================================
   BASE RESET
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ================================================================
   SHOP WRAPPER
   ================================================================ */
#csp-shop {
  display: grid;
  /* KEY FIX: sidebar 260px fixed, main takes the rest */
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto;
  /* KEY FIX: overlay must NOT be a grid child — it's position:fixed */
  /* Only sidebar and main are grid items */
  align-items: start;
  min-height: 100vh;
  background: var(--c-bg);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--f-base);
  color: var(--c-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================================================
   OVERLAY — CRITICAL FIX
   Must be position:fixed so it does NOT participate in grid layout
   ================================================================ */
.csp-sidebar-overlay {
  display: none;              /* hidden by default — NOT a grid item visually */
  position: fixed;            /* taken out of flow completely */
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 200;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}

.csp-sidebar-overlay.is-open {
  display: block;
  opacity: 1;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.csp-sidebar {
  /* grid-column is automatic since overlay is fixed */
  width: var(--sidebar-w);
  border-right: 1px solid var(--c-border);
  background: var(--c-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
  transition: transform var(--t-slow) var(--ease);
  flex-shrink: 0;
}

.csp-sidebar::-webkit-scrollbar       { width: 3px; }
.csp-sidebar::-webkit-scrollbar-track { background: transparent; }
.csp-sidebar::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.csp-sidebar-inner {
  padding: var(--sp-7) var(--sp-6) var(--sp-10);
}

/* Close button — hidden on desktop */
.csp-sidebar-close {
  display: none;
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-4);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: var(--c-tag-bg);
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 16px;
  color: var(--c-ink-3);
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
  z-index: 1;
}
.csp-sidebar-close:hover { background: var(--c-border); color: var(--c-ink); }

/* Sidebar header */
.csp-sidebar-title {
  font-size: var(--f-xs);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--c-ink-4);
  margin-bottom: var(--sp-6);
}

/* ── Filter Blocks ── */
.csp-filter-block {
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--c-border-soft);
}
.csp-filter-block:first-of-type {
  border-top: none;
  padding-top: 0;
}

.csp-filter-label {
  font-size: var(--f-xs);
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--c-ink-4);
  margin-bottom: var(--sp-3);
}

/* ── Category List ── */
.csp-cat-list,
.csp-cat-children {
  list-style: none;
}

.csp-cat-list { display: flex; flex-direction: column; gap: 1px; }

.csp-cat-parent-row {
  display: flex;
  align-items: center;
}

.csp-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  padding: 6px var(--sp-2);
  border-radius: var(--r-md);
  font-size: var(--f-sm);
  font-weight: 400;
  color: var(--c-ink-2);
  text-decoration: none;
  gap: var(--sp-2);
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1.4;
}
.csp-cat-link:hover { background: var(--c-tag-bg); color: var(--c-ink); }
.csp-cat-link.is-active {
  background: var(--c-ink);
  color: #fff;
  font-weight: 500;
}
.csp-cat-link.is-active .csp-cat-count { color: rgba(255,255,255,.45); background: rgba(255,255,255,.12); }

.csp-cat-count {
  font-size: var(--f-xs);
  color: var(--c-ink-4);
  background: var(--c-tag-bg);
  padding: 1px 5px;
  border-radius: var(--r-full);
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 500;
}

.csp-cat-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--r-md);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.csp-cat-toggle:hover { background: var(--c-tag-bg); }

.csp-chevron {
  display: block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--c-ink-4);
  border-bottom: 1.5px solid var(--c-ink-4);
  transform: rotate(45deg);
  transition: transform var(--t-base) var(--ease);
  margin-top: -2px;
}
.csp-cat-parent.is-expanded > .csp-cat-parent-row .csp-chevron {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.csp-cat-children {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding-left: var(--sp-3);
  margin-top: 2px;
}
.csp-cat-children.is-open { display: flex; }

.csp-cat-child {
  font-size: var(--f-xs);
  padding-left: var(--sp-4);
}

/* ── Price Slider ── */
.csp-price-wrap { display: flex; flex-direction: column; gap: var(--sp-3); }

input[type="range"]#cspPriceSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--c-ink) 0%,
    var(--c-ink) var(--slider-pct, 100%),
    var(--c-border) var(--slider-pct, 100%),
    var(--c-border) 100%
  );
  outline: none;
  cursor: pointer;
}
input[type="range"]#cspPriceSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: var(--r-full);
  background: var(--c-ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--c-ink);
  cursor: pointer;
  transition: transform var(--t-fast);
}
input[type="range"]#cspPriceSlider::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]#cspPriceSlider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: var(--r-full);
  background: var(--c-ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--c-ink);
  cursor: pointer;
}
input[type="range"]#cspPriceSlider::-moz-range-track {
  background: transparent;
  height: 2px;
}

.csp-price-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--f-xs);
  color: var(--c-ink-4);
}
.csp-price-labels span:last-child {
  color: var(--c-ink);
  font-weight: 500;
}

/* ── Checkboxes ── */
.csp-check {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  padding: 5px 0;
  font-size: var(--f-sm);
  color: var(--c-ink-2);
  user-select: none;
}
.csp-check + .csp-check { margin-top: 2px; }
.csp-check input[type="checkbox"] { display: none; }

.csp-check-box {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--c-border);
  border-radius: 3px;
  flex-shrink: 0;
  position: relative;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.csp-check input:checked ~ .csp-check-box {
  background: var(--c-ink);
  border-color: var(--c-ink);
}
.csp-check-box::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 7px;
  border-right: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: translate(-50%, -60%) rotate(40deg) scaleY(0);
  transition: transform var(--t-fast);
  transform-origin: center;
}
.csp-check input:checked ~ .csp-check-box::after {
  transform: translate(-50%, -60%) rotate(40deg) scaleY(1);
}

/* ── Sidebar Actions ── */
.csp-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--c-border-soft);
}

.csp-apply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px var(--sp-4);
  background: var(--c-accent);
  color: #fff;
  font-size: var(--f-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background var(--t-base), transform var(--t-fast);
}
.csp-apply-btn:hover  { background: var(--c-accent-hover); }
.csp-apply-btn:active { transform: scale(.98); }

.csp-reset-link {
  display: block;
  text-align: center;
  font-size: var(--f-xs);
  color: var(--c-ink-4);
  text-decoration: none;
  padding: 6px;
  border-radius: var(--r-md);
  transition: color var(--t-fast), background var(--t-fast);
}
.csp-reset-link:hover { color: var(--c-ink); background: var(--c-tag-bg); }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.csp-main {
  min-width: 0; /* prevent grid blowout */
  padding: var(--sp-7) var(--sp-7) var(--sp-11);
  background: var(--c-bg);
}

/* ================================================================
   TOOLBAR
   ================================================================ */
.csp-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

/* Hidden on desktop, shown on mobile */
.csp-filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 7px var(--sp-3);
  font-size: var(--f-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--c-ink);
  font-family: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.csp-filter-toggle:hover { border-color: var(--c-ink); background: var(--c-tag-bg); }

.csp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  background: var(--c-ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--r-full);
  padding: 0 4px;
}

.csp-result-count {
  font-size: var(--f-sm);
  color: var(--c-ink-4);
  margin-right: auto;
}
.csp-result-count strong { color: var(--c-ink); font-weight: 600; }
.csp-result-count em     { font-style: normal; color: var(--c-ink-2); }

.csp-sort {
  -webkit-appearance: none;
  appearance: none;
  background: var(--c-bg) url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239b9b9b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 7px 30px 7px var(--sp-3);
  font-size: var(--f-sm);
  font-weight: 500;
  color: var(--c-ink);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color var(--t-fast);
}
.csp-sort:hover,
.csp-sort:focus { border-color: var(--c-ink); }

/* ================================================================
   ACTIVE FILTER TAGS
   ================================================================ */
.csp-active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.csp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--c-tag-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-size: var(--f-xs);
  font-weight: 500;
  color: var(--c-ink-2);
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.csp-tag:hover { background: var(--c-border); border-color: var(--c-ink-4); color: var(--c-ink); }

/* ================================================================
   PRODUCT GRID — FIXED
   3 columns default inside main panel
   4 columns at wide viewport
   ================================================================ */
.csp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5) var(--sp-4);
}

@media (min-width: 1300px) {
  .csp-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================================================
   PRODUCT CARD
   ================================================================ */
.csp-card {
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition:
    box-shadow var(--t-base) var(--ease),
    transform var(--t-base) var(--ease),
    border-color var(--t-base);
}
.csp-card:hover {
  box-shadow: var(--sh-lg);
  transform: translateY(-3px);
  border-color: var(--c-border-soft);
}
.csp-card.is-soldout { opacity: .6; }

/* Staggered entrance animation */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.csp-card {
  animation: fadeSlideUp .4s var(--ease) both;
}
.csp-card:nth-child(1)  { animation-delay: .04s; }
.csp-card:nth-child(2)  { animation-delay: .08s; }
.csp-card:nth-child(3)  { animation-delay: .12s; }
.csp-card:nth-child(4)  { animation-delay: .16s; }
.csp-card:nth-child(5)  { animation-delay: .20s; }
.csp-card:nth-child(6)  { animation-delay: .24s; }
.csp-card:nth-child(7)  { animation-delay: .28s; }
.csp-card:nth-child(8)  { animation-delay: .32s; }
.csp-card:nth-child(9)  { animation-delay: .36s; }
.csp-card:nth-child(10) { animation-delay: .40s; }
.csp-card:nth-child(11) { animation-delay: .44s; }
.csp-card:nth-child(12) { animation-delay: .48s; }

/* Image */
.csp-card-img-wrap {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--c-surface);
}
.csp-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s var(--ease);
}
.csp-card:hover .csp-card-img { transform: scale(1.05); }

/* Badges */
.csp-label {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  padding: 3px 7px;
  font-size: var(--f-xs);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  line-height: 1.5;
  z-index: 1;
}
.csp-label--sale { background: var(--c-sale); color: #fff; }
.csp-label--new  { background: var(--c-new);  color: #fff; }

.csp-soldout-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--f-xs);
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--c-ink-3);
  backdrop-filter: blur(1px);
}

/* Card body */
.csp-card-body {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--sp-2);
}

.csp-card-cat {
  font-size: var(--f-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-ink-4);
  font-weight: 500;
}

.csp-card-title {
  font-size: var(--f-sm);
  font-weight: 500;
  line-height: 1.45;
  color: var(--c-ink);
  flex: 1;

  /* 2-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.csp-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast);
}
.csp-card-title a:hover { color: var(--c-ink-3); }

.csp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-1);
}

.csp-price-group {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.csp-price {
  font-size: var(--f-base);
  font-weight: 600;
  color: var(--c-ink);
}
.csp-price-old {
  font-size: var(--f-xs);
  color: var(--c-ink-4);
  text-decoration: line-through;
}

/* Add to cart */
.csp-atc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  background: var(--c-accent);
  color: #fff;
  font-size: var(--f-xs);
  font-weight: 600;
  letter-spacing: .04em;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: background var(--t-base), transform var(--t-fast), opacity var(--t-fast);
}
.csp-atc-btn:hover  { background: var(--c-accent-hover); }
.csp-atc-btn:active { transform: scale(.96); }

.csp-atc-btn.is-disabled {
  background: var(--c-tag-bg);
  color: var(--c-ink-4);
  cursor: default;
  pointer-events: none;
}

/* ATC loading/success states */
.csp-atc-btn.is-loading {
  opacity: .65;
  pointer-events: none;
}
.csp-atc-btn.is-added {
  background: var(--c-new);
}

/* ================================================================
   PAGINATION
   ================================================================ */
.csp-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-10);
  flex-wrap: wrap;
}

.csp-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--f-sm);
  font-weight: 500;
  color: var(--c-ink-2);
  text-decoration: none;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.csp-page-btn:hover {
  border-color: var(--c-ink);
  color: var(--c-ink);
}
.csp-page-btn.is-current {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.csp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-11) var(--sp-8);
  color: var(--c-ink-4);
}
.csp-empty-icon { margin-bottom: var(--sp-5); opacity: .25; }
.csp-empty-title {
  font-size: var(--f-md);
  font-weight: 500;
  color: var(--c-ink-2);
  margin-bottom: var(--sp-2);
}
.csp-empty-sub {
  font-size: var(--f-sm);
  margin-bottom: var(--sp-6);
}
.csp-empty .csp-apply-btn {
  width: auto;
  padding: 10px var(--sp-6);
  display: inline-flex;
}

/* ================================================================
   RESPONSIVE — TABLET (≤ 1024px)
   sidebar + main still side-by-side but narrower sidebar
   ================================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }

  .csp-main { padding: var(--sp-6) var(--sp-6) var(--sp-10); }

  .csp-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4) var(--sp-3);
  }
}

/* ================================================================
   RESPONSIVE — MOBILE (≤ 768px)
   sidebar becomes off-canvas drawer
   ================================================================ */
@media (max-width: 768px) {
  /* Switch to single-column layout */
  #csp-shop {
    grid-template-columns: 1fr;
  }

  /* Sidebar → fixed drawer */
  .csp-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(var(--sidebar-w), 85vw);
    height: 100%;
    z-index: 201;
    transform: translateX(-110%);
    box-shadow: none;
    border-right: none;
  }
  .csp-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--sh-lg);
  }

  /* Show close button */
  .csp-sidebar-close { display: flex; }

  /* Show filter toggle */
  .csp-filter-toggle { display: inline-flex; }

  .csp-main { padding: var(--sp-5) var(--sp-4) var(--sp-9); }

  .csp-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3) var(--sp-2);
  }

  .csp-card-body { padding: var(--sp-3); gap: var(--sp-1); }
  .csp-card-title { font-size: var(--f-xs); }
  .csp-price { font-size: var(--f-sm); }
  .csp-atc-btn { padding: 6px 10px; font-size: 10px; }
  .csp-card-footer { gap: var(--sp-2); }

  .csp-toolbar { margin-bottom: var(--sp-4); }
}

/* ================================================================
   RESPONSIVE — SMALL MOBILE (≤ 420px)
   ================================================================ */
@media (max-width: 420px) {
  .csp-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-2) var(--sp-1);
  }

  .csp-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2);
  }
  .csp-atc-btn {
    width: 100%;
    padding: 8px;
  }

  .csp-toolbar { gap: var(--sp-2); }
  .csp-sort   { font-size: var(--f-xs); }
}

/* ================================================================
   WOOCOMMERCE OVERRIDES
   Make sure WC doesn't inject its own styles on top
   ================================================================ */
#csp-shop .woocommerce-Price-amount { font-size: inherit; }
#csp-shop .woocommerce-Price-currencySymbol { font-size: inherit; }

/* AJAX add to cart spinner override */
#csp-shop .csp-atc-btn.loading::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ── DUAL RANGE SLIDER (MIN-MAX PRICE) ──────────────────────────────────────── */
.csp-price-inputs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.csp-price-separator {
    color: var(--csp-muted);
    font-weight: 500;
}

.csp-price-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--csp-border);
    background: var(--csp-card);
}

.csp-price-input-field .csp-price-input-prefix {
    margin-right: 4px;
    font-size: 12px;
    color: var(--csp-muted);
    white-space: nowrap;
}

.csp-price-input-field input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--csp-text);
    font-size: 13px;
    font-weight: 500;
    outline: none;
}

.csp-price-input-field input::-webkit-outer-spin-button,
.csp-price-input-field input::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.csp-price-input-field input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.csp-range-slider-container {
    position: relative;
    width: 100%;
    height: 30px;
    margin: 10px 0;
}

.csp-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 3px;
    border-radius: 2px;
    pointer-events: none;
    background: var(--csp-border);
}

.csp-range-input {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 3px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.csp-range-input:focus {
    outline: none;
}

.csp-range-input::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--csp-accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    cursor: pointer;
    transition: transform .15s;
    z-index: 2;
    position: relative;
}

.csp-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.csp-range-input::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--csp-accent);
    border: 2px solid #fff;
    cursor: pointer;
}

.csp-range-input::-webkit-slider-runnable-track {
    width: 100%;
    height: 3px;
    background: transparent;
    border: none;
}

.csp-range-input::-moz-range-track {
    width: 100%;
    height: 3px;
    background: transparent;
}

.csp-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--csp-muted);
    margin-top: 8px;
}

#cspPriceMinLabel,
#cspPriceMaxLabel {
    font-weight: 500;
    color: var(--csp-text);
}

/* ── HAPUS STYLE LAMA UNTUK SINGLE SLIDER ───────────────────────────────────── */
/* Style di bawah ini HAPUS atau COMMENT jika ada di CSS Anda */
/* 
#cspPriceSlider { ... }
#cspPriceInput { ... }
#cspPriceOut { ... }
.csp-price-input-row { ... }
*/

/* ── RESPONSIVE UNTUK DUAL RANGE ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .csp-price-inputs-row {
        gap: 6px;
    }
    
    .csp-price-input-field {
        padding: 6px 8px;
    }
    
    .csp-price-input-field input {
        font-size: 12px;
    }
    
    .csp-range-input::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .csp-price-inputs-row {
        flex-wrap: nowrap;
    }
    
    .csp-price-separator {
        font-size: 12px;
    }
}