/* Minimal clean design */
#catalog-categories-selector {
    background: #fff;
    margin-bottom: 20px;
    position: relative;
    z-index: 20;
}

.catalog-filters-toolbar {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 21;
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
    will-change: transform, opacity;
}

.catalog-filters-toolbar__inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.catalog-filters-toolbar__inner-container {
    width: 100%;
    position: relative;
}
div#products-header {
    margin-top: 1em;
}
.catalog-filters-toolbar.is-floating {
    position: fixed;
    z-index: 999;
    background: transparent;
    padding: 8px 0;
    transform: translateY(0);
    opacity: 1;
}

.catalog-filters-toolbar.is-floating::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    z-index: 0;
}

.catalog-filters-placeholder {
    display: none;
}

.catalog-filters-placeholder.is-active {
    display: block;
}

.catalog-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.catalog-filters-row-group {
    display: contents;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown.is-open {
    z-index: 1100;
}

#mobile-filter-sheet-root {
    display: contents;
}

.filter-dropdown__toggle {
    background: #f8f9fa;
    border: 1px solid #f8f9fa;
    border-radius: 10px;
    min-height: 42px;
    padding: 8px 14px;
    color: #2f3b45;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.filter-dropdown__toggle:hover {
    border-color: #00a8bb;
    color: #00a8bb;
    background: #f8fdff;
}

.filter-dropdown.is-open .filter-dropdown__toggle,
.filter-dropdown__toggle.has-selected {
    border-color: #00a8bb29;
    background: #00a8bb29;
}

.filter-dropdown__toggle.has-clear .filter-dropdown__clear {
    display: inline-flex;
}

.filter-dropdown__toggle.has-clear > i {
    display: none;
}

.filter-dropdown__label {
    font-weight: 600;
}

.filter-dropdown__meta {
    color: #6c757d;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-dropdown__toggle i {
    font-size: 12px;
    color: #00a8bb;
    transition: transform 0.2s ease;
}

.filter-dropdown__clear {
    width: 18px;
    height: 18px;
    display: none;
    position: relative;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #00a8bb1f;
    color: #00a8bb;
    flex: 0 0 18px;
    transition: all 0.2s ease;
}

.filter-dropdown__clear::before,
.filter-dropdown__clear::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 1.5px;
    background: currentColor;
    border-radius: 999px;
}

.filter-dropdown__clear::before {
    transform: rotate(45deg);
}

.filter-dropdown__clear::after {
    transform: rotate(-45deg);
}

.filter-dropdown__clear:hover {
    background: #00a8bb;
    color: #fff;
}

.filter-dropdown.is-open .filter-dropdown__toggle i {
    transform: rotate(180deg);
}

.filter-dropdown__menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    z-index: 1000;
}

.filter-dropdown.is-open .filter-dropdown__menu {
    display: block;
    z-index: 9999;
}

.filter-dropdown.is-open #brands-dropdown {
    display: flex !important;
    flex-direction: column !important;
}

.filter-sheet-header {
    display: none;
}

.filter-sheet-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.filter-sheet-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.filter-sheet-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.filter-dropdown__content {
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 8px;
    padding: 0;
    max-height: 320px;
    scrollbar-width: thin;
    scrollbar-color: #00a8bb #f8f9fa;
}

.filter-dropdown__content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.filter-dropdown__content::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 999px;
}

.filter-dropdown__content::-webkit-scrollbar-thumb {
    background: #00a8bb;
    border-radius: 999px;
}

.filter-dropdown__content--column {
    flex-direction: column;
    flex-wrap: nowrap;
    min-width: 220px;
}

.filter-dropdown__menu #subcategories-section + #third-level-section {
    margin-top: 10px;
}

.sort-option {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
    color: #495057;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.sort-option:hover {
    border-color: #00a8bb;
    color: #00a8bb;
}

.sort-option.is-selected {
    background: #00a8bb;
    border-color: #00a8bb;
    color: #fff;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.breadcrumbs__container {
    margin-bottom: 8px;
}

.breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.breadcrumbs__item {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.breadcrumbs__item:not(:last-child)::after {
    content: '/';
    margin-left: 6px;
    color: #9ca3af;
}

.breadcrumbs__link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs__link:hover {
    color: #00a8bb;
}

.breadcrumbs__item:last-child {
    color: #111827;
}

@media (max-width: 767px) {
    #catalog-categories-selector {
        margin-top: 2%;
    }
}

.level-title {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-title h3, .level-title h4, .level-title h5 {
    margin: 0;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.level-title h4 {
    font-size: 16px;
    font-weight: 500;
    color: #555;
}

.level-title h5 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

/* Основные категории - простые чипсы */
.chips-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scroll-behavior: smooth;
    position: relative;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    
    /* Показываем скроллбар на ПК */
    scrollbar-width: thin;
    scrollbar-color: #00a8bb #f8f9fa;
}

/* Стилизация скроллбара для Chrome/Edge/Safari */
.chips-container::-webkit-scrollbar {
    height: 6px;
}

.chips-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.chips-container::-webkit-scrollbar-thumb {
    background: #00a8bb;
    border-radius: 3px;
}

/* Стили для drag-scroll */
.chips-container {
    cursor: default;
}

.chips-container.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.category-chip {
    cursor: pointer;
}

/* Контейнер для главных категорий с индикаторами прокрутки */
.categories-level-1 {
    position: relative;
}

/* Индикаторы прокрутки */
.categories-level-1::before,
.categories-level-1::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.categories-level-1::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-1::after {
    right: 0;
    background: linear-gradient(-90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-1.scroll-start::before {
    opacity: 1;
}

.categories-level-1.scroll-end::after {
    opacity: 1;
}

/* Индикаторы прокрутки для подкатегорий */
.categories-level-2 {
    position: relative;
}

.categories-level-2::before,
.categories-level-2::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.categories-level-2::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-2::after {
    right: 0;
    background: linear-gradient(-90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-2.scroll-start::before {
    opacity: 1;
}

.categories-level-2.scroll-end::after {
    opacity: 1;
}

/* Индикаторы прокрутки для третьего уровня */
.categories-level-3 {
    position: relative;
}

.categories-level-3::before,
.categories-level-3::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.categories-level-3::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-3::after {
    right: 0;
    background: linear-gradient(-90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}

.categories-level-3.scroll-start::before {
    opacity: 1;
}

.categories-level-3.scroll-end::after {
    opacity: 1;
}

/* Основные категории - простые чипсы */
.chips-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chips-container::-webkit-scrollbar {
    display: none;
}

.category-chip,
.subcategory-item,
.third-level-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: fit-content;
}

.category-chip:hover,
.subcategory-item:hover,
.third-level-item:hover {
    border-color: #00a8bb;
    color: #00a8bb;
}

.category-chip.selected,
.subcategory-item.selected,
.third-level-item.selected {
    border-color: #00a8bb;
    background: #00a8bb;
    color: white;
}

/* Подкатегории - простая сетка */
.subcategories-grid {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

.subcategories-grid::-webkit-scrollbar {
    display: none;
}

.subcategory-name {
    font-size: 13px;
    color: inherit;
    line-height: 1.2;
}

.subcategory-count {
    font-size: 11px;
    color: inherit;
    opacity: 0.8;
}

/* Третий уровень - компактные элементы */
.third-level-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.third-level-container::-webkit-scrollbar {
    display: none;
}

.third-level-name {
    font-size: 13px;
    line-height: 1.2;
    color: inherit;
}

/* Кнопка сброса в заголовке */
.btn-reset-inline {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-reset-inline:hover {
    background: #f8f9fa;
    border-color: #00a8bb;
    color: #00a8bb;
}

.btn-reset-inline i {
    font-size: 11px;
}

/* Скелетон загрузки */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 6px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-chip {
    height: 32px;
    width: 100px;
    margin-right: 8px;
    border-radius: 20px;
}

.skeleton-subcategory {
    height: 120px;
    border-radius: 8px;
}
   .catalog-filters-toolbar__inner-container {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }
/* Адаптивность */
@media (max-width: 768px) {
    #catalog-categories-selector {
        margin-bottom: 20px;
    }

 

    .catalog-filters-toolbar.is-floating {
        z-index: 1002;
        padding: 8px 5px 6px;
    }

    .filter-dropdown,
    .categories-level-1,
    .categories-level-2,
    .categories-level-3 {
        position: static;
    }

    .catalog-filters-row {
        gap: 8px;
        align-items: stretch;
    }

    .catalog-filters-row-group {
        display: flex;
        gap: 8px;
        flex-wrap: nowrap;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .catalog-filters-row-group::-webkit-scrollbar {
        display: none;
    }

    .catalog-filters-row-group--primary .filter-dropdown {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .catalog-filters-row-group--secondary .filter-dropdown {
        flex: 0 0 auto;
    }

    .filter-dropdown {
        max-width: 100%;
    }

    .filter-dropdown__toggle {
        min-height: 38px;
        padding: 7px 12px;
        font-size: 12px;
        width: 100%;
        justify-content: space-between;
    }

    .filter-dropdown__content--column {
        min-width: 200px;
    }

    .sort-option {
        font-size: 12px;
        padding: 12px 14px;
        min-height: 44px;
    }

    .filter-dropdown__meta {
        max-width: 90px;
    }

    .filter-dropdown__toggle.has-selected .filter-dropdown__label {
        display: none;
    }

    .filter-dropdown__menu {
        position: fixed;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: min(78vh, 720px);
        padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -18px 40px rgba(15, 23, 42, 0.18);
        overflow: hidden;
        transform: translateY(100%);
        opacity: 0;
        transition: transform 0.24s ease, opacity 0.24s ease;
        z-index: 1201;
        display: flex;
        flex-direction: column;
        display:none;
    }

    #brands-dropdown {
        max-height: min(70vh, 700px) !important;
    }

    #mobile-filter-sheet-root {
        position: fixed;
        inset: 0;
        z-index: 1200;
        pointer-events: none;
    }

    #mobile-filter-sheet-root.is-active {
        pointer-events: auto;
    }

    .filter-dropdown__content {
        flex: 1 1 auto;
        min-height: 0;
        max-height: calc(78vh - 92px);
        overflow-y: auto;
        overflow-x: hidden;
        align-content: flex-start;
    }

    .filter-dropdown.is-open .filter-dropdown__menu {
        display: flex;
        transform: translateY(0);
        opacity: 1;
    }

    #mobile-filter-sheet-root .filter-dropdown__menu.is-mobile-open {
        display: flex;
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .filter-sheet-header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
    }

    body.filter-sheet-open {
        overflow: hidden;
    }

    body.filter-sheet-open .bot-menu {
        display: none;
    }

    body.filters-floating-mobile header#masthead {
        transform: translateY(-100%);
    }

    .chips-container,
    .subcategories-grid,
    .third-level-container {
        flex-wrap: wrap;
        align-content: flex-start;
        overflow-x: hidden;
        overflow-y: visible;
        padding: 0;
        scrollbar-width: auto;
    }

    .chips-container::-webkit-scrollbar,
    .subcategories-grid::-webkit-scrollbar,
    .third-level-container::-webkit-scrollbar {
        display: block;
        width: 6px;
        height: 6px;
    }
    
    .level-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .level-title .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn-reset-inline {
        align-self: flex-end;
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .category-chip,
    .subcategory-item,
    .third-level-item {
        padding: 10px 12px;
        font-size: 12px;
        min-height: 36px;
    }
    
    .level-title h3 {
        font-size: 18px;
    }
    
    .level-title h4 {
        font-size: 15px;
    }
    
    .level-title h5 {
        font-size: 13px;
    }

    .breadcrumbs__item {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #catalog-categories-selector {
        border-radius: 6px;
    }
    
    .level-title h3 {
        font-size: 16px;
    }
    
    .btn-reset-inline {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .subcategory-name {
        font-size: 12px;
    }
    
    .subcategory-count {
        font-size: 10px;
    }

    .third-level-name {
        font-size: 12px;
    }
}

/* Стили для drag-scroll */
.chips-container {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.chips-container.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.chips-container.dragging .category-chip {
    pointer-events: none;
}

/* Стили для брендов */
.brand-chip {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.brand-chip:hover {
    border-color: #00a8bb;
    color: #00a8bb;
}

.brand-chip.selected {
    background: #00a8bb;
    border-color: #00a8bb;
    color: white;
}

.brand-chip .count {
    font-size: 11px;
    opacity: 0.8;
}

#brands-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
    padding: 6px 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex-wrap: nowrap !important;
    max-height: 350px;
    scrollbar-width: thin;
    scrollbar-color: #00a8bb #f8f9fa;
}

.filter-dropdown__menu {
    max-height: 520px;
}

#brands-container .brand-chip {
    flex-shrink: 0;
}

.brands-search-input:focus {
    border-color: #00a8bb !important;
    background: #fff !important;
}

.brands-search-input::placeholder {
    color: #9ca3af;
}

.brand-chip.filtered-out {
    display: none !important;
}

#brands-container::-webkit-scrollbar {
    width: 6px;
}

#brands-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

#brands-container::-webkit-scrollbar-thumb {
    background: #00a8bb;
    border-radius: 3px;
}

#options-container {
    gap: 10px;
    align-items: flex-start;
    align-content: flex-start;
}

#colors-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}

.option-group-toggle__label {
    display: none;
}

.option-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-value {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    appearance: none;
}

.option-value:hover {
    border-color: #00a8bb;
    color: #00a8bb;
    background: #f8fdff;
}

.option-value.selected {
    background: #00a8bb;
    border-color: #00a8bb;
    color: white;
}

.option-value .count {
    font-size: 10px;
    opacity: 0.8;
    background: rgba(255,255,255,0.2);
    padding: 1px 4px;
    border-radius: 8px;
    margin-left: 2px;
}

.option-value.selected .count {
    background: rgba(255,255,255,0.3);
}

.color-value {
    padding-left: 12px;
    padding-right: 12px;
}

/* Стили для кнопки переключения фильтров */
.btn-toggle-filters {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    margin-left: auto;
}

.btn-toggle-filters:hover {
    background: #f8f9fa;
    border-color: #00a8bb;
    color: #00a8bb;
}

.btn-toggle-filters i {
    font-size: 11px;
    transition: transform 0.2s ease;
}

/* Адаптивность для опций */
@media (max-width: 768px) {
    #options-container {
        flex-wrap: wrap;
        overflow-x: hidden;
        padding-bottom: 6px;
        scrollbar-width: thin;
        scrollbar-color: #00a8bb #f8f9fa;
    }

    #options-container::-webkit-scrollbar {
        height: 5px;
    }

    #options-container::-webkit-scrollbar-track {
        background: #f8f9fa;
        border-radius: 999px;
    }

    #options-container::-webkit-scrollbar-thumb {
        background: #00a8bb;
        border-radius: 999px;
    }

    .option-value {
        padding: 10px 12px;
        font-size: 12px;
    }

    .option-group-toggle {
        min-height: 36px;
        padding: 7px 12px;
        font-size: 12px;
    }

    .option-group-toggle__meta {
        max-width: 92px;
    }

    .btn-toggle-filters {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* Brands modal */
.brands-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.brands-modal.is-open {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.brands-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.brands-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: min(80vh, 700px);
    margin: 60px auto 40px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.25s ease;
}

.brands-modal.is-open .brands-modal-dialog {
    transform: translateY(0);
}

.brands-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
    flex: 0 0 auto;
}

.brands-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.brands-modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
}

.brands-modal-close:hover {
    background: #e5e7eb;
}

.brands-modal-search {
    position: relative;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex: 0 0 auto;
}

.brands-modal-search .bi-search {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
}

.brands-modal-search-input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #111827;
    background: #f9fafb;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.brands-modal-search-input:focus {
    border-color: #00a8bb;
    background: #fff;
}

.brands-modal-search-input::placeholder {
    color: #9ca3af;
}

.brands-modal-search-clear {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 11px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.brands-modal-search-clear:hover {
    color: #374151;
}

.brands-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 20px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

.brand-chip-modal {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    color: #495057;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.brand-chip-modal:hover {
    border-color: #00a8bb;
    color: #00a8bb;
}

.brand-chip-modal.selected {
    background: #00a8bb;
    border-color: #00a8bb;
    color: white;
}

.brand-chip-modal .count {
    font-size: 11px;
    opacity: 0.7;
}

.brand-chip-modal.selected .count {
    opacity: 0.85;
}

.brand-chip-modal.bm-hidden {
    display: none;
}

.brands-modal-no-results {
    width: 100%;
    text-align: center;
    padding: 32px 16px;
    color: #9ca3af;
    font-size: 14px;
}

@media (max-width: 767px) {
    .brands-modal-dialog {
        max-width: none;
        max-height: 88vh;
        margin: auto 0 0;
        border-radius: 22px 22px 0 0;
    }

    .brands-modal {
        align-items: flex-end;
    }

    .brands-modal.is-open .brands-modal-dialog {
        transform: translateY(0);
    }

    .brands-modal-dialog {
        transform: translateY(100%);
        transition: transform 0.24s ease;
    }
}
