/* Секция каталога */
.catalog-section {
    max-width: 1200px;
    margin: 80px auto;
    padding: 0 20px;
    font-family: 'Gilroy', 'Arial', sans-serif;
    position: relative;
    scroll-margin-top: 100px;
}

.catalog-section::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: #eee;
    z-index: 1;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.header-text {
    flex: 1;
}

.label {
    display: inline-block;
    background: #f0f7ff;
    color: #2c5282;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #dbeafe;
    margin-bottom: 15px;
}

.catalog-header h2 {
    font-size: 36px;
    font-weight: 600;
    color: #000;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Кнопки управления слайдером */
.slider-controls {
    display: flex;
    gap: 10px;
}

.s-btn {
    width: 50px;
    height: 50px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.s-btn:hover {
    background: #f8f8f8;
    border-color: #2c5282;
    color: #2c5282;
}

.s-btn:active {
    transform: scale(0.95);
}

/* Видовая область слайдера */
.slider-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 20px 0;
}

/* Дорожка слайдера */
.slider-track {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, auto);
    /* 4 карточки в ряд: (1200px - 60px отступов) / 4 = 285px */
    grid-auto-columns: 285px;
    /* Фиксированная ширина для 4 в ряд */
    gap: 30px;
    will-change: transform;
    transition: transform 0.1s ease-out;
}

.slider-track.dragging {
    transition: none;
}

/* Карточка автомобиля */
.car-item {
    width: 285px;
    /* Фиксированная ширина */
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.car-item:hover {
    border-color: #e70000;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Контейнер изображения - ФИКСИРОВАННАЯ ВЫСОТА ВЕЗДЕ */
.car-img-box {
    position: relative;
    width: 100%;
    height: 250px;
    /* Фиксированная высота на всех устройствах */
    overflow: hidden;
    background: #f8f8f8;
}

.img-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.4s ease;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Тег доставки */
.car-delivery-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Внутренняя навигация для фото */
.inner-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.car-item:hover .inner-nav {
    opacity: 1;
}

.inner-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.inner-btn:hover {
    background: rgba(231, 0, 0, 0.9);
    color: white;
    transform: scale(1.1);
}

/* Информация об авто */
.car-info {
    padding: 20px;
}

.car-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.car-params {
    display: flex;
    flex-direction: row;
    /* в строку */
    flex-wrap: wrap;
    /* перенос ТОЛЬКО если не влезает */
    gap: 10px 14px;
    /* вертикаль / горизонталь */
}

.car-param {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.car-param::before {
    font-size: 14px;
    opacity: 0.7;
}

/* АДАПТИВНОСТЬ */
/* Для экранов уже 1200px - адаптируем размер карточек */
@media (max-width: 1240px) {
    .catalog-section {
        padding: 0 40px;
    }
}

@media (max-width: 1100px) {
    .slider-track {
        /* 3 карточки в ряд: (100% - 60px) / 3 */
        grid-auto-columns: calc((100% - 60px) / 3);
    }


}

/* Планшеты: 2 карточки в ряд */
@media (max-width: 992px) {
    .catalog-section {
        margin: 60px auto;
        padding: 0 30px;
    }

    .catalog-header h2 {
        font-size: 32px;
    }

    .slider-track {
        grid-auto-columns: calc((100% - 30px) / 2);
        /* 2 карточки */
        gap: 30px;
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! */

    .s-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Большие мобильные: 2 карточки с меньшим gap */
@media (max-width: 768px) {
    .catalog-section {
        margin: 50px auto;
        padding: 0 25px;
    }

    .catalog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        margin-bottom: 30px;
    }

    .slider-controls {
        align-self: flex-end;
    }

    .catalog-header h2 {
        font-size: 28px;
    }

    .slider-track {
        grid-auto-columns: calc((100% - 30px) / 2);
        /* 2 карточки */
        gap: 30px;
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! */

    .car-info h3 {
        font-size: 16px;
    }
}

/* Мобильные устройства: 1 карточка */
@media (max-width: 576px) {
    .catalog-section {
        margin: 40px auto;
        padding: 0 20px;
    }

    .catalog-header h2 {
        font-size: 26px;
    }

    .slider-track {
        grid-auto-columns: calc(100% - 20px);
        /* 1 карточка с отступами */
        gap: 20px;
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! Остается 250px */

    .car-info {
        padding: 15px;
    }

    .inner-nav {
        padding: 0 5px;
    }

    .inner-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .s-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .catalog-section {
        padding: 0 15px;
    }

    .catalog-header h2 {
        font-size: 24px;
    }

    .slider-track {
        grid-auto-columns: calc(100% - 10px);
        /* Почти полная ширина */
        gap: 15px;
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! */

    .car-delivery-tag {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 375px) {
    .slider-track {
        grid-auto-columns: 100%;
        /* Полная ширина */
        gap: 10px;
    }

    .catalog-header h2 {
        font-size: 22px;
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! Остается 250px */

    .car-info h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .car-param {
        font-size: 12px;
    }
}

/* Для ландшафтной ориентации на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .slider-track {
        grid-auto-columns: calc((100% - 30px) / 2);
        /* 2 карточки в ряд */
    }

    /* ВЫСОТА ФОТО НЕ МЕНЯЕТСЯ! */
}

/* Для очень больших экранов (более 1400px) - сохраняем 4 карточки */
@media (min-width: 1400px) {
    .catalog-section {
        max-width: 1200px;
        /* Фиксируем 1200px */
    }

    .slider-track {
        grid-auto-columns: 285px;
        /* Все равно 4 в ряд */
    }
}

/* Для экранов с очень маленькой высотой */
@media (max-height: 600px) {
    .car-img-box {
        height: 200px;
        /* Немного уменьшаем на очень низких экранах */
    }
}

/* Эффекты */
.car-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.car-item:hover::after {
    opacity: 1;
}

/* Плавность перетаскивания */
.slider-viewport {
    cursor: grab;
}

.slider-viewport:active {
    cursor: grabbing;
}

/* Состояние загрузки */
.car-item.loading {
    animation: loadingPulse 1.5s infinite;
}

@keyframes loadingPulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* Активная карточка */
.car-item.active {
    border-color: #e70000;
    box-shadow: 0 0 0 2px rgba(231, 0, 0, 0.1);
}