:root { 
    --primary: #111111;
    --accent: #c62828;
    --text: #2c3e50;
    --bg: #f8f9fa;
    --gray-light: #eeeeee;
}

/* === ГЛОБАЛЬНЫЙ СБРОС (ВАЖНО ДЛЯ СТАБИЛЬНОСТИ) === */
*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    font-family: 'Montserrat', sans-serif; 
    margin: 0; padding: 0; 
    color: var(--text); 
    background: var(--bg); 
    overflow-x: hidden; 
}

/* === HEADER === */
header { 
    height: 80px; 
    background: rgba(17, 17, 17, 0.95); 
    backdrop-filter: blur(10px); 
    position: sticky; top: 0; z-index: 1000; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.1); 
    display: flex; align-items: center; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.header-container { width: 100%; max-width: 1200px; margin: 0 auto; display: flex; align-items: center; padding: 0 20px; height: 100%; }

.logo { text-decoration: none; display: flex; align-items: center; height: 100%; }
.logo-img { height: 50px; width: auto; object-fit: contain; margin-right: 12px; }
.logo-text { color: white; font-size: 1.2rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; line-height: 1; }
.logo-text span { color: var(--accent); }
.logo-text small { font-size: 0.7rem; font-weight: 600; margin-left: 4px; opacity: 0.7; letter-spacing: 1px;}

.nav-links { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; height: 100%; align-items: center; margin-left: auto; margin-right: 40px; }
.nav-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1.5px; transition: 0.3s; position: relative; padding: 5px 0; }
.nav-links a:hover, .nav-links a.active { color: white; }
.nav-links a::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 1px; background: var(--accent); transition: 0.3s; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

.header-icons { display: flex; align-items: center; gap: 12px; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(255,255,255,0.05); border-radius: 50%; transition: 0.3s; text-decoration: none; border: 1px solid rgba(255,255,255,0.1); }
.icon-btn:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.icon-btn svg { width: 18px; height: 18px; fill: white; }

.lang-switch { display: flex; align-items: center; gap: 8px; color: white; font-size: 0.85rem; font-weight: 600; border-left: 1px solid rgba(255,255,255,0.15); padding-left: 20px; margin-left: 10px; height: 30px;}
.lang-btn { background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-weight: 600; padding: 0; font-family: inherit; font-size: inherit; transition: 0.3s; letter-spacing: 1px; text-decoration: none; }
.lang-btn:hover { color: white; }
.lang-btn.active-lang { color: white; border-bottom: 1px solid var(--accent); }

html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .nav-links { margin-left: 40px; margin-right: auto; }
html[dir="rtl"] .logo-img { margin-right: 0; margin-left: 12px; }
html[dir="rtl"] .lang-switch { border-left: none; border-right: 1px solid rgba(255,255,255,0.15); padding-left: 0; padding-right: 20px; margin-left: 0; margin-right: 10px;}

/* === ОБЩИЕ ЭЛЕМЕНТЫ (ГЛАВНАЯ / КАТАЛОГ) === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
section { padding: 100px 20px; }

.btn-main { background: var(--accent); color: white; padding: 16px 45px; text-decoration: none; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; border-radius: 50px; font-weight: 700; transition: all 0.3s ease; display: inline-block; box-shadow: 0 10px 20px rgba(198, 40, 40, 0.3); }
.btn-main:hover { background: #b71c1c; transform: translateY(-3px); box-shadow: 0 15px 30px rgba(198, 40, 40, 0.4); }

h2 { text-align: center; font-size: 2.5rem; margin-bottom: 60px; color: var(--primary); text-transform: uppercase; font-weight: 900; letter-spacing: 2px; position: relative; }
h2::after { content: ''; display: block; width: 40px; height: 3px; background: var(--accent); margin: 25px auto 0; }

.hero { background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80'); background-size: cover; background-position: center; height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center; color: white; }
.hero-content h1 { font-size: 3.5rem; margin-bottom: 20px; font-weight: 900; text-transform: uppercase; letter-spacing: 3px; }

.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 30px; }
.service-card { background: white; padding: 50px 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.03); text-align: center; transition: 0.3s; }
.service-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.08); }
.icon { font-size: 3rem; display: block; margin-bottom: 25px; opacity: 0.8; }
.service-card h3 { font-size: 1.3rem; margin-bottom: 15px; font-weight: 800; }

/* === CONTACTS === */
.contact-box { display: flex; flex-wrap: wrap; box-shadow: 0 15px 50px rgba(0,0,0,0.1); border-radius: 12px; overflow: hidden; background: white; }
.contact-info { flex: 1; min-width: 320px; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.contact-map { flex: 1; min-width: 320px; height: 500px; }
iframe { width: 100%; height: 100%; border: 0; }
.info-item { margin-bottom: 30px; }
.info-label { font-size: 0.85rem; color: #888; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; display: block; }
.info-text { font-size: 1.15rem; font-weight: 600; color: #222; line-height: 1.5; }
.info-sub { font-size: 1rem; font-weight: 400; color: #666; display: block; margin-top: 4px; }
.phone-link { color: var(--accent); text-decoration: none; font-size: 1.8rem; font-weight: 800; display: block; margin-top: 5px; }

/* === CATALOG GRID === */
.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 40px; }
.car-card { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.06); transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); display: flex; flex-direction: column; position: relative; border: 1px solid rgba(0,0,0,0.02);}
.car-card:hover { transform: translateY(-8px); box-shadow: 0 20px 50px rgba(0,0,0,0.12); }
.car-img-wrap { overflow: hidden; height: 240px; position: relative; }
.car-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.car-card:hover .car-img { transform: scale(1.08); }
.car-body { padding: 30px; flex-grow: 1; display: flex; flex-direction: column; }
.car-title { font-size: 1.4rem; font-weight: 800; margin: 0 0 15px; color: var(--primary); line-height: 1.3; letter-spacing: -0.5px; }
.car-specs-row { display: flex; justify-content: flex-start; gap: 15px; margin-bottom: 25px; color: #666; font-size: 0.85rem; font-weight: 500; }
.spec-item { position: relative; padding-right: 15px; }
.spec-item:not(:last-child)::after { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 12px; background: #ddd; }
.car-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f0f0f0; padding-top: 20px; }
.car-price { font-size: 1.5rem; font-weight: 800; color: #111; letter-spacing: -0.5px; }
.btn-arrow { width: 45px; height: 45px; border-radius: 50%; background: #f5f5f5; display: flex; align-items: center; justify-content: center; transition: 0.3s; color: #111; }
.btn-arrow:hover { background: var(--primary); color: white; }
.btn-arrow svg { width: 16px; height: 16px; fill: currentColor; }

/* =========================================
   СТРАНИЦА АВТОМОБИЛЯ (ОБНОВЛЕННАЯ ВЕРСТКА)
   ========================================= */

.page-content {
    padding-top: 40px;
    padding-bottom: 80px;
    min-height: 80vh; /* Чтобы футер не прилипал к верху */
}

/* Кнопка Назад */
.top-bar { margin-bottom: 30px; }
.back-link {
    text-decoration: none;
    color: #666;
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}
.back-link:hover { color: var(--accent); transform: translateX(-5px); }
html[dir="rtl"] .back-link:hover { transform: translateX(5px); }

/* Контейнер карточки (Flexbox) */
.detail-wrapper {
    display: flex; 
    gap: 50px;     
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.06);
    align-items: flex-start; 
    width: 100%;
}

/* Левая колонка - Фото */
.detail-gallery {
    flex: 1;      /* Занимает 1 долю ширины */
    min-width: 0; /* Важно для сжатия картинок */
}

.main-img-box {
    width: 100%;
    aspect-ratio: 4/3; /* Стабильная пропорция */
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid rgba(0,0,0,0.05);
}
.main-img-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumbs-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.thumb-item {
    width: 80px; height: 60px; flex-shrink: 0; cursor: pointer;
    border-radius: 6px; overflow: hidden; opacity: 0.6; transition: 0.2s;
    border: 2px solid transparent;
}
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item:hover, .thumb-item.active { opacity: 1; border-color: var(--primary); }

/* Правая колонка - Инфо */
.detail-info {
    flex: 1; /* Занимает 1 долю ширины */
}

.car-title {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
    color: var(--primary);
}

.car-price {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

/* Характеристики */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}
.spec-card {
    background: #f9f9f9; padding: 15px 10px; border-radius: 10px;
    text-align: center; border: 1px solid #eee;
}
.spec-card .label { display: block; font-size: 0.75rem; color: #888; font-weight: 700; text-transform: uppercase; margin-bottom: 5px; }
.spec-card .value { display: block; font-size: 1.1rem; font-weight: 800; color: #111; }

/* === ОПИСАНИЕ (СВОРАЧИВАЕМОЕ) === */
.description-wrapper {
    margin-bottom: 30px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    position: relative;
}

.description-box {
    font-size: 1rem;
    line-height: 1.7;
    color: #444;
    max-height: 160px;        /* Высота в свернутом виде */
    overflow: hidden;         /* Скрываем лишнее */
    position: relative;
    transition: max-height 0.5s ease;
}

.description-box.expanded {
    max-height: 2000px;       /* Высота в развернутом виде */
}

.desc-gradient {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 80px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    pointer-events: none;
    transition: opacity 0.3s;
}
.description-box.expanded .desc-gradient { opacity: 0; }

.btn-read-more {
    display: block; width: 100%; text-align: center; padding: 10px 0 0 0;
    color: var(--accent); font-weight: 700; font-size: 0.9rem;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    background: none; border: none; outline: none;
}
.btn-read-more:hover { text-decoration: underline; }
.btn-read-more span { display: inline-flex; align-items: center; gap: 5px; }

/* Кнопки действий */
.actions-row { display: flex; gap: 15px; flex-wrap: wrap; }

.btn {
    flex: 1; padding: 16px 20px; border-radius: 50px;
    text-align: center; font-weight: 700; text-transform: uppercase;
    text-decoration: none; transition: 0.3s; letter-spacing: 1px;
    font-size: 0.9rem; min-width: 150px;
    display: inline-flex; justify-content: center; align-items: center;
}
.btn-whatsapp { background: #25D366; color: white; box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3); }
.btn-whatsapp:hover { background: #1ebc57; transform: translateY(-2px); }
.btn-call { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-call:hover { background: var(--primary); color: white; }

/* Waze Button */
.btn-waze {
    display: inline-flex; align-items: center; gap: 10px;
    background-color: #33ccff; color: white !important;
    padding: 10px 22px; border-radius: 50px; text-decoration: none;
    font-weight: 700; font-size: 0.9rem; margin-top: 15px;
    box-shadow: 0 4px 15px rgba(51, 204, 255, 0.3);
    transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 1px;
}
.btn-waze:hover { background-color: #00aadd; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(51, 204, 255, 0.4); }
.btn-waze svg { width: 22px; height: 22px; fill: white; }

.not-found-box { text-align: center; padding: 100px 0; }
footer { background: #111; color: #666; text-align: center; padding: 40px; font-size: 0.8rem; letter-spacing: 1px; border-top: 1px solid #222; }

/* =========================================
   MOBILE / RESPONSIVE (ТЕЛЕФОНЫ)
   ========================================= */
@media (max-width: 992px) {
    header { height: auto; padding: 15px 0; }
    .header-container { flex-direction: column; gap: 15px; }
    .nav-links { margin: 0; width: 100%; justify-content: center; flex-wrap: wrap;}
    .header-icons { width: 100%; justify-content: center; }
    
    /* Страница авто: одна колонка */
    .detail-wrapper {
        flex-direction: column; 
        padding: 20px;
        gap: 30px;
    }

    .detail-gallery, .detail-info {
        width: 100%;
        flex: none;
        text-align: center; /* Центрируем тексты */
    }

    /* Увеличиваем шрифты для мобильных */
    .car-title { font-size: 1.8rem; text-align: center; }
    
    /* Цену по центру */
    .car-price { 
        font-size: 1.8rem; margin-bottom: 20px; 
        justify-content: center; display: flex; 
    }
    
    .specs-grid { justify-content: center; }
    
    /* Кнопки друг под другом */
    .actions-row { flex-direction: column; }
    .btn { width: 100%; }
}
/* === ЛАЙТБОКС (ПРОСМОТР ФОТО) === */
.lightbox {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    z-index: 9999;
    padding-top: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform:scale(0.8); opacity: 0;} 
    to {transform:scale(1); opacity: 1;}
}

/* Кнопка закрытия */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10001;
    line-height: 1;
}
.lightbox-close:hover { color: #c62828; }

/* Кнопки Вперед/Назад */
.lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 20px;
    margin-top: -25px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s;
    user-select: none;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}
.lightbox-next { right: 20px; }
.lightbox-prev { left: 20px; }
.lightbox-prev:hover, .lightbox-next:hover { background-color: rgba(198, 40, 40, 0.8); }

/* Счетчик слайдов */
.lightbox-counter {
    color: #ccc;
    font-size: 14px;
    margin-top: 15px;
    letter-spacing: 1px;
}

/* Курсор лупы для главной картинки */
#active-car-img { cursor: zoom-in; }

/* Адаптив для телефонов */
@media (max-width: 768px) {
    .lightbox-prev, .lightbox-next { padding: 15px; font-size: 20px; background: rgba(0,0,0,0.5); }
    .lightbox-content { max-width: 100%; max-height: 70vh; }
}