/* ============================================================
   WooCommerce Custom Filter & Grid — style.css v3.0
   ============================================================ */


:root {
    --wcfg-accent:       #2271b1;
    --wcfg-accent-dark:  #135e96;
    --wcfg-accent-light: #f0f6fc;
    --wcfg-accent-rgb:   34, 113, 177;
    --wcfg-text:         #111827;
    --wcfg-text-muted:   #6b7280;
    --wcfg-text-faint:   #9ca3af;
    --wcfg-border:       #f0f0f0;
    --wcfg-border-dark:  #e5e7eb;
    --wcfg-bg:           #ffffff;
    --wcfg-bg-subtle:    #fafafa;
    --wcfg-radius:       16px;
    --wcfg-radius-sm:    8px;
    --wcfg-shadow:       0 2px 8px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.04);
    --wcfg-shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
    --wcfg-transition:   0.18s cubic-bezier(0.4,0,0.2,1);
    --wcfg-font:         -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Layout ── */
.wcfg-container {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    font-family: var(--wcfg-font);
    color: var(--wcfg-text);
}

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.wcfg-sidebar {
    width: 272px;
    flex-shrink: 0;
    background: var(--wcfg-bg);
    border-radius: var(--wcfg-radius);
    box-shadow: var(--wcfg-shadow);
    border: 1px solid var(--wcfg-border);
    overflow: hidden;
}

/* ── Filter Header ── */
.wcfg-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--wcfg-border);
}

.wcfg-filter-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcfg-filter-icon-wrap {
    width: 32px;
    height: 32px;
    background: var(--wcfg-accent-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wcfg-accent);
    flex-shrink: 0;
}

.wcfg-filter-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--wcfg-text);
}

.wcfg-clear-all {
    color: var(--wcfg-text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--wcfg-border-dark);
    transition: all var(--wcfg-transition);
    white-space: nowrap;
}
.wcfg-clear-all:hover {
    border-color: var(--wcfg-accent);
    color: var(--wcfg-accent);
    background: var(--wcfg-accent-light);
}

/* ── Active Filters Chips ── */
.wcfg-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--wcfg-border);
    min-height: 0;
}
.wcfg-active-chips:empty { display: none; }

.wcfg-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--wcfg-accent-light);
    color: var(--wcfg-accent);
    border: 1px solid rgba(var(--wcfg-accent-rgb), 0.2);
    border-radius: 20px;
    padding: 3px 8px 3px 10px;
    font-size: 12px;
    font-weight: 500;
}
.wcfg-chip-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: rgba(var(--wcfg-accent-rgb), 0.15);
    color: var(--wcfg-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    transition: background var(--wcfg-transition);
}
.wcfg-chip-remove:hover { background: rgba(var(--wcfg-accent-rgb), 0.3); }

/* ── Collapsible Sections ── */
.wcfg-filter-section {
    border-bottom: 1px solid var(--wcfg-border);
}
.wcfg-filter-section:last-of-type { border-bottom: none; }

:where(.wcfg-container) button.wcfg-section-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    padding: 14px 20px;
    font-family: var(--wcfg-font);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wcfg-text);
    text-align: start;
    white-space: normal;
    transition: background var(--wcfg-transition);
    gap: 8px;
}
/* Keep generic theme button hover and focus styles out of the filter panel. */
:where(.wcfg-container) button.wcfg-section-toggle:is(:hover, :focus) {
    background: var(--wcfg-bg-subtle);
    color: var(--wcfg-text);
}
:where(.wcfg-container) button.wcfg-section-toggle:focus-visible {
    outline: 2px solid var(--wcfg-accent);
    outline-offset: -2px;
}

.wcfg-section-toggle-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.wcfg-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--wcfg-bg-subtle);
    border: 1px solid var(--wcfg-border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wcfg-text-muted);
    flex-shrink: 0;
    transition: all var(--wcfg-transition);
}
.wcfg-section-toggle:hover .wcfg-section-icon,
.wcfg-filter-section:not(.is-collapsed) .wcfg-section-icon {
    background: var(--wcfg-accent-light);
    border-color: rgba(var(--wcfg-accent-rgb), 0.2);
    color: var(--wcfg-accent);
}

.wcfg-section-toggle-right {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}

.wcfg-section-count-badge {
    background: var(--wcfg-bg-subtle);
    border: 1px solid var(--wcfg-border-dark);
    color: var(--wcfg-text-muted);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
    transition: all var(--wcfg-transition);
}
.wcfg-filter-section:not(.is-collapsed) .wcfg-section-count-badge {
    background: var(--wcfg-accent-light);
    border-color: rgba(var(--wcfg-accent-rgb),0.2);
    color: var(--wcfg-accent);
}

.wcfg-chevron {
    color: var(--wcfg-text-faint);
    transition: transform var(--wcfg-transition);
    flex-shrink: 0;
}
.wcfg-filter-section.is-collapsed .wcfg-chevron {
    transform: rotate(180deg);
}

.wcfg-section-body {
    padding: 4px 20px 14px;
    animation: wcfg-slide-down 0.18s ease;
}
.wcfg-filter-section.is-collapsed .wcfg-section-body {
    display: none;
}

@keyframes wcfg-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Search within filter ── */
.wcfg-filter-search {
    position: relative;
    margin-bottom: 10px;
}
.wcfg-filter-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wcfg-text-faint);
    pointer-events: none;
}
.wcfg-filter-search-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--wcfg-border-dark);
    border-radius: 8px;
    padding: 7px 10px 7px 30px;
    font-size: 12.5px;
    font-family: var(--wcfg-font);
    color: var(--wcfg-text);
    background: var(--wcfg-bg-subtle);
    outline: none;
    transition: border-color var(--wcfg-transition), box-shadow var(--wcfg-transition);
}
.wcfg-filter-search-input:focus {
    border-color: var(--wcfg-accent);
    box-shadow: 0 0 0 3px rgba(var(--wcfg-accent-rgb), 0.12);
    background: #fff;
}
.wcfg-filter-search-input::placeholder { color: var(--wcfg-text-faint); }

/* ── Checkboxes ── */
.wcfg-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--wcfg-border-dark) transparent;
}
.wcfg-checkbox-group::-webkit-scrollbar { width: 4px; }
.wcfg-checkbox-group::-webkit-scrollbar-thumb { background: var(--wcfg-border-dark); border-radius: 2px; }

.wcfg-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13.5px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 7px;
    color: var(--wcfg-text);
    user-select: none;
    transition: background var(--wcfg-transition);
}
.wcfg-checkbox-label:hover { background: var(--wcfg-bg-subtle); }
.wcfg-checkbox-label.is-checked { background: var(--wcfg-accent-light); }

.wcfg-checkbox-label-inner {
    display: flex;
    align-items: center;
    gap: 9px;
}

.wcfg-checkbox-wrap {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.wcfg-checkmark {
    display: block;
    width: 18px;
    height: 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    transition: border-color var(--wcfg-transition), background var(--wcfg-transition);
    position: relative;
}
.wcfg-checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.12s;
}
.wcfg-checkbox-wrap input:checked + .wcfg-checkmark {
    background: var(--wcfg-accent);
    border-color: var(--wcfg-accent);
}
.wcfg-checkbox-wrap input:checked + .wcfg-checkmark::after { opacity: 1; }

.wcfg-term-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--wcfg-text-faint);
    background: var(--wcfg-bg-subtle);
    border: 1px solid var(--wcfg-border-dark);
    border-radius: 20px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: all var(--wcfg-transition);
}
.wcfg-checkbox-label.is-checked .wcfg-term-count {
    background: rgba(var(--wcfg-accent-rgb),0.15);
    border-color: rgba(var(--wcfg-accent-rgb),0.25);
    color: var(--wcfg-accent);
}

/* ── Sub-category indent ── */
.wcfg-cat-child { position: relative; }
.wcfg-cat-depth-1 { margin-left: 18px; }
.wcfg-cat-depth-2 { margin-left: 36px; }
.wcfg-cat-depth-3 { margin-left: 54px; }
.wcfg-cat-depth-4 { margin-left: 72px; }
.wcfg-cat-child .wcfg-checkbox-label-inner { font-size: 13px; color: var(--wcfg-text-muted); }
.wcfg-cat-child.is-checked .wcfg-checkbox-label-inner { color: var(--wcfg-text); }
.wcfg-cat-child::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 50%;
    width: 7px;
    height: 1px;
    background: var(--wcfg-border-dark);
}
.wcfg-cat-parent > .wcfg-checkbox-label-inner { font-weight: 600; }

/* ── Price Range ── */
.wcfg-price-display {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.wcfg-price-pill {
    flex: 1;
    background: var(--wcfg-bg-subtle);
    border: 1px solid var(--wcfg-border-dark);
    border-radius: 8px;
    padding: 7px 10px;
    text-align: center;
}
.wcfg-price-pill-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wcfg-text-faint);
    font-weight: 600;
    margin-bottom: 2px;
}
.wcfg-price-pill-value {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--wcfg-text);
}

.wcfg-range-wrap {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    margin: 0 2px;
}

.wcfg-range-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--wcfg-border-dark);
    border-radius: 2px;
    pointer-events: none;
}

.wcfg-range-fill {
    position: absolute;
    height: 100%;
    background: var(--wcfg-accent);
    border-radius: 2px;
}

.wcfg-range {
    position: absolute;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: transparent;
    pointer-events: none;
    outline: none;
    margin: 0;
    padding: 0;
}

.wcfg-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wcfg-accent);
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(var(--wcfg-accent-rgb),0.4);
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.15s, box-shadow 0.15s;
}
.wcfg-range::-webkit-slider-thumb:hover,
.wcfg-range::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 2px 10px rgba(var(--wcfg-accent-rgb),0.5);
}
.wcfg-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wcfg-accent);
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(var(--wcfg-accent-rgb),0.4);
    cursor: pointer;
    pointer-events: all;
}

/* ── Apply button ── */
.wcfg-sidebar-actions {
    padding: 16px 20px 20px;
}

.wcfg-apply-btn {
    width: 100%;
    background: var(--wcfg-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 700;
    font-family: var(--wcfg-font);
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background var(--wcfg-transition), transform 0.1s, box-shadow var(--wcfg-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 2px 8px rgba(var(--wcfg-accent-rgb), 0.35);
}
.wcfg-apply-btn:hover {
    background: var(--wcfg-accent-dark);
    box-shadow: 0 4px 16px rgba(var(--wcfg-accent-rgb), 0.4);
}
.wcfg-apply-btn:active { transform: scale(0.98); }

/* ════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════ */
.wcfg-main-content { flex: 1; min-width: 0; }

.wcfg-results-bar {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.wcfg-results-count {
    margin: 0;
    font-size: 13px;
    color: var(--wcfg-text-muted);
    font-weight: 500;
}



/* ── Product Grid ── */
.wcfg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    transition: opacity 0.25s ease;
}
.wcfg-grid.is-loading { opacity: 0.45; pointer-events: none; }

/* ── Product Card ── */
.wcfg-product-card {
    position: relative;
    background: var(--wcfg-bg);
    border: 1px solid var(--wcfg-border);
    border-radius: var(--wcfg-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--wcfg-shadow);
    transition: box-shadow var(--wcfg-transition), transform var(--wcfg-transition), border-color var(--wcfg-transition);
}
.wcfg-product-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.10);
    transform: translateY(-3px);
    border-color: var(--wcfg-border-dark);
}

.wcfg-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 14px 0;
}

.wcfg-product-image {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--wcfg-bg-subtle);
    aspect-ratio: 1;
    margin-bottom: 12px;
}
.wcfg-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}
.wcfg-product-card:hover .wcfg-product-image img { transform: scale(1.04); }

.wcfg-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    z-index: 1;
}
.wcfg-badge--new  { background: #3b82f6; color: #fff; }
.wcfg-badge--sale { background: #ef4444; color: #fff; }

.wcfg-product-card > .wcfg-favorite-button {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--wcfg-border-dark);
    border-radius: 50%;
    background: var(--wcfg-bg);
    color: var(--wcfg-accent-dark);
    box-shadow: var(--wcfg-shadow);
    cursor: pointer;
}
.wcfg-product-card > .wcfg-favorite-button[hidden] { display: none; }
.wcfg-product-card > .wcfg-favorite-button:hover,
.wcfg-product-card > .wcfg-favorite-button[aria-pressed="true"] {
    border-color: var(--wcfg-accent);
    background: var(--wcfg-accent-light);
    color: var(--wcfg-accent-dark);
}
.wcfg-product-card > .wcfg-favorite-button:focus-visible {
    outline: 2px solid var(--wcfg-accent-dark);
    outline-offset: 2px;
}
.wcfg-product-card > .wcfg-favorite-button[aria-disabled="true"] { cursor: wait; }
.wcfg-favorite-button .bpsp-heart-icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
    pointer-events: none;
}
.wcfg-favorite-button[aria-pressed="true"] .bpsp-heart-icon { fill: currentColor; }
.wcfg-favorites-status { margin: 0 0 12px; color: var(--wcfg-accent-dark); font-size: 13px; }
.wcfg-favorites-status:empty { margin: 0; }

.wcfg-product-cat {
    margin: 0 0 4px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--wcfg-accent);
    font-weight: 700;
}

.wcfg-product-title {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--wcfg-text);
}

.wcfg-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--wcfg-border);
    margin-top: auto;
    gap: 8px;
}

.wcfg-price {
    font-weight: 700;
    font-size: 14px;
    color: var(--wcfg-text);
    white-space: nowrap;
}
.wcfg-price del { color: #9ca3af; font-weight: 400; margin-right: 4px; font-size: 12px; }
.wcfg-price ins { text-decoration: none; color: var(--wcfg-accent); }

.wcfg-product-footer .button,
.wcfg-product-footer .add_to_cart_button {
    background: var(--wcfg-accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--wcfg-font);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--wcfg-transition);
    line-height: 1;
}
.wcfg-product-footer .button:hover,
.wcfg-product-footer .add_to_cart_button:hover {
    background: var(--wcfg-accent-dark);
}

/* ── Loading spinner ── */
.wcfg-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}
.wcfg-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--wcfg-border-dark);
    border-top-color: var(--wcfg-accent);
    border-radius: 50%;
    animation: wcfg-spin 0.7s linear infinite;
}
@keyframes wcfg-spin { to { transform: rotate(360deg); } }

/* ── No results ── */
.wcfg-no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--wcfg-text-muted);
    gap: 14px;
    text-align: center;
}
.wcfg-no-results p { margin: 0; font-size: 15px; }

/* ── Pagination ── */
.wcfg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.wcfg-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--wcfg-border-dark);
    border-radius: 8px;
    background: #fff;
    color: var(--wcfg-text);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--wcfg-font);
    cursor: pointer;
    transition: all var(--wcfg-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wcfg-page-btn:hover    { border-color: var(--wcfg-accent); color: var(--wcfg-accent); background: var(--wcfg-accent-light); }
.wcfg-page-btn.is-active {
    background: var(--wcfg-accent);
    border-color: var(--wcfg-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--wcfg-accent-rgb),0.3);
}
.wcfg-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .wcfg-container { flex-direction: column; }
    .wcfg-sidebar { width: 100%; }
    .wcfg-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (max-width: 640px) {
    .wcfg-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
    .wcfg-grid { grid-template-columns: 1fr; }
}
