/* FPRO Product Filter — Frontend */
:root {
    --fpro-primary: #0073aa;
    --fpro-primary-dark: #005f8d;
    --fpro-border: #ddd;
    --fpro-bg: #fff;
    --fpro-text: #333;
    --fpro-muted: #999;
    --fpro-radius: 6px;
    --fpro-transition: .2s ease;
}

/* Wrapper */
.fpro-pf-wrapper {
    position: relative;
    font-size: 14px;
    color: var(--fpro-text);
    line-height: 1.5;
}

/* Loading overlay */
.fpro-pf-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--fpro-radius);
}
.fpro-pf-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--fpro-border);
    border-top-color: var(--fpro-primary);
    border-radius: 50%;
    animation: fpro-spin .6s linear infinite;
}
@keyframes fpro-spin { to { transform: rotate(360deg); } }

/* Sections */
.fpro-pf-section {
    border: 1px solid var(--fpro-border);
    border-radius: var(--fpro-radius);
    margin-bottom: 12px;
    background: var(--fpro-bg);
    overflow: hidden;
}
.fpro-pf-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
}
.fpro-pf-section--collapsible .fpro-pf-section__header {
    cursor: pointer;
    transition: background var(--fpro-transition);
}
.fpro-pf-section--collapsible .fpro-pf-section__header:hover {
    background: #f9f9f9;
}
.fpro-pf-section__toggle {
    position: relative;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fpro-pf-section__toggle::after {
    content: '\25BE';
    font-size: 14px;
    transition: transform var(--fpro-transition);
    display: inline-block;
}
.fpro-pf-section--collapsible .fpro-pf-section__header:hover .fpro-pf-section__toggle::after {
    color: var(--fpro-primary);
}
.fpro-pf-section__body {
    padding: 8px 14px 14px;
    border-top: 1px solid transparent;
    transition: border-color var(--fpro-transition);
}
.fpro-pf-section--collapsed .fpro-pf-section__body {
    display: none;
}
.fpro-pf-section--collapsed .fpro-pf-section__toggle::after {
    transform: rotate(-90deg);
}
.fpro-pf-section--collapsed .fpro-pf-section__body {
    border-top-color: var(--fpro-border);
}

/* Multi-column layout for section body */
.fpro-pf-section__body--columns {
    display: grid;
    gap: 8px;
}
.fpro-pf-section__body--columns.fpro-pf-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}
.fpro-pf-section__body--columns.fpro-pf-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}
.fpro-pf-section__body--columns.fpro-pf-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}
.fpro-pf-section__body--columns.fpro-pf-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}
.fpro-pf-section__body--columns.fpro-pf-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Scrollable section body */
.fpro-pf-section__body[style*="max-height"] {
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Custom scrollbar styling */
.fpro-pf-section__body::-webkit-scrollbar {
    width: 6px;
}
.fpro-pf-section__body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.fpro-pf-section__body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}
.fpro-pf-section__body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive: collapse to fewer columns on smaller screens */
@media (max-width: 768px) {
    .fpro-pf-section__body--columns.fpro-pf-columns-4,
    .fpro-pf-section__body--columns.fpro-pf-columns-5,
    .fpro-pf-section__body--columns.fpro-pf-columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 480px) {
    .fpro-pf-section__body--columns {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Checkbox */
.fpro-pf-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background var(--fpro-transition);
    line-height: 1.4;
}
.fpro-pf-checkbox:hover {
    background: #f5f5f5;
}
.fpro-pf-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.fpro-pf-checkbox__mark {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--fpro-border);
    border-radius: 3px;
    position: relative;
    transition: all var(--fpro-transition);
    margin-top: 1px;
}
.fpro-pf-checkbox input:checked + .fpro-pf-checkbox__mark {
    background: var(--fpro-primary);
    border-color: var(--fpro-primary);
}
.fpro-pf-checkbox input:checked + .fpro-pf-checkbox__mark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Long text handling in checkboxes */
.fpro-pf-checkbox {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Radio */
.fpro-pf-radio {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background var(--fpro-transition);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.fpro-pf-radio:hover {
    background: #f5f5f5;
}
.fpro-pf-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.fpro-pf-radio__mark {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--fpro-border);
    border-radius: 50%;
    position: relative;
    transition: all var(--fpro-transition);
    margin-top: 1px;
}
.fpro-pf-radio input:checked + .fpro-pf-radio__mark {
    border-color: var(--fpro-primary);
}
.fpro-pf-radio input:checked + .fpro-pf-radio__mark::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: var(--fpro-primary);
    border-radius: 50%;
}

/* Color swatches */
.fpro-pf-swatch {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background var(--fpro-transition);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.fpro-pf-swatch:hover {
    background: #f5f5f5;
}
.fpro-pf-swatch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.fpro-pf-swatch__circle {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--fpro-border);
    transition: border-color var(--fpro-transition), box-shadow var(--fpro-transition);
}
.fpro-pf-swatch input:checked ~ .fpro-pf-swatch__circle {
    border-color: var(--fpro-primary);
    box-shadow: 0 0 0 2px var(--fpro-primary);
}

/* Count badge */
.fpro-pf-count {
    color: var(--fpro-muted);
    font-size: 12px;
    margin-left: 2px;
}

/* Price slider */
.fpro-pf-price-slider {
    margin: 10px 6px 6px;
}
.fpro-pf-price-slider .noUi-connect {
    background: var(--fpro-primary);
}
.fpro-pf-price-slider .noUi-handle {
    border-color: var(--fpro-primary);
    box-shadow: none;
}
.fpro-pf-price-values {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--fpro-muted);
    margin-top: 6px;
    padding: 0 6px;
}

/* Active filter badges */
.fpro-pf-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}
.fpro-pf-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fpro-pf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--fpro-primary);
    color: #fff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.fpro-pf-badge__close {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: .8;
    margin-left: 2px;
}
.fpro-pf-badge__close:hover {
    opacity: 1;
}
.fpro-pf-clear-all {
    background: none;
    border: none;
    color: var(--fpro-primary);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.fpro-pf-clear-all:hover {
    color: var(--fpro-primary-dark);
}

/* Found counter */
.fpro-pf-found {
    text-align: center;
    font-size: 13px;
    color: var(--fpro-muted);
    padding: 8px 0;
}

/* Buttons */
.fpro-pf-buttons {
    display: flex;
    gap: 8px;
    padding-top: 8px;
}
.fpro-pf-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--fpro-radius);
    cursor: pointer;
    transition: all var(--fpro-transition);
    text-align: center;
}
.fpro-pf-btn--apply {
    background: var(--fpro-primary);
    color: #fff;
}
.fpro-pf-btn--apply:hover {
    background: var(--fpro-primary-dark);
}
.fpro-pf-btn--apply:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.fpro-pf-btn--reset {
    background: #f0f0f0;
    color: var(--fpro-text);
}
.fpro-pf-btn--reset:hover {
    background: #e0e0e0;
}

/* Muted text */
.fpro-pf-muted {
    color: var(--fpro-muted);
    font-size: 13px;
    margin: 0;
}

/* Pagination */
.fpro-pf-pagination,
.woocommerce-pagination {
    text-align: center;
    margin: 20px 0;
}
.fpro-pf-pagination .page-numbers,
.woocommerce-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.fpro-pf-pagination .page-numbers li,
.woocommerce-pagination .page-numbers li {
    display: inline-block;
}
.fpro-pf-pagination a.page-numbers,
.fpro-pf-pagination span.page-numbers,
.woocommerce-pagination a.page-numbers,
.woocommerce-pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--fpro-border);
    border-radius: var(--fpro-radius);
    color: var(--fpro-text);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--fpro-transition);
}
.fpro-pf-pagination a.page-numbers:hover,
.woocommerce-pagination a.page-numbers:hover {
    background: var(--fpro-primary);
    border-color: var(--fpro-primary);
    color: #fff;
}
.fpro-pf-pagination span.current,
.woocommerce-pagination span.current {
    background: var(--fpro-primary);
    border-color: var(--fpro-primary);
    color: #fff;
    font-weight: 600;
}

/* SEO / LSI Links — hidden behind "Ещё..." */
.fpro-pf-lsi-more {
    margin-top: 4px;
}
.fpro-pf-lsi-toggle {
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--fpro-muted);
    transition: color var(--fpro-transition);
}
.fpro-pf-lsi-toggle:hover {
    color: var(--fpro-text);
}
.fpro-pf-lsi-toggle--open {
    color: var(--fpro-primary);
}
.fpro-pf-seo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    color: var(--fpro-muted);
    text-decoration: none;
    font-size: 13px;
    opacity: .55;
    pointer-events: none;
    cursor: default;
}
.fpro-pf-seo-link .fpro-pf-checkbox__mark {
    border-color: #ccc;
}
