/**
 * Cars Catalog Mobile Fixes
 */

/* Класс для сворачивания в десктопной версии */
.desktop-collapsed {
    display: none !important;
}


/* Стили для кнопки фильтров */

.toggle-button {
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    flex: 1;
    height: 53px;
}


/* На десктопах показываем текст "Свернуть/Развернуть фильтры" */
@media (min-width: 993px) {
    /* Скрываем верхнюю кнопку на десктопах */
    #toggle-filters-top {
        display: none !important;
    }
    
    .toggle-button {
        margin-bottom: 15px;
        display: block;
        width: auto;
        float: right;
    }
    
    /* Внутренняя кнопка фильтров для десктопной версии */
    .desktop-only {
        display: inline-block !important;
        float: none !important;
        margin: 0 0 0 10px !important;
    }
}

/* Скрытие фильтров на мобильных устройствах по умолчанию */
@media (max-width: 992px) {
    /* Скрываем фильтры по умолчанию на мобильных */
    .filters-collapsed-mobile {
        display: none !important;
    }
    
    /* Скрываем кнопку desktop-only на мобильных */
    .desktop-only {
        display: none !important;
    }
    
    /* Кнопка для открытия фильтров на мобильных */
    .toggle-button {
        background-color: #d71110;
        color: white;
        font-weight: bold;
        width: 100%;
        display: block;
        margin-bottom: 15px;
        text-align: center;
        border-radius: 5px;
        border: none;
        padding: 12px 15px;
        font-size: 16px;
        cursor: pointer;
        transition: background-color 0.3s;
    }
    
    /* Убираем дополнительную кнопку внутри форм */
    .filter-actions .toggle-button {
        display: none !important;
    }
}

/* Переопределение стилей для мобильных устройств - карточки в 1 колонку */
@media (max-width: 576px) {
    /* Карточки в 1 колонку */
    .cars-catalog-grid {
        grid-template-columns: 1fr !important; /* Принудительно 1 карточка в ряд */
        gap: 15px;
    }
    
    /* Центрирование счетчика автомобилей */
    .cars-count {
        text-align: center;
        width: 100%;
        margin-bottom: 10px;
        font-size: 24px;
        line-height: 20px;

    }
    
    /* Скрытие лейбла сортировки и расширение селекта на всю ширину */
    .sorting-label {
        display: none;
    }
    
    .sorting-container {
        width: 100%;
    }
    
    .sorting-select {
        width: 100%;
    }
    
    /* Изменение расположения панели сортировки */
    .cars-catalog-sorting {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* Улучшение отображения фильтров - каждый фильтр на всю ширину в 1 ряд */
    .filter-row {
        display: flex !important;
        gap: 0px !important;
        flex-direction: column !important;
    }
    

    .filter-group, 
    .filter-group-pair,
    .date-filter {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Исправление отображения полей ввода и селекторов на мобильных */
    .date-input,
    .filter-group select,
    .filter-group input[type="text"],
    .filter-group input[type="number"] {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Исправление для группированных полей */
    .filter-group-pair {
        display: flex;
        flex-direction: column;
        gap: 0px !important;
    }
    
    .filter-group-pair .half-width {
        width: 100% !important;
    }
    
    /* Кнопки фильтра на всю ширину */
    .filter-actions {
        flex-direction: column !important;
        gap: 0px !important;
    }
    
    .filter-button, 
    .reset-button {
        width: 100% !important;
    }

    .car-card {
        background-color: #000000;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        transition: transform 0.3s, box-shadow 0.3s, border 0.3s;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        height: 340px;
        border: 1px solid transparent;
    }

    .car-image {
        width: 100%;
        height: 200px;
        overflow: hidden;
        position: relative;
        background-color: #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .car-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transition: transform 0.3s;
        display: block;
    }

    .cars-catalog-filters {
        background-color: #00000000;
        border-radius: 5px;
        margin-bottom: 10px;
    }


    .cars-count {
        font-size: 24px;
        line-height: 53px;
        font-weight: 900;
        font-family: 'Evolventa', Arial, sans-serif;
    }


    
    .filter-group select, .filter-group input[type="number"] {
        width: 100%;
        height: 40px;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 10px;
        font-size: 14px;
        box-sizing: border-box;
        color: #000;
        appearance: none !important;
        background-color: #FFFFFF;
        -webkit-appearance: none !important;
        -moz-appearance: none;
        padding-right: 35px;
    }
    
    
    .filter-group input[type="text"] {
        width: 100%;
        height: 40px;
        padding: 10px 10px 10px 10px;
        border: 1px solid #ddd;
        border-radius: 10px;
        font-size: 14px;
        text-align: left;
        font-weight: 500;
        position: relative;
        box-sizing: border-box;
        color: #000;
    }
    
    
    .selected-options-container {
        display: flex;
        align-items: center;
        height: 40px;
        border: 1px solid #ddd;
        border-radius: 10px;
        background-color: #FFFFFF;
        padding: 5px 10px;
        font-size: 14px !important;
        cursor: pointer;
        flex-wrap: nowrap;
        overflow: hidden;
        white-space: nowrap;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .selected-options-placeholder {
        font-size: 14px;
        color: #000;
        padding: 0px;
    }
    
    .reset-button {
        background-color: #f1f1f1;
        color: #333;
        border: 1px solid #ddd;
        padding: 10px 15px;
        border-radius: 10px;
		font-size: 16px !important;
        cursor: pointer;
        font-weight: bold;
        transition: background-color 0.3s;
        flex: 1;
        height: 53px;
        margin-bottom: 10px;
    }

    .filter-button {
        font-size: 16px;
    }

    .cars-catalog-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 20px;
        font-size: 18px;
        flex-wrap: nowrap !important;
        padding: 0;
        overflow-x: auto;
        width: 100%;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .cars-catalog-pagination::-webkit-scrollbar {
        display: none;
    }

    .page-item {
        margin: 0 7px;
        flex-shrink: 0;
        background-color: #000000;
    }
    
    .page-item.prev,
    .page-item.next {
        font-size: 20px;
    }
    
    .page-dots {
        flex-shrink: 0;
    }

}

/* Исправления для планшетов и средних экранов */
@media (min-width: 577px) and (max-width: 992px) {
    /* Отображение фильтров в два аккуратных столбца */
    .filter-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Контейнер для центральной кнопки разворачивания фильтров */
.expand-filters-container {
    display: none;
    text-align: center;
    margin: 5px 0 5px;
    width: 100%;
}

/* Стили для центральной кнопки разворачивания */
.center-expand-button {
    display: inline-block;
    float: none;
    margin: 0 auto;
    font-size: 16px;
    padding: 12px 25px;
    background-color: #d71110;
    color: white;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.center-expand-button:hover {
    background-color: #e84900;
}

/* Показываем контейнер с кнопкой только в десктопной версии и когда фильтры свернуты */
@media (min-width: 993px) {
    .desktop-collapsed ~ .expand-filters-container, 
    .desktop-collapsed + .expand-filters-container {
        display: block;
    }
}