/* Стили для блока с аукционами */
#wrap_me_calk {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Gilroy', 'Arial', sans-serif;
    position: relative;
    scroll-margin-top: 100px;
}

#wrap_me_calk::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: #eee;
    z-index: 1;
}

/* Заголовок */
#header_h1 {
    margin-bottom: 40px;
}

#header_h1 h2 {
    font-size: 43px;
    font-weight: 500;
    color: #000;
    line-height: 1.1;
    margin: 0 0 10px 0;
    letter-spacing: -0.8px;
}

/* Блок фильтров */
.filter-block {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.filter-block select,
.filter-block input {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    font-family: 'Gilroy', 'Arial', sans-serif;
    transition: border-color 0.2s ease;
}

.filter-block select:focus,
.filter-block input:focus {
    outline: none;
    border-color: #2c5282;
}

/* Контейнер для ввода с единицей измерения */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    padding-right: 50px;
}

.input-unit {
    position: absolute;
    right: 12px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    pointer-events: none;
}

/* Кнопки фильтров */
#stats-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
}

#stats-buttons button {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#stats-buttons button.active {
    color: #2c5282;
    background: #f0f7ff;
    border-color: #2c5282;
    font-weight: 600;
}

#stats-buttons button:hover:not(.active) {
    border-color: #999;
}

/* Кнопки действий */
#clear-btn,
#show-cars-btn {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

#clear-btn {
    background: #f8f8f8;
    color: #333;
    border: 1px solid #e8e8e8;
}

#clear-btn:hover {
    background: #eee;
}

#show-cars-btn {
    background: #e70000;
    color: #fff;
}

#show-cars-btn:hover {
    background: #cc0000;
}

/* Сортировка */
#sorting-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
}

#sorting-container label {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

#sort-select {
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    background: #fff;
    color: #333;
    min-width: 200px;
}


#cars-container-wrapper {
    position: relative;
    min-height: 300px;
    /* Минимальная высота для видимости лоадера */
}

/* Сетка автомобилей - 4 КАРТОЧКИ НА БОЛЬШИХ ЭКРАНАХ */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Карточка автомобиля */
.car-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.car-card:hover {
    border-color: #2c5282;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

/* Картинка 640x480 (4:3) */
.car-card__image {
    position: relative;
    width: 100%;
    min-height: 200px;
    /* 4:3 соотношение (3/4 = 0.75) */
    flex-shrink: 0;
    background: #f8f8f8;
}

.car-card__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Заполняет контейнер, обрезая лишнее */
    object-position: center;
    transition: transform 0.3s ease;
}

.car-card:hover .car-card__image img {
    transform: scale(1.05);
}

/* Лоадер для загрузки фото */
.image-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8f8f8;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.image-loader::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid #2c5282;
    border-radius: 50%;
    animation: imageSpin 1s linear infinite;
}

@keyframes imageSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Бейджи на фото */
.car-card__badges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.badge {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    padding: 3px 6px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    line-height: 1.2;
}

.badge--lot {
    top: 8px;
    left: 8px;
}

.badge--rating {
    top: 8px;
    right: 8px;
}

.badge--mileage {
    bottom: 8px;
    right: 8px;
}

.car-card__content {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Контейнер для логотипа и названия */
.car-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.card__brand-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.car-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.car-card__details {
    margin-top: auto;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 5px;
}

.detail-item {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.detail-label {
    font-size: 10px;
    color: #666;
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    display: block;
}

.price-total {
    font-size: 14px;
    font-weight: 700;
    color: #e70000;
}

/* Пагинация */
#pagination-container {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 30px;
    flex-wrap: wrap;
}

#pagination-container button {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pagination-container button.active {
    color: #fff;
    background: #2c5282;
    border-color: #2c5282;
    font-weight: 600;
}

#pagination-container button:hover:not(.active):not(.dots) {
    border-color: #999;
}

#pagination-container button.dots {
    cursor: default;
    background: transparent;
    border: none;
    min-width: auto;
    width: 20px;
}

/* Лоадер при загрузке данных */
#loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    /* Высота лоадера в начале контейнера */
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 4px;
    border-bottom: 1px solid #eee;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #e70000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Сообщение об отсутствии результатов */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Предупреждение */
#brand-warning {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .cars-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .cars-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    #header_h1 h2 {
        font-size: 38px;
    }

}

@media (max-width: 768px) {
    #wrap_me_calk {
        padding: 30px 15px;
    }

    #header_h1 h2 {
        font-size: 32px;
    }

    .cars-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }


    .car-card__content {
        padding: 10px;
    }

    .car-card__title {
        font-size: 13px;
    }

    .detail-label {
        font-size: 9px;
    }

    .detail-value {
        font-size: 12px;
    }

    .price-total {
        font-size: 13px;
    }

    .filter-block {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    #stats-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    #sorting-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    #sort-select {
        width: 100%;
        min-width: auto;
    }

    .badge {
        font-size: 10px;
        padding: 2px 5px;
    }
}

@media (max-width: 576px) {
    .cars-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }


    .badge {
        font-size: 9px;
        padding: 2px 4px;
    }

    .detail-row {
        flex-direction: column;
        gap: 8px;
    }

    .detail-item {
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .detail-label {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    #header_h1 h2 {
        font-size: 28px;
    }

    .cars-grid {
        grid-template-columns: 1fr;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }


    .filter-block {
        grid-template-columns: 1fr;
    }

    #stats-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    #stats-buttons button {
        width: 100%;
    }

    #pagination-container {
        gap: 3px;
    }

    #pagination-container button {
        padding: 5px 8px;
        font-size: 12px;
        min-width: 30px;
        height: 30px;
    }
}

.car-card__footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.want-this-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 15px;
    background: #e70000;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.want-this-btn:hover {
    background: #c40000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 0, 0, 0.3);
    text-decoration: none;
    color: white;
}

.want-this-btn:active {
    transform: translateY(0);
}

/* Для мобилок */
@media (max-width: 768px) {
    .want-this-btn {
        padding: 10px 12px;
        font-size: 14px;
    }
}