/**
 * Стили для фильтров круизов
 
 */

/* Контейнер фильтров */
.filters-section {
    background: #FFFFFF;
    padding: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e9f5; /* Add a bottom border for separation */
    box-shadow: none;
    border-radius: 0;
    border-top: 0;
    border-left: 0;
    border-right: 0;
}

.filters-row {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
}

/* Отдельный фильтр */
.filter-item {
    position: relative;
    flex: 1;
    min-width: 150px;
    background: #FFFFFF;
    border: 1px solid #e2e9f5;
}

.filter-item:first-child {
   border-radius: 10px 0 0 10px;
}

.filter-item:last-child {
   border-radius: 0 10px 10px 0;
}

/* Кнопка фильтра */
.filter-button {
    width: 100%;
    height: 50px;
    padding: 5px 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    color: #1D1D1F;
}

.filter-button:hover {
    background-color: #f5f7fa;
}

.filter-button:active {
    transform: scale(0.98);
}

/* Текст кнопки */
.filter-button-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    padding-left: 10px;
    padding-bottom: 1px;
}

/* Label фильтра (всегда показывается) */
.filter-label {
    color: #647396;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
    letter-spacing: -0.15px;
    transition: font-size 0.2s;
}

/* Label когда есть выбранное значение */
.filter-button.has-selection .filter-label {
    font-size: 13px;
    letter-spacing: -0.13px;
}

/* Строка с выбранным значением и счетчиком */
.filter-value-row {
    display: none;
    align-items: center;
    gap: 3px;
    width: 100%;
    margin-bottom: -1px;
}

/* Выбранное значение */
.filter-text {
    color: #1D1D1F;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
    letter-spacing: -0.15px;
    flex: 1;
    min-width: 0;
}

/* Счетчик выбранных */
.filter-count {
    display: none;
    padding: 1px 3px;
    background: #1D1D1F;
    color: #FFFFFF;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 500;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    letter-spacing: -0.13px;
}

/* Иконка стрелки */
.filter-arrow {
    width: 12px;
    height: 12px;
    color: #647396;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.filter-button.active .filter-arrow {
    transform: rotate(180deg);
}

/* Контейнер для иконки */
.filter-button > svg.filter-arrow,
.filter-button > .filter-arrow {
    margin-right: 14px;
}

/* Dropdown меню */
.filter-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    max-width: 400px;
    background: #FFFFFF;
    border: 1.5px solid #E2E9F5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: none;
}

.filter-dropdown.show {
    display: block;
}

/* Поиск в dropdown */
.filter-search-container {
    padding: 12px 16px;
    border-bottom: 1px solid #E2E9F5;
}

.filter-search {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid #E2E9F5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-search:focus {
    border-color: #007AFF;
}

.filter-search::placeholder {
    color: #647396;
}

/* Список чекбоксов */
.filter-checkbox-list,
.filter-nested-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

/* Кастомный scrollbar */
.filter-checkbox-list::-webkit-scrollbar,
.filter-nested-list::-webkit-scrollbar {
    width: 6px;
}

.filter-checkbox-list::-webkit-scrollbar-track,
.filter-nested-list::-webkit-scrollbar-track {
    background: #F5F7FA;
    border-radius: 3px;
}

.filter-checkbox-list::-webkit-scrollbar-thumb,
.filter-nested-list::-webkit-scrollbar-thumb {
    background: #C7D2E0;
    border-radius: 3px;
}

.filter-checkbox-list::-webkit-scrollbar-thumb:hover,
.filter-nested-list::-webkit-scrollbar-thumb:hover {
    background: #A0B0C5;
}

/* Элемент чекбокса */
.filter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.filter-checkbox-item:hover {
    background: #F5F7FA;
}

.filter-checkbox-item.nested {
    padding-left: 32px;
}

.filter-checkbox-item.select-all {
    font-weight: 600;
    border-bottom: 1px solid #E2E9F5;
    margin-bottom: 4px;
}

.filter-checkbox-item input[type="checkbox"],
.filter-checkbox-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #007AFF;
}

.filter-checkbox-item span {
    flex: 1;
    font-size: 14px;
    color: #1D1D1F;
}

.filter-checkbox-item .count {
    flex: none;
    font-size: 13px;
    color: #647396;
    margin-left: 8px;
}

/* Disabled элементы */
.filter-checkbox-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.filter-checkbox-item.disabled:hover {
    background: transparent;
}

.filter-checkbox-item.disabled span {
    color: #9CA3AF;
}

.filter-checkbox-item.disabled .count {
    color: #D1D5DB;
}

.filter-checkbox-item.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.filter-nested-group.disabled {
    opacity: 0.5;
}

.filter-year-label.disabled {
    color: #9CA3AF;
}

/* Вложенные группы */
.filter-nested-group {
    margin-bottom: 4px;
}

.filter-nested-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-nested-header:hover {
    background: #F5F7FA;
}

.filter-nested-header .filter-checkbox-item {
    flex: 1;
    padding: 0;
}

.filter-class-label {
    font-weight: 600;
    font-size: 14px;
    color: #1D1D1F;
}

/* Заголовок года (без чекбокса) */
.filter-year-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #1D1D1F;
}

.filter-year-label .count {
    font-weight: 400;
    color: #8E8E93;
}

.toggle-nested {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #647396;
    transition: transform 0.2s;
}

.toggle-nested:hover {
    color: #1D1D1F;
}

.toggle-nested.active {
    transform: rotate(180deg);
}

.filter-nested-children {
    display: none;
    padding-left: 12px;
}

/* Активные теги */
.active-filters-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    border-top: none;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #F0F4FA;
    border-radius: 8px;
    font-size: 14px;
    color: #1D1D1F;
}

.filter-tag span {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-tag {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #647396;
    padding: 0;
    transition: color 0.2s;
}

.remove-tag:hover {
    color: #FF3B30;
}

/* Кнопка сброса фильтров */
.reset-filters-btn {
    padding: 6px 16px;
    background: transparent;
    border: 1.5px solid #E2E9F5;
    border-radius: 8px;
    font-size: 14px;
    color: #007AFF;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.reset-filters-btn:hover {
    background: #F0F4FA;
    border-color: #007AFF;
}

/* Адаптивность фильтров */
@media (max-width: 1024px) {
    .filters-row {
        flex-wrap: wrap;
    }
    
    .filter-item {
        flex: 1 1 calc(33.333% - 2px);
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .filters-section {
        padding: 16px;
    }
    
    .filter-item {
        flex: 1 1 calc(50% - 1.5px);
    }
    
    .filter-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .filter-item {
        flex: 1 1 100%;
    }
    
    .filter-button {
        height: 44px;
        font-size: 14px;
    }
    
    .active-filters-section {
        gap: 8px;
    }
}

.filter-content.active::-webkit-scrollbar-track,
.filter-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-content.active::-webkit-scrollbar-thumb,
.filter-items::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.filter-content.active::-webkit-scrollbar-thumb:hover,
.filter-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Анимация загрузки */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.filter-items-loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .filters-row {
        flex-wrap: wrap;
    }
    
    .filter-item {
        flex: 1 1 calc(33.333% - 2px);
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .filters-section {
        padding: 16px;
    }
    
    .filter-item {
        flex: 1 1 calc(50% - 1.5px);
    }
    
    .filter-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .filter-item {
        flex: 1 1 100%;
    }
    
    .filter-button {
        height: 44px;
        font-size: 14px;
    }
    
    .active-filters-section {
        gap: 8px;
    }
}
