/* ==========================================================================
   Cropmark Product Grid — v1.1
   Design reference: Swiggy / Zomato (clean cards, pill filters, bottom drawer)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom properties (overridable via Elementor selectors)
   -------------------------------------------------------------------------- */
:root {
    --cmpg-accent:      #2c2c2c;
    --cmpg-accent-soft: rgba(44,44,44,.08);
    --cmpg-radius:      10px;
    --cmpg-card-shadow: 0 1px 6px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.06);
}

/* --------------------------------------------------------------------------
   Wrapper
   -------------------------------------------------------------------------- */
.cmpg-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    position: relative;
}

.cmpg-wrapper.cmpg-filters--sidebar-right { flex-direction: row-reverse; }
.cmpg-wrapper.cmpg-filters--topbar        { flex-direction: column; }

.cmpg-main { flex: 1; min-width: 0; }

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */
.cmpg-grid {
    display: grid;
    grid-template-columns: repeat(var(--cmpg-cols-d, 3), 1fr);
    column-gap: var(--cmpg-col-gap, 20px);
    row-gap:    var(--cmpg-row-gap, 24px);
}

@media (max-width: 1024px) {
    .cmpg-grid { grid-template-columns: repeat(var(--cmpg-cols-t, 2), 1fr); }
}

/* --------------------------------------------------------------------------
   Product card
   -------------------------------------------------------------------------- */
.cmpg-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--cmpg-radius);
    border: 1px solid #f0f0f0;
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

.cmpg-wrapper.cmpg-equal-heights .cmpg-card { height: 100%; }

.cmpg-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--cmpg-card-shadow);
}

/* Image */
.cmpg-card-image {
    position: relative;
    overflow: hidden;
    background: #f9f9f9;
    flex-shrink: 0;
}

.cmpg-card-image img {
    display: block;
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: transform .4s ease;
}

.cmpg-card:hover .cmpg-card-image img { transform: scale(1.04); }

/* Body */
.cmpg-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 8px;
}

/* Footer */
.cmpg-card-footer { padding: 0 14px 14px; }

/* --------------------------------------------------------------------------
   Sale badge
   -------------------------------------------------------------------------- */
.cmpg-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 4px;
    line-height: 1;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   Title
   -------------------------------------------------------------------------- */
.cmpg-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a;
}

.cmpg-card-title a { color: inherit; text-decoration: none; }
.cmpg-card-title a:hover { color: var(--cmpg-accent); }

/* Description */
.cmpg-card-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #888;
}

/* Rating */
.cmpg-card-body .star-rating { font-size: 12px; margin: 0; }

/* Price */
.cmpg-card-price { margin-top: auto; padding-top: 4px; }

.cmpg-card-price .price {
    font-size: 15px;
    font-weight: 800;
    color: #1a1a1a;
}

.cmpg-card-price del { color: #bbb; font-weight: 400; font-size: 12px; margin-right: 4px; }
.cmpg-card-price ins { color: #e74c3c; text-decoration: none; }

/* --------------------------------------------------------------------------
   Add-to-cart button (initial)
   -------------------------------------------------------------------------- */
.cmpg-cart-control { position: relative; }

.cmpg-add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 14px;
    background: var(--cmpg-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .1s;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.cmpg-add-to-cart:hover  { background: #111; }
.cmpg-add-to-cart:active { transform: scale(.97); }

.cmpg-btn-icon {
    font-size: 17px;
    font-weight: 300;
    line-height: 1;
}

/* Loading spinner inside button */
.cmpg-btn-loading {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cmpg-spin .6s linear infinite;
    position: absolute;
}

.cmpg-add-to-cart.cmpg-loading-state .cmpg-btn-icon,
.cmpg-add-to-cart.cmpg-loading-state .cmpg-btn-text { opacity: 0; }

.cmpg-add-to-cart.cmpg-loading-state .cmpg-btn-loading { display: block; }

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

/* --------------------------------------------------------------------------
   Quantity Stepper (Swiggy style)
   -------------------------------------------------------------------------- */
.cmpg-qty-stepper {
    display: none; /* shown by JS */
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--cmpg-accent);
    color: #fff;
    border-radius: 8px;
    padding: 3px;
    animation: cmpg-stepper-in .22s cubic-bezier(.34, 1.56, .64, 1);
}

.cmpg-qty-stepper.is-visible { display: flex; }

@keyframes cmpg-stepper-in {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.cmpg-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.cmpg-qty-btn:hover  { background: rgba(255,255,255,.18); }
.cmpg-qty-btn:active { background: rgba(255,255,255,.3); }

.cmpg-qty-display {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .01em;
}

/* Other button types */
.cmpg-select-options,
.cmpg-external-btn,
.cmpg-view-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: center;
    background: transparent;
    color: var(--cmpg-accent);
    border: 1.5px solid var(--cmpg-accent);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: background .15s, color .15s;
}

.cmpg-select-options:hover,
.cmpg-external-btn:hover,
.cmpg-view-btn:hover { background: var(--cmpg-accent); color: #fff; }

.cmpg-out-of-stock {
    display: block;
    text-align: center;
    color: #bbb;
    font-size: 12px;
    padding: 10px 0;
}

/* --------------------------------------------------------------------------
   No products
   -------------------------------------------------------------------------- */
.cmpg-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: #aaa;
    font-size: 15px;
}

/* --------------------------------------------------------------------------
   Result count / clear strip
   -------------------------------------------------------------------------- */
.cmpg-filter-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    min-height: 26px;
}

.cmpg-result-count { font-size: 12px; color: #999; font-weight: 600; }

.cmpg-clear-filters {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

/* --------------------------------------------------------------------------
   ===== SIDEBAR FILTER =====
   -------------------------------------------------------------------------- */
.cmpg-filters-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
}

/* Drawer handle (shown on mobile) */
.cmpg-drawer-handle {
    display: none;
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 4px;
    margin: 14px auto 0;
}

/* Drawer header (shown on mobile) */
.cmpg-drawer-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.cmpg-filter-panel-title {
    font-size: 15px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
}

/* Sidebar title rendered by filters.php (desktop-visible standalone heading) */
.cmpg-filters-sidebar > .cmpg-filter-panel-title,
h3.cmpg-filter-panel-title {
    display: block;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #888;
    margin: 0;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.cmpg-drawer-close {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
}

.cmpg-filters-sidebar .cmpg-filter-form { padding: 14px; }

/* Filter group in sidebar */
.cmpg-filter-group {
    border-bottom: 1px solid #f5f5f5;
    padding: 12px 0;
}

.cmpg-filter-group:last-of-type { border-bottom: none; }

.cmpg-filter-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}

.cmpg-filter-group-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #555;
}

/* Chevron icon */
.cmpg-toggle-icon {
    width: 16px;
    height: 16px;
    position: relative;
    flex-shrink: 0;
    color: #aaa;
}

.cmpg-toggle-icon::before,
.cmpg-toggle-icon::after {
    content: '';
    position: absolute;
    background: currentColor;
    border-radius: 2px;
    transition: transform .2s;
}

.cmpg-toggle-icon::before {
    top: 50%; left: 0;
    width: 100%; height: 2px;
    transform: translateY(-50%);
}

.cmpg-toggle-icon::after {
    top: 0; left: 50%;
    width: 2px; height: 100%;
    transform: translateX(-50%);
}

.cmpg-filter-group-toggle[aria-expanded="true"] .cmpg-toggle-icon::after {
    transform: translateX(-50%) scaleY(0);
}

.cmpg-filter-group-body { margin-top: 10px; overflow: hidden; }

/* Collapse only applies inside sidebar or mobile drawers, NOT topbar dropdowns */
.cmpg-filters-sidebar .cmpg-filter-group-toggle[aria-expanded="false"] + .cmpg-filter-group-body,
.cmpg-mobile-topbar-drawer .cmpg-filter-group-toggle[aria-expanded="false"] + .cmpg-filter-group-body {
    max-height: 0 !important;
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   Filter list (checkboxes / radios)
   -------------------------------------------------------------------------- */
.cmpg-filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmpg-filter-list--children { padding-left: 14px; }

.cmpg-item-hidden { display: none; }

.cmpg-show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 6px 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cmpg-accent);
    cursor: pointer;
    letter-spacing: .02em;
    opacity: .7;
    transition: opacity .15s;
}
.cmpg-show-more-btn:hover { opacity: 1; }

.cmpg-filter-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}

/* Custom checkbox */
.cmpg-filter-item input[type="checkbox"],
.cmpg-filter-item input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
    position: relative;
}

.cmpg-filter-item input[type="radio"] { border-radius: 50%; }

.cmpg-filter-item input[type="checkbox"]:checked,
.cmpg-filter-item input[type="radio"]:checked {
    background: var(--cmpg-accent);
    border-color: var(--cmpg-accent);
}

.cmpg-filter-item input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    position: absolute;
    top: 1px;
    left: 4px;
}

.cmpg-filter-item input[type="radio"]:checked::after {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
}

.cmpg-filter-label { color: #444; cursor: pointer; flex: 1; }
.cmpg-filter-count { color: #ccc; margin-left: 2px; font-size: 11px; }

/* Rating rows */
.cmpg-rating-text { margin-left: 5px; font-size: 11px; color: #aaa; }

/* --------------------------------------------------------------------------
   Tag cloud
   -------------------------------------------------------------------------- */
.cmpg-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

.cmpg-tag-label {
    display: inline-block;
    padding: 4px 11px;
    border: 1.5px solid #e8e8e8;
    border-radius: 20px;
    font-size: 12px;
    color: #555;
    background: #fff;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.cmpg-tag-item input:checked + .cmpg-tag-label {
    background: var(--cmpg-accent);
    color: #fff;
    border-color: var(--cmpg-accent);
}

/* --------------------------------------------------------------------------
   On-sale toggle
   -------------------------------------------------------------------------- */
.cmpg-toggle-item { gap: 10px; }

.cmpg-toggle-switch {
    display: inline-block;
    width: 38px;
    height: 22px;
    background: #ddd;
    border-radius: 22px;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
    cursor: pointer;
}

.cmpg-toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.cmpg-sale-toggle:checked + .cmpg-toggle-switch { background: var(--cmpg-accent); }
.cmpg-sale-toggle:checked + .cmpg-toggle-switch::after { transform: translateX(16px); }

.cmpg-sale-toggle {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

/* Screen-reader only */
.cmpg-sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   ===== PRICE RANGE SLIDER (dual-handle, cross-browser)
   Key insight: make the container the same height as the thumb (20px).
   The visual 4px track is a ::before pseudo-element centred in the container.
   Both <input type="range"> elements fill the container (top:0, height:100%).
   webkit sets the runnable-track to 100% height → thumb centre = container
   centre = visual track centre. Zero margin-top maths required.
   -------------------------------------------------------------------------- */

.cmpg-price-slider-wrap { padding: 4px 0 8px; }

.cmpg-price-track {
    position: relative;
    height: 20px;           /* = thumb diameter — no overflow, no clipping */
    background: transparent;
    margin: 10px 0 12px;
}

/* Visual 4px line centred in the 20px container */
.cmpg-price-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: #e0e0e0;
    border-radius: 4px;
    pointer-events: none;
}

/* Accent fill — same vertical position as the ::before track */
.cmpg-price-fill {
    position: absolute;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    background: var(--cmpg-accent);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

/* Both inputs fill the full container so their coordinate space
   matches the container. pointer-events:none on the track,
   pointer-events:all on the thumb only. */
.cmpg-range {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;           /* = 20px, same as container */
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    pointer-events: none;
}

/* webkit — make the internal track fill the full input height so the
   thumb is vertically centred with margin-top: 0 */
.cmpg-range::-webkit-slider-runnable-track {
    height: 100%;
    background: transparent;
}

.cmpg-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: all;
    cursor: grab;
    width: 20px;
    height: 20px;
    margin-top: 0;          /* thumb height = track height → naturally centred */
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--cmpg-accent);
    box-shadow: 0 1px 6px rgba(0,0,0,.18);
    transition: box-shadow .15s;
    position: relative;
    z-index: 2;
}

.cmpg-range:active::-webkit-slider-thumb { cursor: grabbing; }

.cmpg-range:hover::-webkit-slider-thumb,
.cmpg-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px var(--cmpg-accent-soft), 0 1px 6px rgba(0,0,0,.18);
}

/* Firefox */
.cmpg-range::-moz-range-track {
    height: 4px;
    background: transparent;
    border-radius: 4px;
    border: none;
}

.cmpg-range::-moz-range-thumb {
    pointer-events: all;
    cursor: grab;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--cmpg-accent);
    box-shadow: 0 1px 6px rgba(0,0,0,.18);
}

/* Z-index — bring min handle forward when handles converge at right edge */
.cmpg-range-min { z-index: 3; }
.cmpg-range-max { z-index: 4; }
.cmpg-range-min.on-top { z-index: 5; }

.cmpg-price-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: #333;
}

.cmpg-price-sep { color: #ccc; font-weight: 400; }

/* --------------------------------------------------------------------------
   Filter actions
   -------------------------------------------------------------------------- */
.cmpg-filter-actions {
    display: flex;
    gap: 8px;
    padding: 12px 0 0;
}

.cmpg-apply-btn {
    flex: 1;
    padding: 10px;
    background: var(--cmpg-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.cmpg-apply-btn:hover { background: #111; }

.cmpg-reset-btn {
    padding: 10px 16px;
    background: transparent;
    color: #666;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.cmpg-reset-btn:hover { border-color: #999; color: #333; }

/* --------------------------------------------------------------------------
   ===== TOPBAR FILTER (pill + dropdown) =====
   -------------------------------------------------------------------------- */
.cmpg-filters-topbar {
    margin-bottom: 16px;
}

.cmpg-filters-topbar .cmpg-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    position: relative;
}

/* Each filter group becomes a pill + absolute dropdown */
.cmpg-filters-topbar .cmpg-filter-group {
    position: relative;
    border: none;
    padding: 0;
}

/* Toggle button becomes pill */
.cmpg-filters-topbar .cmpg-filter-group-toggle {
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 14px;
    background: #fff;
    white-space: nowrap;
    transition: border-color .15s, background .15s, color .15s;
    gap: 6px;
}

.cmpg-filters-topbar .cmpg-filter-group-toggle:hover { border-color: #aaa; }

.cmpg-filters-topbar .cmpg-filter-group.has-active .cmpg-filter-group-toggle {
    border-color: var(--cmpg-accent);
    background: var(--cmpg-accent);
    color: #fff;
}

.cmpg-filters-topbar .cmpg-filter-group.has-active .cmpg-toggle-icon { color: #fff; }

.cmpg-filters-topbar .cmpg-filter-group-title { font-size: 12px; font-weight: 700; }

/* Dropdown panel */
.cmpg-filters-topbar .cmpg-filter-group-body {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
    padding: 16px;
    z-index: 200;
    min-width: 230px;
    max-height: 340px;
    overflow-y: auto;
    /* Hidden state */
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    /* Override sidebar collapsed state */
    max-height: 340px !important;
    margin-top: 0;
}

.cmpg-filters-topbar .cmpg-filter-group.is-open .cmpg-filter-group-body {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* On-sale group: no dropdown needed — always visible inline */
.cmpg-filters-topbar .cmpg-filter-group--sale .cmpg-filter-group-body {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    opacity: 1;
    transform: none;
    pointer-events: all;
    background: transparent;
    min-width: 0;
}

.cmpg-filters-topbar .cmpg-filter-group--sale .cmpg-filter-group-toggle {
    display: none; /* no pill needed, the toggle itself is the label */
}

.cmpg-filters-topbar .cmpg-filter-group--sale {
    display: flex;
    align-items: center;
}

/* --------------------------------------------------------------------------
   ===== MOBILE FILTER BUTTON + BOTTOM DRAWER =====
   -------------------------------------------------------------------------- */
.cmpg-mobile-filter-trigger {
    display: none; /* hidden on desktop */
    align-items: center;
    gap: 8px;
    background: var(--cmpg-accent);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.cmpg-active-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: #fff;
    color: var(--cmpg-accent);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    padding: 0 4px;
    transition: all .2s;
    /* hidden when 0 */
}

.cmpg-active-badge:empty { display: none; }

/* Backdrop */
.cmpg-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    z-index: 399;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}

.cmpg-drawer-backdrop.is-visible {
    opacity: 1;
    pointer-events: all;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.cmpg-pagination-wrap {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cmpg-load-more-btn {
    padding: 12px 36px;
    background: transparent;
    color: var(--cmpg-accent);
    border: 2px solid var(--cmpg-accent);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.cmpg-load-more-btn:hover { background: var(--cmpg-accent); color: #fff; }
.cmpg-load-more-btn.cmpg-loading-state { opacity: .55; cursor: wait; }

.cmpg-no-more { font-size: 12px; color: #ccc; margin: 0; }

.cmpg-pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.cmpg-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #fff;
    color: #333;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}

.cmpg-page-btn:hover     { border-color: var(--cmpg-accent); color: var(--cmpg-accent); }
.cmpg-page-btn--active   { background: var(--cmpg-accent); color: #fff; border-color: var(--cmpg-accent); }

/* --------------------------------------------------------------------------
   Loading overlay
   -------------------------------------------------------------------------- */
.cmpg-grid-area { position: relative; }

.cmpg-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.cmpg-loading.cmpg-loading--active { display: flex; }

.cmpg-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--cmpg-accent);
    border-radius: 50%;
    animation: cmpg-spin .7s linear infinite;
}

/* --------------------------------------------------------------------------
   Drawer footer (apply / reset — inside sidebar on mobile)
   -------------------------------------------------------------------------- */
.cmpg-drawer-footer {
    display: none; /* shown on mobile */
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 1024px) {
    .cmpg-filters-sidebar { width: 210px; }
}

/* Mobile — everything stacks, filters become bottom drawer */
@media (max-width: 767px) {
    .cmpg-wrapper,
    .cmpg-wrapper.cmpg-filters--sidebar-right,
    .cmpg-wrapper.cmpg-filters--topbar {
        flex-direction: column;
    }

    /* Show mobile trigger */
    .cmpg-mobile-filter-trigger { display: flex; }

    /* Sidebar: become fixed bottom sheet */
    .cmpg-filters-sidebar {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 400;
        width: 100% !important;
        border-radius: 18px 18px 0 0;
        max-height: 85vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.32,.72,0,1);
        box-shadow: 0 -4px 30px rgba(0,0,0,.15);
    }

    .cmpg-filters-sidebar.drawer-open { transform: translateY(0); }

    /* Show drawer chrome */
    .cmpg-drawer-handle   { display: block; }
    .cmpg-drawer-header   { display: flex; }
    .cmpg-drawer-footer   { display: flex; }

    /* Topbar: collapse to just the mobile trigger */
    .cmpg-filters-topbar {
        display: none; /* hidden on mobile — mobile trigger opens the drawer instead */
    }

    /* Topbar drawer (topbar filter groups moved into a virtual sidebar on mobile via JS) */
    .cmpg-mobile-topbar-drawer {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 400;
        width: 100% !important;
        border-radius: 18px 18px 0 0;
        max-height: 85vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.32,.72,0,1);
        box-shadow: 0 -4px 30px rgba(0,0,0,.15);
        background: #fff;
        padding: 0;
    }

    .cmpg-mobile-topbar-drawer.drawer-open { transform: translateY(0); }

    /* Reset topbar dropdown styles inside mobile drawer */
    .cmpg-mobile-topbar-drawer .cmpg-filter-group {
        border-bottom: 1px solid #f5f5f5;
        padding: 12px 18px;
    }

    .cmpg-mobile-topbar-drawer .cmpg-filter-group-toggle { display: flex; }

    .cmpg-mobile-topbar-drawer .cmpg-filter-group-body {
        position: static;
        box-shadow: none;
        border: none;
        padding: 10px 0 0;
        opacity: 1;
        transform: none;
        pointer-events: all;
        min-width: 0;
        max-height: none !important;
    }

    .cmpg-mobile-topbar-drawer .cmpg-filter-group.is-open .cmpg-filter-group-body {
        opacity: 1;
        transform: none;
        pointer-events: all;
    }

    .cmpg-mobile-topbar-drawer .cmpg-filter-group--sale .cmpg-filter-group-body {
        padding: 8px 0;
    }

    .cmpg-mobile-topbar-drawer .cmpg-filter-group--sale .cmpg-filter-group-toggle {
        display: none;
    }

    /* Drawer footer always visible on mobile */
    .cmpg-mobile-drawer-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid #f0f0f0;
        padding: 14px 18px;
        display: flex;
        gap: 10px;
    }
}
