/**
 * Bee1 Ajax Filters — Frontend CSS
 * Clean, minimal, RTL-ready. No heavy framework.
 *
 * @package Bee1AjaxFilters
 */

/* ── Variables ── */
:root {
    --b1f-accent: #e85c0d;
    --b1f-accent-light: #fdf0e8;
    --b1f-border: #e0e0e0;
    --b1f-text: #333;
    --b1f-muted: #888;
    --b1f-radius: 4px;
    --b1f-transition: 0.18s ease;
    --b1f-check-size: 16px;
    --b1f-swatch-size: 28px;
    --b1f-color-cell-min: 48px;
}

/* ── Wrapper ── */
.bee1-filters {
    font-size: 14px;
    color: var(--b1f-text);
    line-height: 1.5;
}

/* ── Single filter panel ── */
.bee1-filter {
    margin-bottom: 24px;
}

.bee1-filter__title {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--b1f-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
    color: var(--b1f-text);
}

/* ── Checkbox / radio / color list ── */
.bee1-filter__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bee1-filter__item {
    margin-bottom: 6px;
}

.bee1-filter__item a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--b1f-text);
    text-decoration: none;
    transition: color var(--b1f-transition);
    padding: 2px 0;
    cursor: pointer;
}

.bee1-filter__item a::before {
    content: '';
    display: inline-block;
    width: var(--b1f-check-size);
    height: var(--b1f-check-size);
    border: 1.5px solid var(--b1f-border);
    border-radius: var(--b1f-radius);
    flex-shrink: 0;
    background: #fff;
    transition: border-color var(--b1f-transition), background var(--b1f-transition);
}

.bee1-filter__item.is-active a::before {
    background: var(--b1f-accent);
    border-color: var(--b1f-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpolyline points='1,5 4,8 11,1' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

.bee1-filter__item a:hover {
    color: var(--b1f-accent);
}

.bee1-filter__item a:hover::before {
    border-color: var(--b1f-accent);
}

.bee1-filter__item.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Radio */
.bee1-filter__item--radio a::before {
    border-radius: 50%;
}

.bee1-filter__item--radio.is-active a::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3' fill='white'/%3E%3C/svg%3E");
    background-size: 10px;
}

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

/* ── Color swatches ── */
.bee1-filter--color .bee1-filter__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--b1f-color-cell-min), 1fr));
    gap: 8px;
    align-items: start;
}

.bee1-filter__item--color {
    margin: 0;
    min-width: 0;
}

.bee1-filter__item--color a {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    text-align: center;
}

.bee1-filter__item--color a::before {
    display: none;
}

.bee1-swatch {
    display: block;
    width: var(--b1f-swatch-size);
    height: var(--b1f-swatch-size);
    border-radius: 4px;
    border: 2px solid var(--b1f-border);
    transition: border-color var(--b1f-transition), transform var(--b1f-transition);
    background: #ccc;
}

.bee1-filter__list--color-square .bee1-swatch {
    border-radius: 4px;
}

.bee1-filter__list--color-round .bee1-swatch {
    border-radius: 4px;
}

.bee1-filter__item--color.is-active .bee1-swatch {
    border-color: var(--b1f-accent);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--b1f-accent-light);
}

.bee1-filter__item--color a:hover .bee1-swatch {
    border-color: var(--b1f-accent);
}

.bee1-swatch-label {
    font-size: 11px;
    color: var(--b1f-muted);
    width: 100%;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

/* ── Select dropdown ── */
.bee1-filter__select {
    width: 100%;
    border: 1px solid var(--b1f-border);
    border-radius: var(--b1f-radius);
    padding: 6px 10px;
    font-size: 14px;
    color: var(--b1f-text);
    background: #fff;
    cursor: pointer;
}

.bee1-filter__select:focus {
    outline: 2px solid var(--b1f-accent);
    border-color: var(--b1f-accent);
}

/* ── Price slider ── */
.bee1-price-slider {
    padding: 8px 0;
}

.bee1-price-slider__track {
    position: relative;
    height: 4px;
    background: var(--b1f-border);
    border-radius: 2px;
    margin: 24px 8px;
}

.bee1-price-slider__fill {
    position: absolute;
    height: 100%;
    background: var(--b1f-accent);
    border-radius: 2px;
    pointer-events: none;
}

.bee1-price-slider__handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid var(--b1f-accent);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: box-shadow var(--b1f-transition);
    z-index: 2;
}

.bee1-price-slider__handle:active {
    cursor: grabbing;
    box-shadow: 0 2px 8px rgba(232, 92, 13, 0.3);
}

.bee1-price-slider__handle:focus-visible {
    outline: 2px solid var(--b1f-accent);
    outline-offset: 2px;
}

.bee1-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
}

.bee1-price-inputs input[type="number"] {
    width: 70px;
    border: 1px solid var(--b1f-border);
    border-radius: var(--b1f-radius);
    padding: 4px 6px;
    font-size: 13px;
    text-align: center;
}

.bee1-price-inputs input[type="number"]:focus {
    outline: 2px solid var(--b1f-accent);
    border-color: var(--b1f-accent);
}

.bee1-price-sep {
    color: var(--b1f-muted);
}

/* ── Rating filter ── */
.bee1-filter__item--rating a {
    font-size: 16px;
    letter-spacing: -1px;
    color: #f0a500;
}

.bee1-filter__item--rating a::before {
    display: none;
}

.bee1-filter__item--rating.is-active a {
    color: var(--b1f-accent);
}

/* ── Active filters bar ── */
.bee1-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--b1f-accent-light);
    border-radius: var(--b1f-radius);
    border: 1px solid #f3c9aa;
}

.bee1-active-filters__label {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--b1f-muted);
    margin-right: 4px;
}

.bee1-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--b1f-accent);
    color: #fff !important;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    text-decoration: none !important;
    transition: background var(--b1f-transition);
    line-height: 1.4;
}

.bee1-active-filter__tax {
    opacity: 0.75;
    font-weight: 400;
    font-size: 11px;
}

.bee1-active-filter:hover {
    background: #c44d08;
}

.bee1-active-filter--clear-all {
    background: var(--b1f-muted);
    margin-left: auto;
}

.bee1-active-filter--clear-all:hover {
    background: #555;
}

/* ── RTL ── */
[dir="rtl"] .bee1-count,
.rtl .bee1-count {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .bee1-price-inputs,
.rtl .bee1-price-inputs {
    direction: rtl;
}

[dir="rtl"] .bee1-active-filter--clear-all,
.rtl .bee1-active-filter--clear-all {
    margin-left: 0;
    margin-right: auto;
}

/* ── Collapse toggle ── */
.bee1-collapse-toggle {
    list-style: none;
    margin-top: 6px;
}

.bee1-collapse-toggle button {
    background: none;
    border: 1px solid var(--b1f-border);
    border-radius: var(--b1f-radius);
    color: var(--b1f-accent);
    cursor: pointer;
    font-size: 12px;
    padding: 3px 10px;
    transition: background var(--b1f-transition), color var(--b1f-transition);
}

.bee1-collapse-toggle button:hover {
    background: var(--b1f-accent-light);
    border-color: var(--b1f-accent);
}

/* ── Subcategory tree ── */
.bee1-filter__subtree {
    list-style: none;
    margin: 2px 0 4px 16px;
    padding: 0;
    border-right: 2px solid var(--b1f-border);
    padding-right: 8px;
}

.bee1-filter__subtree .bee1-filter__item {
    font-size: 13px;
}

[dir="rtl"] .bee1-filter__subtree,
.rtl .bee1-filter__subtree {
    margin: 2px 16px 4px 0;
    border-right: none;
    border-left: 2px solid var(--b1f-border);
    padding-right: 0;
    padding-left: 8px;
}

/* ── Loading state ── */
.bee1-filters.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.bee1-filters.is-loading::after {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--b1f-border);
    border-top-color: var(--b1f-accent);
    border-radius: 50%;
    animation: bee1-spin 0.7s linear infinite;
    margin: 12px auto;
}

@keyframes bee1-spin {
    to {
        transform: rotate(360deg);
    }
}
