/* ================================================
   Custom AJAX Filter + Product Grid
   ================================================ */

/* ── 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: 768px) {
    .cpg-cols-4,
    .cpg-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .cpg-grid { gap: 12px; }
}
@media (max-width: 480px) {
    .cpg-cols-4,
    .cpg-cols-3,
    .cpg-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .cpg-grid { gap: 8px; }
}

/* ── 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;
}

/* Image */
.cpg-img-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 7 / 6;
    background: #f8f8f8;
}

.cpg-img-main,
.cpg-img-hover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: opacity 0.3s ease;
}

.cpg-img-hover {
    opacity: 0;
}

.cpg-item:hover .cpg-img-main {
    opacity: 0;
}

.cpg-item:hover .cpg-img-hover {
    opacity: 1;
}

/* Badge */
.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;
}

/* Info */
.cpg-info {
    padding: 12px 14px 16px;
}

.cpg-title {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    line-height: 1.4;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cpg-price {
    font-family: inherit;
    font-size: 14px;
}

.cpg-price del,
.cpg-price .woocommerce-Price-amount:first-child del {
    color: #aaa;
    font-size: 12px;
    display: block;
    margin-bottom: 2px;
}

.cpg-price ins,
.cpg-price ins .woocommerce-Price-amount {
    text-decoration: none;
    font-weight: 700;
    color: #222;
    font-size: 15px;
}

/* No results */
.cpg-no-results {
    padding: 60px 20px;
    text-align: center;
    color: #aaa;
    font-size: 15px;
    font-family: inherit;
}

/* Load More */
.cpg-load-more-wrap {
    text-align: center;
    margin-top: 32px;
    padding-bottom: 8px;
}

.cpg-load-more-btn {
    display: inline-block;
    padding: 12px 40px;
    background: transparent;
    border: 1.5px solid #222;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #222;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.cpg-load-more-btn:hover {
    background: #222;
    color: #fff;
}

.cpg-load-more-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

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

.caf-widget {
    font-family: inherit;
    font-size: 14px;
    color: #333;
}

.caf-shortcode-title {
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #222;
}

.caf-section {
    border-bottom: 1px solid #e8e8e8;
}

.caf-section:last-of-type {
    border-bottom: none;
}

.caf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.caf-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #222;
    font-family: inherit;
}

.caf-section-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: #888;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.caf-section-toggle:hover { color: #333; }

.caf-section-body { padding-bottom: 14px; }

.caf-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.caf-list::-webkit-scrollbar { width: 4px; }
.caf-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.caf-list li { margin: 0; padding: 0; }

.caf-sublist {
    list-style: none;
    margin: 0;
    padding: 0 0 0 20px;
}

.caf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}

.caf-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.caf-checkmark {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid #ccc;
    border-radius: 3px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.caf-checkbox-label:hover .caf-checkmark { border-color: #222; }
.caf-checkbox-label input:checked + .caf-checkmark { background: #222; border-color: #222; }
.caf-checkbox-label input:checked + .caf-checkmark::after {
    content: '';
    display: block;
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}

.caf-label-text {
    flex: 1;
    font-size: 13px;
    color: #444;
    transition: color 0.15s;
    font-family: inherit;
}

.caf-checkbox-label input:checked ~ .caf-label-text { color: #222; font-weight: 500; }
.caf-count { font-size: 11px; color: #aaa; margin-left: auto; }

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

.caf-sort-list { max-height: none; overflow: visible; }
.caf-sort-list li { border-radius: 4px; transition: background 0.15s; }
.caf-sort-list li.active { background: #f5f5f5; }

.caf-sort-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s;
    font-family: inherit;
}
.caf-sort-btn:hover { color: #222; }
.caf-sort-list li.active .caf-sort-btn { color: #222; font-weight: 700; }

.caf-active-filters {
    padding: 12px 0 8px;
    border-top: 1px solid #e8e8e8;
    margin-top: 4px;
}
.caf-active-filters-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    margin-bottom: 8px;
    font-family: inherit;
}
.caf-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.caf-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #333;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    font-family: inherit;
}
.caf-tag-sort { background: #f0f0f0; }
.caf-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: inherit;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.caf-tag-remove:hover { opacity: 1; }

.caf-reset-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: 1.5px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 11px;
    color: #777;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: border-color 0.2s, color 0.2s;
    font-family: inherit;
}
.caf-reset-btn:hover { border-color: #222; color: #222; }
