/* Стили для фильтров таблицы */

/* Выпадающее меню фильтра */
.filter-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    max-width: 350px;
    max-height: 400px;
    z-index: 1000;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Заголовок фильтра */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.filter-title {
    font-weight: 600;
    color: #2c5530;
    font-size: 14px;
}

.filter-count {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

.filter-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.filter-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Поле поиска */
.filter-search {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.filter-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.filter-search-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* Список опций */
.filter-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 100px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background: #f8f9fa;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #4caf50;
}

.filter-option label {
    cursor: pointer;
    font-size: 14px;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Действия фильтра */
.filter-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.filter-apply,
.filter-clear {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-apply {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.filter-apply:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.filter-clear {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.filter-clear:hover {
    background: #e9ecef;
    color: #333;
    border-color: #ccc;
}

/* Индикатор активного фильтра в заголовке */
th.filter-active {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    position: relative;
}

th.filter-active::before {
    content: '🔍';
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 12px;
    color: #4caf50;
}

/* Стили для скроллбара в опциях */
.filter-options::-webkit-scrollbar {
    width: 8px;
}

.filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    border: 1px solid #f1f1f1;
}

.filter-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Улучшенная прокрутка для Firefox */
.filter-options {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .filter-dropdown {
        min-width: 200px;
        max-width: 280px;
        max-height: 300px;
    }
    
    .filter-header {
        padding: 10px 12px;
    }
    
    .filter-title {
        font-size: 13px;
    }
    
    .filter-search {
        padding: 10px 12px;
    }
    
    .filter-search-input {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .filter-option {
        padding: 5px 12px;
    }
    
    .filter-option label {
        font-size: 13px;
    }
    
    .filter-actions {
        padding: 10px 12px;
    }
    
    .filter-apply,
    .filter-clear {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Анимация появления */
.filter-dropdown {
    animation: filterDropdownAppear 0.2s ease-out;
}

@keyframes filterDropdownAppear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Скрытие опций при поиске */
.filter-option[style*="display: none"] {
    display: none !important;
}
