/* ================================================
   Custom AJAX Filter + Product Grid — v3.2.0
   ================================================ */

/* ── GRID ─────────────────────────────────────── */

.cpg-grid-wrap { position: relative; width: 100%; }
.cpg-grid { display: grid; gap: 20px; width: 100%; }
.cpg-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cpg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cpg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cpg-cols-1 { grid-template-columns: 1fr; }

@media (max-width: 1024px) {
    .cpg-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
    .cpg-cols-4, .cpg-cols-3, .cpg-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .cpg-grid { gap: 10px; }
}

/* ── PRODUCT CARD ─────────────────────────────── */

.cpg-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.cpg-item:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.10); transform: translateY(-2px); }
.cpg-item-inner { display: block; text-decoration: none; color: inherit; }
.cpg-img-wrap { position: relative; overflow: hidden; aspect-ratio: 7/6; background: #f8f8f8; }
.cpg-img-main { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.cpg-badge {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    background: #222; color: #fff; font-size: 11px; font-weight: 600;
    padding: 3px 7px; border-radius: 4px; letter-spacing: 0.03em; font-family: inherit;
}
.cpg-info { padding: 12px 14px 16px; }
.cpg-title {
    font-family: inherit !important; font-size: 16px !important; font-weight: 500 !important;
    color: #222 !important; line-height: 1.4 !important; margin: 0 0 8px !important;
    display: -webkit-box !important; -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important; overflow: hidden !important; text-transform: none !important;
}
.cpg-price { font-family: inherit; font-size: 14px; }
.cpg-price del .woocommerce-Price-amount { color: #aaa; font-size: 12px; }
.cpg-price ins { text-decoration: none; }
.cpg-price ins .woocommerce-Price-amount { font-weight: 700; color: #222; font-size: 15px; }
.cpg-no-results { padding: 60px 20px; text-align: center; color: #aaa; font-size: 15px; font-family: inherit; }
.cpg-sentinel { height: 40px; display: flex; align-items: center; justify-content: center; margin-top: 20px; }
.cpg-sentinel.loading::after {
    content: ''; display: block; width: 32px; height: 32px;
    border: 3px solid #e0e0e0; border-top-color: #222; border-radius: 50%;
    animation: cpgSpin 0.65s linear infinite;
}
@keyframes cpgSpin { to { transform: rotate(360deg); } }
.cpg-end-message { text-align: center; padding: 32px 20px; font-size: 12px; color: #bbb; letter-spacing: 0.08em; text-transform: uppercase; font-family: inherit; }

/* ── ACTIVE FILTERS BAR (above grid) ─────────── */

.caf-active-filters-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.caf-active-filters-bar .caf-active-tags { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.caf-active-filters-bar .caf-tag {
    display: inline-flex !important; align-items: center !important; gap: 3px !important;
    border: none !important; outline: none !important; background: transparent !important;
    box-shadow: none !important; color: #666 !important; font-size: 12px !important;
    padding: 0 2px !important; border-radius: 0 !important; white-space: nowrap !important; font-family: inherit !important;
}
.caf-active-filters-bar .caf-tag-sort { color: #3a5ce6 !important; }
.caf-active-filters-bar .caf-tag-remove {
    background: none !important; border: none !important; outline: none !important;
    cursor: pointer !important; font-size: 14px !important; line-height: 1 !important;
    color: #aaa !important; padding: 0 !important; margin-left: 1px !important;
    box-shadow: none !important; transition: color 0.15s !important;
}
.caf-active-filters-bar .caf-tag-remove:hover { color: #222 !important; }
.caf-active-filters-bar .caf-reset-btn {
    background: #222 !important; border: none !important; outline: none !important;
    border-radius: 3px !important; padding: 3px 10px !important; font-size: 10px !important;
    font-weight: 700 !important; color: #fff !important; cursor: pointer !important;
    letter-spacing: 0.06em !important; text-transform: uppercase !important;
    font-family: inherit !important; box-shadow: none !important; white-space: nowrap !important; transition: opacity 0.2s !important;
}
.caf-active-filters-bar .caf-reset-btn:hover { opacity: 0.75 !important; }
.caf-count { display: none !important; }

/* ── FILTER WIDGET ────────────────────────────── */

.caf-shortcode-wrap { position: relative; }
.caf-widget { font-family: inherit; font-size: 14px; color: #333; background: #fff; }

/* ── SECTIONS ─────────────────────────────────── */

.caf-section { border-bottom: 1px solid #e8e8e8 !important; background: transparent !important; box-shadow: none !important; }
.caf-section:last-of-type { border-bottom: none !important; }
.caf-section-header {
    display: flex !important; align-items: center !important; justify-content: space-between !important;
    padding: 13px 0 !important; cursor: pointer !important; background: transparent !important;
    box-shadow: none !important; border: none !important;
}
.caf-section-title {
    font-size: 12px !important; font-weight: 700 !important; text-transform: uppercase !important;
    letter-spacing: 0.08em !important; color: #222 !important; font-family: inherit !important; background: transparent !important;
}
.caf-section-toggle {
    background: transparent !important; background-color: transparent !important;
    border: none !important; outline: none !important; cursor: pointer !important;
    font-size: 10px !important; color: #888 !important; padding: 0 !important; margin: 0 !important;
    line-height: 1 !important; box-shadow: none !important; border-radius: 0 !important;
    width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important;
}
.caf-section-toggle:hover { color: #333 !important; background: transparent !important; }
.caf-section-body { padding-bottom: 14px !important; background: transparent !important; }

/* ── LISTS ────────────────────────────────────── */

.caf-list {
    list-style: none !important; margin: 0 !important; padding: 0 !important;
    max-height: 260px !important; overflow-y: auto !important;
    scrollbar-width: thin !important; scrollbar-color: #ccc transparent !important; background: transparent !important;
	padding-right: 15px !important;
}
.caf-list::-webkit-scrollbar { width: 4px !important; }
.caf-list::-webkit-scrollbar-thumb { background: #ccc !important; border-radius: 4px !important; }

.caf-list li {
    margin: 0 !important; padding: 0 !important; list-style: none !important;
    background: transparent !important; border: none !important; box-shadow: none !important;
}

/* ── CATEGORY ROW (label + arrow in one line) ─── */

.caf-cat-row {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.caf-cat-row .caf-checkbox-label {
    flex: 1 !important;
    min-width: 0 !important;
}

/* ── SUBCAT TOGGLE ────────────────────────────── */

.caf-subcat-toggle {
    flex-shrink: 0 !important;
    background: transparent !important; background-color: transparent !important;
    border: none !important; outline: none !important; cursor: pointer !important;
    font-size: 9px !important; color: #bbb !important;
    padding: 0 !important; margin-left: 10px !important;
    transition: color 0.15s !important; box-shadow: none !important;
    border-radius: 0 !important; line-height: 1 !important;
    width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important;
    display: inline-flex !important; align-items: center !important;
}
.caf-subcat-toggle:hover { color: #555 !important; background: transparent !important; }

/* ── SUBLIST ──────────────────────────────────── */

.caf-sublist {
    list-style: none !important; margin: 0 !important; padding: 0 0 0 22px !important;
}
.caf-sublist li {
    margin: 0 !important; padding: 0 !important; list-style: none !important;
    background: transparent !important; border: none !important; display: block !important;
}

/* ── CHECKBOXES ───────────────────────────────── */

.caf-checkbox-label {
    display: flex !important; align-items: center !important; gap: 7px !important;
    padding: 4px 0 !important; cursor: pointer !important; line-height: 1.4 !important;
    user-select: none !important; background: transparent !important;
}
.caf-checkbox-label input[type="checkbox"] {
    position: absolute !important; opacity: 0 !important; width: 0 !important; height: 0 !important;
}
.caf-checkmark {
    flex-shrink: 0 !important; width: 15px !important; height: 15px !important;
    border: 1.5px solid #ccc !important; border-radius: 3px !important; background: #fff !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    transition: border-color 0.15s, background 0.15s !important; box-shadow: none !important;
}
.caf-checkbox-label:hover .caf-checkmark { border-color: #222 !important; }
.caf-checkbox-label input:checked + .caf-checkmark { background: #222 !important; border-color: #222 !important; }
.caf-checkbox-label input:checked + .caf-checkmark::after {
    content: '' !important; display: block !important; width: 8px !important; height: 4px !important;
    border-left: 2px solid #fff !important; border-bottom: 2px solid #fff !important;
    transform: rotate(-45deg) translateY(-1px) !important;
}
.caf-label-text {
    flex: 1 !important; font-size: 13px !important; color: #444 !important;
    transition: color 0.15s !important; font-family: inherit !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
}
.caf-checkbox-label input:checked ~ .caf-label-text { color: #222 !important; font-weight: 500 !important; }
.caf-count {
    font-size: 11px !important; color: #bbb !important; flex-shrink: 0 !important;
    font-family: inherit !important; margin-left: 4px !important;
}

/* ── BRAND SEARCH ─────────────────────────────── */

.caf-search-wrap { margin-bottom: 8px !important; }
.caf-brand-search {
    width: 100% !important; box-sizing: border-box !important; border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important; padding: 7px 10px !important; font-size: 12px !important;
    color: #444 !important; outline: none !important; font-family: inherit !important;
    background: #fff !important; box-shadow: none !important;
}
.caf-brand-search:focus { border-color: #222 !important; box-shadow: none !important; }

/* ── SORT LIST ────────────────────────────────── */

.caf-sort-list { max-height: none !important; overflow: visible !important; }
.caf-sort-list li { border-radius: 0 !important; background: transparent !important; border: none !important; display: block !important; }
.caf-sort-list li.active { background: transparent !important; }
.caf-sort-btn {
    display: block !important; width: 100% !important; text-align: left !important;
    background: transparent !important; background-color: transparent !important;
    border: none !important; outline: none !important; padding: 7px 0 !important;
    font-size: 13px !important; color: #555 !important; cursor: pointer !important;
    border-radius: 0 !important; font-family: inherit !important; box-shadow: none !important; transition: color 0.15s !important;
}
.caf-sort-btn:hover { color: #222 !important; background: transparent !important; }
.caf-sort-list li.active .caf-sort-btn { color: #222 !important; font-weight: 700 !important; background: transparent !important; }

/* ── ACTIVE FILTERS INSIDE WIDGET ────────────── */

.caf-widget .caf-active-filters { padding: 12px 0 8px !important; border-top: 1px solid #e8e8e8 !important; margin-top: 4px !important; background: transparent !important; }
.caf-widget .caf-active-tags { display: flex !important; flex-wrap: wrap !important; gap: 5px !important; margin-bottom: 8px !important; }
.caf-widget .caf-tag { display: inline-flex !important; align-items: center !important; gap: 3px !important; border: none !important; background: transparent !important; color: #666 !important; font-size: 11px !important; padding: 0 !important; font-family: inherit !important; }
.caf-widget .caf-tag-remove { background: none !important; border: none !important; cursor: pointer !important; font-size: 13px !important; color: #aaa !important; padding: 0 !important; }
.caf-widget .caf-reset-btn {
    background: #222 !important; border: none !important; border-radius: 3px !important;
    padding: 3px 10px !important; font-size: 10px !important; font-weight: 700 !important;
    color: #fff !important; cursor: pointer !important; font-family: inherit !important;
    letter-spacing: 0.06em !important; text-transform: uppercase !important; box-shadow: none !important;
}
.caf-widget .caf-reset-btn:hover { opacity: 0.75 !important; }

/* ── MOBILE TOGGLE — hidden on desktop ────────── */

.caf-mobile-toggle { display: none !important; }
.caf-mobile-close { display: none !important; }

/* ── OVERLAY ──────────────────────────────────── */

.caf-overlay-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9998; }
.caf-overlay-bg.active { display: block; }
body.caf-noscroll { overflow: hidden !important; }

/* ── MOBILE ───────────────────────────────────── */

@media (max-width: 767px) {

    .caf-mobile-toggle {
        display: flex !important; align-items: center !important; justify-content: center !important;
        gap: 6px !important; position: fixed !important; right: 0 !important; top: 50% !important;
        transform: translateY(-50%) !important; width: auto !important; z-index: 9997 !important;
        background: rgba(70, 107, 172, 1) !important; color: #fff !important; border: none !important;
        border-radius: 6px 0 0 6px !important; padding: 14px 10px !important; font-size: 12px !important;
        font-weight: 600 !important; font-family: inherit !important; letter-spacing: 0.04em !important;
        cursor: pointer !important; box-shadow: -2px 2px 12px rgba(0,0,0,0.20) !important;
        writing-mode: vertical-rl !important; text-orientation: mixed !important;
    }

    .caf-mobile-toggle svg { transform: rotate(90deg); }

    .caf-widget {
        position: fixed !important; top: 0 !important; left: -100% !important;
        width: 85% !important; max-width: 320px !important; height: 100% !important;
        background: #fff !important; z-index: 9999 !important; overflow-y: auto !important;
        padding: 56px 20px 100px !important; box-sizing: border-box !important;
        transition: left 0.3s ease !important; box-shadow: 4px 0 20px rgba(0,0,0,0.15) !important;
    }

    .caf-widget.caf-open { left: 0 !important; }

    .caf-mobile-close {
        display: block !important; position: absolute !important; top: 14px !important; right: 16px !important;
        background: none !important; border: none !important; font-size: 24px !important;
        cursor: pointer !important; color: #555 !important; line-height: 1 !important;
        z-index: 10 !important; box-shadow: none !important;
    }

    .caf-active-filters-bar { display: none !important; }
}