.filters-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filters-modal.active {
    display: flex;
    opacity: 1;
}

.filters-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    margin: auto;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.filters-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(89, 197, 112, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filters-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
}

.filters-modal-header h3 i {
    color: var(--primary-color);
}

.close-filters-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary-ultra-light);
    color: var(--primary-color);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-filters-modal:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.filters-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.filter-section {
    margin-bottom: 32px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h4 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 16px;
}

/* Стили для подзаголовка в фильтрах */
.filter-subtitle {
    font-size: 0.85rem;
    color: #666;
    margin-top: -12px;
    margin-bottom: 12px;
}

/* Стили для ценового диапазона */
.price-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-input {
    flex: 1;
    position: relative;
}

.price-input .currency {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    font-size: 0.95rem;
}

.price-input input {
    width: 100%;
    padding: 12px 12px 12px 28px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
    transition: border-color 0.3s ease;
}

.price-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.price-separator {
    color: #666;
    font-weight: 500;
}

/* Стили для категорий автомобилей */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.category-card {
    position: relative;
    cursor: pointer;
}

.category-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card-content img {
    height: 48px; /* Увеличиваем с 32px до 48px */
    width: auto;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.card-content span {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Стили для активного состояния */
.category-card input:checked + .card-content {
    background: var(--primary-ultra-light);
    border-color: var(--primary-color);
}

.category-card input:checked + .card-content img {
    opacity: 1;
    transform: scale(1.1);
}

.category-card:hover .card-content {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Стили для чекбоксов */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.custom-checkbox {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.checkbox-content i {
    font-size: 0.8rem;
    color: var(--primary-color);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

/* Стили для активного состояния */
.custom-checkbox input:checked + .checkbox-content {
    background: var(--primary-ultra-light);
    border-color: var(--primary-color);
}

.custom-checkbox input:checked + .checkbox-content i {
    opacity: 1;
    transform: scale(1);
}

/* Ховер эффект */
.custom-checkbox:hover .checkbox-content {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Футер с кнопками */
.filters-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(89, 197, 112, 0.1);
    display: flex;
    gap: 12px;
}

.filters-modal-footer button {
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filters {
    flex: 1;
    background: white;
    border: 1px solid #e0e0e0;
    color: #666;
}

.clear-filters:hover {
    background: #f5f5f5;
    border-color: #d5d5d5;
}

.apply-filters {
    flex: 2;
    background: var(--primary-color);
    border: none;
    color: white;
}

.apply-filters:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(89, 197, 112, 0.3);
}

/* Стили для числовых инпутов в модельном году */
#min-year,
#max-year {
    padding: 12px;
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
}

#min-year:focus,
#max-year:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Специальные стили для раздела "Дополнительные опции" */
.filter-section:last-child .checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Для десктопа */
    gap: 8px;
}

.filter-section:last-child .checkbox-content {
    min-height: 36px; /* Минимальная высота вместо фиксированной */
    height: auto; /* Автоматическая высота */
    padding: 8px 12px; /* Увеличиваем вертикальный padding */
    white-space: normal; /* Разрешаем перенос текста */
    display: flex;
    align-items: center;
    line-height: 1.2; /* Оптимальная высота строки */
}

.filter-section:last-child .checkbox-content span {
    overflow: visible; /* Убираем обрезание */
    text-overflow: initial; /* Убираем многоточие */
    white-space: normal; /* Разрешаем перенос текста */
}

/* Убираем тултип, так как он больше не нужен */
.filter-section:last-child .custom-checkbox:hover .checkbox-content::after {
    display: none;
}

/* Мобильная версия */
@media (max-width: 768px) {
    .filters-modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
    }

    .filters-modal-header {
        padding: 16px 20px;
    }

    .filters-modal-body {
        padding: 20px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .checkbox-content {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .filters-modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px 20px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    }

    .filters-modal-footer button {
        padding: 12px;
        font-size: 0.95rem;
    }

    .filter-section:last-child .checkbox-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* Принудительно 2 колонки */
        gap: 8px;
    }

    .filter-section:last-child .checkbox-content {
        font-size: 0.85rem;
        min-height: 36px;
        padding: 8px;
    }
}
