/* ============================================================
   Woo Product Filters — Front-end Styles
   Author: Subhendu Pan
   ============================================================ */

.wpf-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    font-size: 14px;
    position: relative;
}

/* ----------------------------------------------------------
   Panel header
---------------------------------------------------------- */
.wpf-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}
.wpf-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111827;
}
.wpf-panel-title svg { color: #6b7280; }
.wpf-clear-all {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .15s;
}
.wpf-clear-all:hover { background: #fef2f2; }

/* ----------------------------------------------------------
   Filter groups (accordion)
---------------------------------------------------------- */
.wpf-group {
    border-bottom: 1px solid #f0f0f0;
}
.wpf-group:last-child { border-bottom: none; }

.wpf-group-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
}
.wpf-group-head:hover { color: #111827; }
.wpf-chevron {
    color: #9ca3af;
    transition: transform .2s ease;
    flex-shrink: 0;
}
.wpf-group.wpf-collapsed .wpf-chevron { transform: rotate(-90deg); }

.wpf-group-body {
    padding: 0 18px 16px;
    max-height: 260px;
    overflow-y: auto;
}
.wpf-group.wpf-collapsed .wpf-group-body { display: none; }

/* Custom scrollbar */
.wpf-group-body::-webkit-scrollbar { width: 5px; }
.wpf-group-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ----------------------------------------------------------
   Checkboxes
---------------------------------------------------------- */
.wpf-check {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 0;
    cursor: pointer;
    user-select: none;
}
.wpf-check input { display: none; }
.wpf-check-box {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    flex-shrink: 0;
    position: relative;
    transition: all .15s;
}
.wpf-check input:checked + .wpf-check-box {
    background: #2271b1;
    border-color: #2271b1;
}
.wpf-check input:checked + .wpf-check-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.wpf-check-label {
    flex: 1;
    color: #374151;
    font-size: 13px;
}
.wpf-check:hover .wpf-check-label { color: #111827; }
.wpf-count {
    font-size: 11px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 1px 7px;
    border-radius: 10px;
}

/* ----------------------------------------------------------
   Price range slider
---------------------------------------------------------- */
.wpf-price-slider { padding-top: 6px; }
.wpf-slider-track {
    position: relative;
    height: 4px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: 16px 8px 8px;
}
.wpf-slider-range {
    position: absolute;
    height: 100%;
    background: #2271b1;
    border-radius: 4px;
}
.wpf-slider-input {
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 20px;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}
.wpf-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #2271b1;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.wpf-slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #2271b1;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.wpf-price-values {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}
.wpf-price-from, .wpf-price-to {
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ----------------------------------------------------------
   Colour swatches
---------------------------------------------------------- */
.wpf-swatches {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.wpf-swatch {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 0;
    cursor: pointer;
}
.wpf-swatch input { display: none; }
.wpf-swatch-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
    position: relative;
    transition: all .15s;
}
.wpf-swatch input:checked + .wpf-swatch-dot {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2271b1;
}
.wpf-swatch input:checked + .wpf-swatch-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 7px;
    height: 7px;
}
.wpf-swatch-name {
    font-size: 13px;
    color: #374151;
}
.wpf-swatch:hover .wpf-swatch-name { color: #111827; }

/* ----------------------------------------------------------
   Size grid
---------------------------------------------------------- */
.wpf-size-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}
.wpf-size-btn { cursor: pointer; }
.wpf-size-btn input { display: none; }
.wpf-size-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    transition: all .15s;
}
.wpf-size-btn:hover span { border-color: #9ca3af; }
.wpf-size-btn input:checked + span {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* ----------------------------------------------------------
   In Stock toggle
---------------------------------------------------------- */
.wpf-group--stock { padding: 13px 18px; }
.wpf-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.wpf-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}
.wpf-toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
}
.wpf-toggle-switch input { display: none; }
.wpf-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background .2s;
}
.wpf-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.wpf-toggle-switch input:checked + .wpf-toggle-slider {
    background: #2271b1;
}
.wpf-toggle-switch input:checked + .wpf-toggle-slider::before {
    transform: translateX(18px);
}

/* ----------------------------------------------------------
   Loading overlay
---------------------------------------------------------- */
.wpf-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    font-size: 13px;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.wpf-loading.active { display: flex; }
.wpf-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wpf-spin .7s linear infinite;
}
@keyframes wpf-spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------
   No results
---------------------------------------------------------- */
.wpf-no-results {
    text-align: center;
    padding: 60px 20px;
    width: 100%;
}
.wpf-no-results svg { margin-bottom: 12px; }
.wpf-no-results p {
    margin: 0 0 4px;
    font-size: 16px;
    color: #6b7280;
}
.wpf-no-results-hint {
    font-size: 13px !important;
    color: #9ca3af !important;
}

/* ----------------------------------------------------------
   Result count bar (injected by JS above the grid)
---------------------------------------------------------- */
.wpf-result-count {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 14px;
}
.wpf-result-count strong { color: #111827; }

/* Active-filter chips */
.wpf-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.wpf-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eff6ff;
    color: #2271b1;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px 4px 10px;
    border-radius: 16px;
}
.wpf-chip button {
    background: none;
    border: none;
    color: #2271b1;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
}
.wpf-chip button:hover { color: #ef4444; }

/* Fade products while loading */
.wpf-products-loading {
    opacity: .45;
    pointer-events: none;
    transition: opacity .15s;
}

/* ----------------------------------------------------------
   Mobile — collapsible panel
---------------------------------------------------------- */
.wpf-mobile-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 14px;
}
@media (max-width: 768px) {
    .wpf-mobile-toggle { display: flex; }
    .wpf-panel.wpf-mobile-hidden { display: none; }
}
