/* ===================================
   ZAMOK — Catalog Toolbar
   Сортировка, переключатель вида, кол-во
   =================================== */

.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    border: 1px solid var(--color-border);
}

/* Sort */
.catalog-toolbar__sort {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-toolbar__sort-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* Custom Select Component */
.custom-select {
    position: relative;
    min-width: 180px;
}

.custom-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    background: var(--color-white);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
}

.custom-select__trigger:hover {
    border-color: var(--color-text-muted);
}

.custom-select--open .custom-select__trigger {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(225, 30, 40, 0.1);
}

.custom-select__arrow {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform var(--transition-base);
}

.custom-select--open .custom-select__arrow {
    transform: rotate(180deg);
}

.custom-select__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.custom-select--open .custom-select__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select__option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.custom-select__option:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.custom-select__option--active {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    background: var(--color-primary-light);
}

.custom-select__option--active:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Active sort chips */
.catalog-toolbar__active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.catalog-toolbar__filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.catalog-toolbar__filter-chip-remove {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    background: none;
    border: none;
    padding: 0;
}

.catalog-toolbar__filter-chip-remove:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* View switcher */
.catalog-toolbar__view {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.catalog-toolbar__view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.catalog-toolbar__view-btn:hover {
    color: var(--color-text);
    background: var(--color-bg-secondary);
}

.catalog-toolbar__view-btn--active {
    color: var(--color-text);
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
}

.catalog-toolbar__view-btn svg {
    width: 18px;
    height: 18px;
}

/* Mobile filter controls */
.catalog-toolbar__mobile-controls {
    display: none;
    gap: 8px;
}

.catalog-sidebar-mobile,
.catalog-filters-mobile {
    flex: 1;
    min-width: 0;
}

.catalog-sidebar-mobile__btn,
.catalog-filters-mobile__btn {
    width: 100%;
}

@media (max-width: 1024px) {
    .catalog-toolbar__mobile-controls {
        display: flex;
    }
}

@media (max-width: 768px) {
    .catalog-toolbar {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 10px;
    }

    .catalog-toolbar__mobile-controls {
        width: 100%;
    }

    .catalog-toolbar__sort {
        order: 2;
        flex: 1;
    }

    .catalog-toolbar__sort .custom-select {
        flex: 1;
        min-width: 0;
    }

    .catalog-toolbar__sort-label {
        display: none;
    }

    .catalog-toolbar__view {
        display: none;
    }
}
