/**
 * Pimberly Filter Engine — Frontend Styles
 */

/* ---- FILTER PANEL ---- */
.pim-filters {
    font-family: inherit;
    font-size: 13px;
}

.pim-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 12px;
    border-bottom: 2px solid var(--pim-accent, #c0392b);
    margin-bottom: 16px;
    font-weight: 700;
    font-size: 14px;
    color: var(--pim-accent, #c0392b);
}

.pim-filter-clear {
    font-size: 11px;
    color: #999;
    background: none;
    border: 1px solid #ddd;
    border-radius: 2px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.pim-filter-clear:hover {
    color: var(--pim-accent, #c0392b);
    border-color: var(--pim-accent, #c0392b);
}

/* ---- FILTER GROUPS ---- */
.pim-filter-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.pim-filter-group:last-child {
    border-bottom: none;
}

.pim-filter-label {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #333;
    margin-bottom: 10px;
}

/* ---- SORT ---- */
.pim-filter-sort {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    background: #fff;
    color: #333;
    cursor: pointer;
}
.pim-filter-sort:focus {
    outline: none;
    border-color: var(--pim-accent, #c0392b);
}

/* ---- IN STOCK ---- */
.pim-filter-stock {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.pim-filter-stock input {
    accent-color: var(--pim-accent, #c0392b);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---- PRICE RANGE ---- */
.pim-price-display {
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.pim-range-wrap {
    position: relative;
    height: 20px;
}

.pim-range {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.pim-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pim-accent, #c0392b);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}
.pim-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.pim-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pim-accent, #c0392b);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Track styling via JS-set background */
.pim-range-track {
    position: absolute;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    pointer-events: none;
}
.pim-range-fill {
    position: absolute;
    height: 4px;
    background: var(--pim-accent, #c0392b);
    border-radius: 2px;
    top: 0;
    pointer-events: none;
}

/* ---- ATTRIBUTE GROUPS ---- */
.pim-attr-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.pim-attr-toggle:hover { color: var(--pim-accent, #c0392b); }

.pim-attr-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    color: #999;
}
.pim-attr-group.open .pim-attr-arrow {
    transform: rotate(180deg);
}

.pim-attr-options {
    display: none;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}
.pim-attr-group.open .pim-attr-options {
    display: block;
}

.pim-attr-option {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 12px;
    color: #444;
    line-height: 1.3;
}
.pim-attr-option:hover { color: var(--pim-accent, #c0392b); }

.pim-attr-option input {
    accent-color: var(--pim-accent, #c0392b);
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.pim-attr-name { flex: 1; }
.pim-attr-count { color: #aaa; font-size: 11px; }

.pim-attr-option.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ---- PRODUCT AREA ---- */
.pim-products-wrap {
    position: relative;
}

.pim-products-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.pim-products-loading.active { opacity: 1; pointer-events: all; }

.pim-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: var(--pim-accent, #c0392b);
    border-radius: 50%;
    animation: pim-spin 0.7s linear infinite;
}
@keyframes pim-spin { to { transform: rotate(360deg); } }

.pim-results-count {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.pim-pagination {
    margin-top: 24px;
}
.pim-pagination ul {
    display: flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}
.pim-pagination ul li,
.pim-pagination ul li:hover {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.pim-pagination a.page-numbers,
.pim-pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #ddd !important;
    border-radius: 3px;
    font-size: 13px;
    text-decoration: none;
    color: #333 !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    background: #fff !important;
}
.pim-pagination a.page-numbers:hover {
    background: var(--pim-accent, #c0392b) !important;
    border-color: var(--pim-accent, #c0392b) !important;
    color: #fff !important;
}
.pim-pagination span.page-numbers.current {
    background: var(--pim-accent, #c0392b) !important;
    border-color: var(--pim-accent, #c0392b) !important;
    color: #fff !important;
}

.pim-no-products {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* ---- TOOLBAR (results count + view toggle) ---- */
.pim-products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.pim-view-toggle {
    display: flex;
    gap: 4px;
}

.pim-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    color: #999;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.pim-view-btn:hover {
    border-color: var(--pim-accent, #c0392b);
    color: var(--pim-accent, #c0392b);
}

.pim-view-btn.active {
    background: var(--pim-accent, #c0392b);
    border-color: var(--pim-accent, #c0392b);
    color: #fff;
}

/* ---- LIST VIEW ---- */
.pim-product-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pim-list-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
}

.pim-list-row:last-child {
    border-bottom: none;
}

.pim-list-image {
    flex-shrink: 0;
    width: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 2px;
    overflow: hidden;
    align-self: stretch;
}

.pim-list-img {
    width: 130px;
    height: 110px;
    object-fit: contain;
    display: block;
}

.pim-list-body {
    flex: 1;
    min-width: 0;
}

.pim-list-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.3;
}

.pim-list-title a {
    text-decoration: none;
}

.pim-list-title a:hover {
    text-decoration: underline;
}

.pim-list-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

.pim-list-desc ul {
    margin: 4px 0 0 16px;
    padding: 0;
}

.pim-list-desc li {
    margin-bottom: 2px;
}

.pim-list-aside {
    flex-shrink: 0;
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 2px;
}

.pim-list-price {
    text-align: right;
}

.pim-list-price .woocommerce-Price-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--pim-accent, #c0392b);
    display: block;
    line-height: 1.2;
}

.pim-list-exvat {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.pim-list-exvat .woocommerce-Price-amount {
    font-size: 11px;
    font-weight: 400;
    color: #999;
    display: inline;
}

.pim-list-stock {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
}

.pim-list-instock {
    color: #2e7d32;
}

.pim-list-outofstock {
    color: #c0392b;
}

.pim-stock-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.pim-list-instock .pim-stock-icon {
    background: #2e7d32;
    color: #fff;
}

.pim-list-outofstock .pim-stock-icon {
    background: #c0392b;
    color: #fff;
}

.pim-list-atc {
    width: 100%;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 9px 12px;
    text-transform: uppercase;
}

/* Responsive — stack on mobile */
@media (max-width: 600px) {
    .pim-list-row {
        flex-wrap: wrap;
    }
    .pim-list-aside {
        width: 100%;
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* Remove focus outline on list title links */
.pim-list-title a:focus {
    outline: none;
}
