/* =====================================================
   HOME PAGE STYLES (Full Transfer from index.html)
   ===================================================== */

/* =====================================================
   1. CRITICAL FIXES (Для работы бургер-меню)
   Перенесено из начала <style> index.html
   ===================================================== */
   html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    overflow-x: hidden !important;
    max-width: 100vw;
    position: relative;
}

/* Фикс для бургер-меню, чтобы оно открывалось корректно */
@media (max-width: 968px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 85vw; /* 🔥 ключевое изменение из index.html */
        height: 100vh;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        background: rgba(26, 31, 46, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 1.5rem 2rem 1.5rem;
        gap: 0;
        overflow-y: auto;
        z-index: 1001;
        visibility: hidden;
        pointer-events: none;
    }

    .main-nav.active {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    /* Блокировка body при открытом меню */
    body.menu-open {
        overflow: hidden !important;
    }
}

/* =====================================================
   2. HERO SECTION
   ===================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

@media (min-width: 769px) {
    .hero {
        padding-left: 5%;
        padding-right: 5%;
    }
}

.hero-car-bg {
    position: absolute;
    inset: 0;
    background: url('/AVTO.jpg') center/cover no-repeat;
    z-index: 0;
    animation: heroImageFadeIn 1.5s ease-out forwards;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(26, 31, 46, 0.7) 0%,
        rgba(26, 31, 46, 0.4) 50%,
        rgba(26, 31, 46, 0.7) 100%
    );
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: var(--text-light);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
    letter-spacing: 2px;
    animation: fadeInUp 1s ease;
    width: 100%;
    text-align: center;
}

.hero p {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--text-light);
    margin-bottom: 3rem;
    max-width: 800px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    /* ВАЖНО: backwards предотвращает "мигание" текста перед анимацией */
    animation: fadeInUp 1s ease 0.3s backwards;
    width: 100%;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.hero .btn-primary {
    /* Добавлена анимация для кнопки в Hero, как было в index.html */
    animation: fadeInUp 1s ease 0.6s backwards;
}

/* =====================================================
   3. ABOUT SECTION
   ===================================================== */
.about {
    background: var(--overlay-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
    position: relative;
}

.about h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 3rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.about-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(45, 55, 72, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.1);
    transition: all 0.3s ease;
    /* Фикс для IntersectionObserver анимаций */
    will-change: transform, opacity;
}

.about-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(45, 55, 72, 0.2);
    border-color: var(--accent-blue);
}

.about-card h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.about-card p {
    color: #4a5568;
    line-height: 1.6;
}

/* =====================================================
   4. SLIDER SECTION
   ===================================================== */
.slider-section {
    background: var(--overlay-dark);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
}

.slider-section h2 {
    color: var(--text-light);
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
}

.slider {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    height: 500px;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.slider-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.slider-arrow:hover {
    background: rgba(255, 255, 255, 0.5);
}

.slider-arrow.left { left: 20px; }
.slider-arrow.right { right: 20px; }

/* =====================================================
   5. SERVICES SECTION
   ===================================================== */
.services {
    background: var(--overlay-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
}

.services h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 3rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* Точная логика сетки (3 -> 2 -> 1 колонка) из оригинала */
@media (min-width: 969px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .service-card:last-child:nth-child(3n + 1) {
        grid-column: 2 / 3;
    }
    
    .service-card:nth-last-child(2):nth-child(3n + 1) {
        grid-column: 1 / 2;
    }
    
    .service-card:nth-last-child(2):nth-child(3n + 1) ~ .service-card {
        grid-column: 3 / 4;
    }
}

@media (max-width: 968px) and (min-width: 601px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .service-card:last-child:nth-child(2n + 1) {
        grid-column: 1 / -1;
        max-width: 350px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
}

.service-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(45, 55, 72, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.1);
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(45, 55, 72, 0.2);
    border-color: var(--accent-orange);
}

.service-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.service-content {
    padding: 2rem;
}

.service-content h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.service-content p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* =====================================================
   6. PRICING SECTION
   ===================================================== */
.pricing {
    background: var(--overlay-dark);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
}

.pricing h2 {
    color: var(--text-light);
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
}

.pricing-table {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(247, 250, 252, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.pricing-row {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
    color: var(--text-light);
    transition: background 0.3s ease;
    text-align: center;
}

.pricing-row:hover {
    background: rgba(74, 144, 226, 0.1);
}

.pricing-row:last-child {
    border-bottom: none;
}

/* =====================================================
   7. SEO TEXT
   ===================================================== */
.seo-text {
    background: var(--overlay-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 4rem 2rem;
}

.seo-text h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 2rem;
}

.seo-content {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 15px;
    border: 1px solid rgba(74, 144, 226, 0.2);
    line-height: 1.8;
    color: #4a5568;
}

.seo-content p { margin-bottom: 1.2rem; }
.seo-content strong { color: var(--text-dark); }

/* =====================================================
   8. FAQ SECTION
   ===================================================== */
.faq {
    background: var(--overlay-dark);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
}

.faq h2 {
    color: var(--text-light);
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    background: rgba(247, 250, 252, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(74, 144, 226, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover { border-color: var(--accent-blue); }

.faq-question {
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.faq-question:hover { background: rgba(74, 144, 226, 0.1); }

.faq-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon { transform: rotate(45deg); }

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    color: var(--text-light);
    padding: 0 1.5rem;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.faq-answer p { line-height: 1.7; opacity: 0.9; }

/* =====================================================
   9. DIRECTIONS & CONTACTS
   ===================================================== */
.directions {
    background: var(--overlay-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
}

.directions h2 {
    color: var(--text-dark);
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
}

.directions-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: start;
}

.directions-info {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 15px;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.directions-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(74, 144, 226, 0.1);
}

.directions-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.directions-label {
    font-size: 0.9rem;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.directions-value {
    font-size: 1.2rem;
    color: var(--text-dark);
    line-height: 1.6;
}

.directions-value a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.directions-value a:hover { color: var(--accent-orange); }

.address-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.directions-map {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    height: 450px;
    border: 2px solid rgba(74, 144, 226, 0.2);
}

.directions-map iframe { width: 100%; height: 100%; border: none; }

/* =====================================================
   10. CTA
   ===================================================== */
.cta {
    background: var(--overlay-dark);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 5rem 2rem;
    text-align: center;
}

.cta h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* =====================================================
   11. MOBILE ADAPTIVE (Полная копия поведения)
   ===================================================== */
@media (max-width: 968px) {
    .directions-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .directions-map {
        height: 350px;
        order: 2; /* Карта под описанием */
    }
}

@media (max-width: 768px) {
    .hero-car-bg {
        /* Переключение на мобильный фон */
        background-image: url('/MobileAVTO.png');
        background-size: cover;
        background-position: center center;
    }
    
    .hero {
        min-height: 100vh;
        padding: 2rem 1rem;
    }
    
    .hero::before {
        background: linear-gradient(
            to bottom,
            rgba(26, 31, 46, 0.8) 0%,
            rgba(26, 31, 46, 0.5) 40%,
            rgba(26, 31, 46, 0.8) 100%
        );
    }

    .hero-content { width: 100%; max-width: 100%; }

    .hero h1 {
        font-size: 2rem;
        letter-spacing: 1px;
        margin-bottom: 1rem;
        padding: 0 0.5rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 0.5rem;
        line-height: 1.5;
    }
    
    .hero .btn-primary {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .slider { height: 300px; }

    .slider-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .address-actions { flex-direction: column; }
    
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .about, .services, .pricing, .directions, .cta, .slider-section, .seo-text, .faq {
        padding: 3rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-car-bg {
        background-image: url('/MobileAVTO.png');
        background-size: cover;
        background-position: center center;
    }
    
    .hero { padding: 1.5rem 0.75rem; }

    .hero h1 {
        font-size: 1.6rem;
        margin-bottom: 0.8rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }

    .hero .btn-primary {
        padding: 0.9rem 1.8rem;
        font-size: 0.95rem;
    }

    .about h2, .services h2, .pricing h2, .directions h2, .cta h2, .slider-section h2, .faq h2, .seo-text h2 {
        font-size: 1.75rem;
    }
}