/* Фасетный фильтр */
.faceted-filter {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

/* Компактная форма фильтра */
.faceted-filter.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.faceted-filter.compact .filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.faceted-filter.compact .search-controls {
    display: flex;
    align-items: center;
}

/* Развернутая форма фильтра */
.faceted-filter.expanded {
    padding: 20px;
}

.faceted-filter.expanded .filter-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.faceted-filter.expanded .filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

/* Группы фильтров */
.filter-group {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.filter-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

/* Опции фильтра */
.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background-color: #f8f9fa;
}

.filter-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.filter-option .option-text {
    flex: 1;
    font-size: 13px;
    color: #495057;
}

.filter-option .option-count {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Быстрые фильтры (селекты) */
.quick-filter {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #495057;
    min-width: 150px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-filter:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Кнопки */
.expand-filter-btn,
.collapse-filter-btn,
.clear-filters-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.expand-filter-btn:hover,
.collapse-filter-btn:hover {
    background: #5a6268;
}

.clear-filters-btn {
    background: #dc3545;
}

.clear-filters-btn:hover {
    background: #c82333;
}

.search-btn {
    padding: 8px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.search-btn:hover:not(:disabled) {
    background: #0056b3;
}

.search-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Сообщения об ошибках */
.filter-error {
    background: #f8d7da;
    color: #721c24;
    padding: 8px 12px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.faceted-filter.expanded {
    animation: fadeIn 0.3s ease;
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .faceted-filter.compact {
        flex-direction: column;
        align-items: stretch;
    }

    .faceted-filter.compact .filter-controls {
        justify-content: center;
        margin-bottom: 10px;
    }

    .faceted-filter.compact .search-controls {
        justify-content: center;
    }

    .faceted-filter.expanded .filter-groups {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .faceted-filter.expanded .filter-actions {
        flex-direction: column;
        gap: 10px;
    }

    .quick-filter {
        min-width: auto;
        width: 100%;
        max-width: 200px;
    }

    .filter-group {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .faceted-filter {
        padding: 12px;
        margin-bottom: 15px;
    }

    .faceted-filter.expanded {
        padding: 15px;
    }

    .filter-group {
        padding: 10px;
    }

    .filter-group h4 {
        font-size: 13px;
    }

    .filter-option .option-text {
        font-size: 12px;
    }

    .quick-filter,
    .search-btn,
    .expand-filter-btn,
    .collapse-filter-btn,
    .clear-filters-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* Индикатор активных фильтров */
.faceted-filter.compact .filter-controls::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.faceted-filter.compact.has-active-filters .filter-controls::after {
    opacity: 1;
}

/* Стилизация скроллбара для списков опций */
.filter-options::-webkit-scrollbar {
    width: 6px;
}

.filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.filter-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}