/* ===================================================
   WC Attribute Filter – Frontend Styles
   =================================================== */

:root {
    --wcaf-primary:    #1a1a2e;
    --wcaf-accent:     #e94560;
    --wcaf-light:      #f8f8f8;
    --wcaf-border:     #e2e2e2;
    --wcaf-text:       #333;
    --wcaf-muted:      #888;
    --wcaf-radius:     8px;
    --wcaf-transition: 0.2s ease;
}

/* Wrapper */
.wcaf-filter-wrap {
    background: #fff;
    border: 1px solid var(--wcaf-border);
    border-radius: var(--wcaf-radius);
    overflow: hidden;
    font-size: 14px;
    color: var(--wcaf-text);
}

/* Header */
.wcaf-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--wcaf-primary);
    color: #fff;
}

.wcaf-filter-title {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.wcaf-reset-btn {
    background: none;
    border: 1px solid rgba(255,255,255,.35);
    color: rgba(255,255,255,.85);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--wcaf-transition);
}
.wcaf-reset-btn:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}

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

.wcaf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--wcaf-primary);
    cursor: pointer;
    user-select: none;
    transition: background var(--wcaf-transition);
}
.wcaf-section-header:hover { background: var(--wcaf-light); }

.wcaf-toggle {
    font-size: 10px;
    transition: transform var(--wcaf-transition);
    color: var(--wcaf-muted);
}
.wcaf-section.collapsed .wcaf-toggle { transform: rotate(-90deg); }

.wcaf-section-body {
    padding: 4px 18px 14px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}
.wcaf-section.collapsed .wcaf-section-body {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* Price Slider */
.wcaf-price-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
}
.wcaf-price-label {
    display: flex;
    align-items: baseline;
    gap: 2px;
    background: var(--wcaf-light);
    border: 1px solid var(--wcaf-border);
    border-radius: 5px;
    padding: 4px 10px;
    min-width: 70px;
    justify-content: center;
}
.wcaf-currency { font-size: 11px; color: var(--wcaf-muted); }
.wcaf-price-sep { color: var(--wcaf-muted); }

/* Dual Range Slider */
.wcaf-range-wrap {
    position: relative;
    height: 36px;
    margin: 4px 0 4px;
}

.wcaf-range-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    background: var(--wcaf-border);
    border-radius: 2px;
    z-index: 1;
}

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

.wcaf-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
    margin: 0;
}
.wcaf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--wcaf-accent);
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    cursor: grab;
    pointer-events: all;
    transition: box-shadow var(--wcaf-transition), transform var(--wcaf-transition);
}
.wcaf-range::-webkit-slider-thumb:hover,
.wcaf-range::-webkit-slider-thumb:active {
    box-shadow: 0 0 0 5px rgba(233,69,96,.18);
    cursor: grabbing;
    transform: scale(1.12);
}
.wcaf-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--wcaf-accent);
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    cursor: grab;
    pointer-events: all;
}

/* Checkboxes */
.wcaf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: color var(--wcaf-transition);
}
.wcaf-checkbox-label:hover { color: var(--wcaf-accent); }

.wcaf-checkbox-wrap {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.wcaf-checkbox-wrap input {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.wcaf-checkmark {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--wcaf-border);
    border-radius: 4px;
    background: #fff;
    transition: border-color var(--wcaf-transition), background var(--wcaf-transition);
    position: relative;
}
.wcaf-checkbox-wrap input:checked ~ .wcaf-checkmark {
    background: var(--wcaf-accent);
    border-color: var(--wcaf-accent);
}
.wcaf-checkbox-wrap input:checked ~ .wcaf-checkmark::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 6px; height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Radio */
.wcaf-radio-mark {
    border-radius: 50%;
}
.wcaf-checkbox-wrap input:checked ~ .wcaf-radio-mark::after {
    width: 8px; height: 8px;
    left: 3px; top: 3px;
    border: none;
    background: #fff;
    border-radius: 50%;
    transform: none;
}

/* Count badge */
.wcaf-count {
    color: var(--wcaf-muted);
    font-size: 11px;
    margin-left: auto;
}

/* Color swatch */
.wcaf-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.12);
    flex-shrink: 0;
}

/* Stars */
.wcaf-stars { letter-spacing: 1px; }
.wcaf-star { color: var(--wcaf-border); }
.wcaf-star.filled { color: #f7a928; }

/* Apply button */
.wcaf-apply-btn {
    display: block;
    width: calc(100% - 36px);
    margin: 12px 18px 16px;
    padding: 11px;
    background: var(--wcaf-accent);
    color: #fff;
    border: none;
    border-radius: var(--wcaf-radius);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transition: opacity var(--wcaf-transition), transform var(--wcaf-transition);
}
.wcaf-apply-btn:hover {
    opacity: .88;
    transform: translateY(-1px);
}
.wcaf-apply-btn:active { transform: translateY(0); }

/* Loading overlay for products */
.wcaf-loading-overlay {
    position: relative;
    pointer-events: none;
    opacity: .5;
    transition: opacity .3s;
}

/* Select (multi) */
.wcaf-select {
    width: 100%;
    border: 1px solid var(--wcaf-border);
    border-radius: var(--wcaf-radius);
    padding: 4px 6px;
    font-size: 13px;
    color: var(--wcaf-text);
    background: #fff;
    outline: none;
    transition: border-color var(--wcaf-transition);
    cursor: pointer;
}
.wcaf-select:focus { border-color: var(--wcaf-accent); }
.wcaf-select option { padding: 4px 6px; }
.wcaf-select option:checked { background: var(--wcaf-accent); color: #fff; }
.wcaf-select-hint { margin: 5px 0 0; font-size: 11px; color: var(--wcaf-muted); }

/* Attr range */
.wcaf-attr-range-wrap { margin-top: 4px; }

/* ─── Grid layout (columns) ─── */

/* When using grid layout, remove per-section borders and reshape the wrapper */
.wcaf-layout-grid {
    /* remove side borders so the grid looks clean */
    border: none;
    background: transparent;
}

.wcaf-layout-grid .wcaf-filter-header {
    border-radius: var(--wcaf-radius);
    margin-bottom: 8px;
}

/* The sections grid */
.wcaf-layout-grid .wcaf-sections-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}

/* Column variants — set via PHP based on [columns] param */
.wcaf-cols-2 .wcaf-sections-grid { grid-template-columns: repeat(2, 1fr); }
.wcaf-cols-3 .wcaf-sections-grid { grid-template-columns: repeat(3, 1fr); }
.wcaf-cols-4 .wcaf-sections-grid { grid-template-columns: repeat(4, 1fr); }

/* Each section card in grid mode */
.wcaf-layout-grid .wcaf-section {
    border: 1px solid var(--wcaf-border);
    border-radius: var(--wcaf-radius);
    background: #fff;
    overflow: hidden;
}

/* Price section can span full width in grid */
.wcaf-layout-grid .wcaf-price-section {
    grid-column: 1 / -1;
}

/* Apply button full width in grid */
.wcaf-layout-grid .wcaf-apply-btn {
    width: 100%;
    margin: 0;
    border-radius: var(--wcaf-radius);
}

/* Responsive: stack to 1 col on narrow screens */
@media (max-width: 600px) {
    .wcaf-layout-grid .wcaf-sections-grid {
        grid-template-columns: 1fr !important;
    }
}
