/* --- Базовые настройки --- */
* {
    box-sizing: border-box;
}

/* 1. Убеждаемся, что всё тело сайта может расти */
html, body {
    height: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}


body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #ffffff;
    color: #1a1a1a;
    line-height: 1.5;
}

h1,
h2 {
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 30px;
    color: #000;
}

/* --- Сетка товаров --- */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    padding-bottom: 40px;
}

/* --- Карточка товара --- */
.car-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

.car-card:hover {
    transform: translateY(-5px);
    border-color: #000;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.car-image-container {
    width: 100%;
    padding-top: 66.66%;
    position: relative;
    overflow: hidden;
    background: #f4f4f4;
}

.car-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.car-card:hover .car-image-container img {
    transform: scale(1.05);
}

.car-info {
    padding: 20px;
    text-align: left;
}

.car-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.car-grade {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #666;
    border: 1px solid #ccc;
    padding: 2px 6px;
    margin-bottom: 12px;
}

.car-specs {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.car-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #000;
}

/* --- Статус SOLD --- */
.car-card.is-sold {
    opacity: 0.6;
}

.car-card.is-sold .car-price {
    text-decoration: line-through;
    color: #999;
}

.sold-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.sold-text {
    border: 1px solid #000;
    padding: 8px 20px;
    letter-spacing: 3px;
    background: #fff;
}

/* --- Фильтры --- */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 60px; /* Было меньше, ставим больше, чтобы оторвать от края */
    margin-bottom: 30px;
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #eee;
}

.filter-controls select {
    padding: 10px;
    border: 1px solid #ddd;
    min-width: 150px;
    flex: 1;
    cursor: pointer;
}

/* --- Модальное окно --- */
.modal {
    display: none;
    position: absolute; /* ВАЖНО: для iframe лучше absolute */
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%; /* Чтобы модалка была не меньше высоты контента */
    z-index: 99999; /* Максимальный приоритет внутри iframe */
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    padding-bottom: 50px;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: #fff;
    margin: 40px auto; /* Убираем отступ сверху здесь */
    width: 95%;
    max-width: 1000px;
    position: relative;
    height: auto !important;
    margin-bottom: 60px; /* Отступ снизу */
}

/* Кнопка закрытия — делаем её заметнее и ниже меню */
.close {
    position: fixed; /* Фиксируем, чтобы всегда была под рукой */
    top: 120px; /* Опускаем ниже меню основного сайта */
    right: 20px;
    font-size: 45px;
    color: #05fabd;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 100000;
    cursor: pointer;
}

.close:hover {
    color: red;
}

.modal-image-box {
    position: relative;
    background: #000;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Слайдер */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 24px;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
}

.slider-arrow:hover {
    background: #000;
}

.prev-btn {
    left: 0;
}

.next-btn {
    right: 0;
}

.photo-counter {
    position: absolute;
    bottom: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
}

.modal-details {
    padding: 40px;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.spec-item {
    background: #f9f9f9;
    padding: 12px;
    border: 1px solid #eee;
}

.spec-label {
    display: block;
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.spec-value {
    font-weight: 600;
}

.text-block {
    margin-top: 20px;
    padding: 15px;
    border-left: 3px solid #000;
    background: #fefefe;
}

/* Пагинация */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
    /* Позволяет кнопкам переноситься на следующую строку */
    max-width: 100%;
    /* Ограничивает по ширине экрана */
    padding: 0 20px;
}

.pagination-container button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    min-width: 40px;
    /* Делаем кнопки более аккуратными */
    transition: all 0.2s;
}

.pagination-container button:hover {
    border-color: #000;
}

.pagination-container button.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Анимации */
@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- ГЛОБАЛЬНЫЕ СТИЛИ ДЛЯ ПОИСКА (ДЛЯ ВСЕХ УСТРОЙСТВ) --- */
.filter-controls input[type="text"] {
    padding: 10px;
    border: 1px solid #ddd;
    min-width: 200px;
    flex: 2;
    font-family: inherit;
    font-size: 1rem;
}

/* --- АДАПТИВНОСТЬ ДЛЯ СМАРТФОНОВ --- */
@media (max-width: 768px) {
    .modal-content {
        margin-top: 0;
    }

    /* Уменьшаем высоту картинки, чтобы быстрее дойти до формы */
    .modal-image-box { height: 250px; }

    .modal-details { padding: 20px 15px; }

    /* Исправляем скролл для мобильных */
    .inquiry-section {
        padding-bottom: 100px; /* Большой отступ снизу, чтобы форма не «залипала» */
    }
}

/* === НОВЫЙ РЕЖИМ: СТАТИЧЕСКАЯ СТРАНИЦА (ДЛЯ IFRAME) === */

/* Прячем сам каталог, когда открыта карточка машины */
.catalog-hidden .filter-controls,
.catalog-hidden .cars-grid,
.catalog-hidden .pagination-container,
.catalog-hidden > h2 {
    display: none !important;
}

/* Делаем модалку обычной плоской страницей (отключаем всплывание) */
.modal {
    display: none;
    position: static; 
    width: 100%;
    height: auto;
    overflow: visible; 
    background-color: transparent; 
}

.modal-content {
    background-color: #fff;
    margin: 0;
    padding: 0;
    padding-top: 60px; /* Добавили полосу сверху для крестика */
    border: none; 
    width: 100%;
    max-width: 100%; /* Растягиваем на всю ширину iFrame */
}

/* Кнопка закрытия [X] (по просьбе перенесена направо над картинкой) */
.close {
    position: absolute;
    right: 20px;
    top: 5px; /* Внутри белой полосы 60px */
    font-size: 45px;
    font-weight: bold;
    color: #ff3b30; /* Красный цвет */
    cursor: pointer;
    z-index: 100000;
}
/* ВАЖНО: После этой скобки в файле ничего быть не должно */
