/* ── 3-column grid: result count | slider | ordering ─────────── */
.kcp-shop-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 16px;
    width: 100%;
    margin-bottom: 20px;
}

/* Result count — left-aligned inside its column */
.kcp-shop-controls .woocommerce-result-count {
    justify-self: start;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    font-size: 13px;
}

/* Ordering form — right-aligned inside its column */
.kcp-shop-controls .woocommerce-ordering {
    justify-self: end;
    margin: 0;
}

/* ── Price filter — centre column, fixed width ────────────────── */
.kcp-price-filter {
    width: 350px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0;
}

/* Price labels: $0 — $999 */
.kcp-price-fields {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.kcp-price-min,
.kcp-price-max {
    font-weight: 600;
    color: #fff;
}

.kcp-price-sep {
    color: rgba(255, 255, 255, 0.6);
}

/* ── jQuery UI slider track ──────────────────────────────────── */
#kcp-price-slider {
    flex: 1 1 0;
    min-width: 80px;
    height: 4px;
    border-radius: 4px;
    background: #ddd;
    border: none;
    position: relative;
    overflow: visible;
    margin: 9px 0;     /* vertical room so handles don't clip */
    cursor: pointer;
}

/* Filled range between the two handles */
#kcp-price-slider .ui-slider-range {
    position: absolute;
    height: 100%;
    border-radius: 4px;
    background: var(--e-global-color-primary, #1a1a1a);
    border: none;
}

/* Drag handles */
#kcp-price-slider .ui-slider-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--e-global-color-primary, #1a1a1a);
    top: 50%;
    transform: translateY(-50%);
    margin-left: -8px;
    cursor: grab;
    outline: none;
    transition: box-shadow 0.15s ease;
    z-index: 2;
}

#kcp-price-slider .ui-slider-handle:active {
    cursor: grabbing;
}

#kcp-price-slider .ui-slider-handle:focus,
#kcp-price-slider .ui-slider-handle:hover {
    box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.12);
}

/* ── Loading state ───────────────────────────────────────────── */
.woocommerce {
    position: relative;
}

.kcp-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99;
    pointer-events: none;
}

.kcp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e5e5;
    border-top-color: var(--e-global-color-primary, #1a1a1a);
    border-radius: 50%;
    animation: kcpSpin 0.65s linear infinite;
}

@keyframes kcpSpin {
    to { transform: rotate(360deg); }
}

/* ── Responsive: stack below 600px ──────────────────────────── */
@media (max-width: 600px) {
    .kcp-shop-controls {
        grid-template-columns: 1fr 1fr;
        row-gap: 12px;
    }

    /* Result count: top-left, ordering: top-right */
    .kcp-shop-controls .woocommerce-result-count {
        grid-column: 1;
        grid-row: 1;
    }

    .kcp-shop-controls .woocommerce-ordering {
        grid-column: 2;
        grid-row: 1;
    }

    /* Slider: full width on second row */
    .kcp-price-filter {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }
}
