/* FiltersPopup — кнопка-воронка и popup с фильтрами */

.filters-popup-btn {
    position: relative;
}

.filters-popup-btn .filters-popup-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent, #f5a623);
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* Пульсация — когда применён хотя бы один фильтр */
.filters-popup-btn--active {
    color: var(--accent, #f5a623) !important;
    border-color: rgba(245, 166, 35, 0.4) !important;
    animation: filtersPopupPulse 1.8s ease-in-out infinite;
}

@keyframes filtersPopupPulse {
    0%, 100% {
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.5),
            0 0 0 0 rgba(245, 166, 35, 0.45);
    }
    50% {
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.5),
            0 0 0 6px rgba(245, 166, 35, 0);
    }
}

.filters-popup-btn--open {
    color: #fff !important;
    background: #2b2b30 !important;
}

/* Popup */
.filters-popup {
    position: fixed;
    z-index: 2000;
    background: var(--panelbg, #1f1f24);
    border: 1px solid rgba(75, 75, 90, 0.5);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
    color: #e5e5ea;
    font-size: 12px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.filters-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(75, 75, 90, 0.4);
    background: rgba(255, 255, 255, 0.02);
}

.filters-popup-title {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.filters-popup-result-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent, #f5a623);
    font-variant-numeric: tabular-nums;
}

.filters-popup-reset {
    background: transparent;
    border: none;
    color: var(--accent, #f5a623);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.filters-popup-reset:hover {
    background: rgba(245, 166, 35, 0.1);
}

.filters-popup-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filters-popup-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filters-popup-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #9a9aa6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filters-popup-section-body {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Секция с иконочными radio: title слева, кнопки справа в одной строке. */
.filters-popup-section:has(.filters-popup-section-body--icons) {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.filters-popup-section:has(.filters-popup-section-body--icons) .filters-popup-section-title {
    flex-shrink: 0;
    min-width: 0;
}

.filters-popup-section-body--icons {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    min-width: 0;
}

.filters-popup-radio--icon {
    padding: 4px 6px;
    gap: 4px;
}

.filters-popup-radio--icon span {
    display: none;
}

/* Прячем нативный кружок ввода — активное состояние видно по подсветке фона. */
.filters-popup-radio--icon input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.filters-popup-section-body--checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 6px;
}

.filters-popup-section-body--checkboxes .filters-popup-checkbox {
    min-width: 0;
}

.filters-popup-section-body--checkboxes .filters-popup-checkbox span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Модели — в одну колонку, чтобы длинные названия помещались целиком. */
.filters-popup-section[data-section="model"] .filters-popup-section-body--checkboxes {
    grid-template-columns: 1fr;
}

.filters-popup-section[data-section="model"] .filters-popup-checkbox span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.filters-popup-radio,
.filters-popup-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    color: #cfcfd6;
    font-size: 12px;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}

.filters-popup-radio {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(75, 75, 90, 0.35);
}

.filters-popup-radio:hover,
.filters-popup-checkbox:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.filters-popup-radio input,
.filters-popup-checkbox input {
    accent-color: var(--accent, #f5a623);
    cursor: pointer;
    margin: 0;
}

.filters-popup-radio:has(input:checked) {
    background: rgba(245, 166, 35, 0.12);
    border-color: rgba(245, 166, 35, 0.5);
    color: #fff;
}

.filters-popup-checkbox:has(input:checked) {
    color: #fff;
}

.filters-popup-count {
    font-style: normal;
    font-size: 10px;
    color: #7a7a86;
    margin-left: auto;
    padding-left: 4px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.filters-popup-radio:has(input:checked) .filters-popup-count,
.filters-popup-checkbox:has(input:checked) .filters-popup-count {
    color: var(--accent, #f5a623);
}

.filters-popup-radio--zero,
.filters-popup-checkbox--zero {
    opacity: 0.4;
}

.filters-popup-radio--zero:hover,
.filters-popup-checkbox--zero:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #cfcfd6;
    cursor: not-allowed;
}

.filters-popup-radio--zero .filters-popup-count,
.filters-popup-checkbox--zero .filters-popup-count {
    color: #555;
}

.filters-popup-loading {
    display: flex;
    justify-content: center;
    padding: 16px 0;
    color: #9a9aa6;
}

.filters-popup-empty {
    padding: 12px 0;
    text-align: center;
    color: #7a7a86;
    font-size: 11px;
}
