﻿/* ============================================
   HOME-RESPONSIVE.CSS — адаптив главной AG-MOTOR
   ============================================ */

/* ===== ОБЩИЙ КОНТЕЙНЕР — не даём контенту вылезать ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
    }

    .container,
    .container-fluid {
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
    }
}

/* ===== ШАПКА (HEADER/NAVBAR) ===== */
@media (max-width: 768px) {
    /* Шапка — компактная */
    header,
    .navbar,
    .site-header {
        padding: 10px 15px !important;
        flex-wrap: wrap !important;
    }

    /* Логотип — поменьше */
    .logo,
    .navbar-brand,
    .logo img {
        max-width: 140px !important;
        height: auto !important;
    }

    /* Меню — в столбик по центру */
    .nav-menu,
    .navbar-nav,
    nav ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
        padding: 10px 0 !important;
        margin: 10px 0 !important;
    }

        .nav-menu li,
        .navbar-nav li {
            width: auto !important;
        }

        .nav-menu a,
        .navbar-nav a {
            font-size: 14px !important;
            padding: 6px 12px !important;
        }

    /* Кнопки справа (Корзина, Войти, Регистрация) — в столбик */
    .header-actions,
    .navbar-actions,
    .user-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 10px !important;
    }

        .header-actions .btn,
        .navbar-actions .btn {
            width: 100% !important;
            max-width: 200px !important;
            padding: 10px 16px !important;
            font-size: 13px !important;
        }

    /* Корзина — компактная */
    .cart-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    /* Поиск — на всю ширину */
    .search-box,
    .search-form {
        width: 100% !important;
        margin-top: 10px !important;
    }

        .search-box input {
            width: 100% !important;
        }
}

/* ===== HERO-СЕКЦИЯ ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 20px 60px !important;
        min-height: auto !important;
        background-attachment: scroll !important; /* отключаем fixed на мобильных */
    }

    .hero-content {
        max-width: 100% !important;
    }

    .hero-section h1 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 30px !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Фичи — в столбик */
    .features-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin-bottom: 30px !important;
    }

    .feature-item {
        flex-direction: row !important;
        align-items: center !important;
        gap: 15px !important;
    }

    .feature-icon {
        font-size: 2rem !important;
        flex-shrink: 0 !important;
    }

    .feature-text h3 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }

    /* Кнопка "Разделы каталога" */
    .catalog-btn {
        display: block !important;
        width: 100% !important;
        max-width: 280px !important;
        margin: 0 auto !important;
        padding: 14px 24px !important;
        font-size: 1rem !important;
        text-align: center !important;
    }
}

/* ===== РАЗДЕЛЫ КАТАЛОГА ===== */
@media (max-width: 768px) {
    .categories-section {
        padding: 40px 15px !important;
    }

        .categories-section h2,
        .section-title {
            font-size: 1.6rem !important;
            text-align: left !important;
            margin-bottom: 25px !important;
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
        }

        /* Сетка категорий — в 1 колонку */
        .categories-grid,
        .categories-section > div > div[style*="grid-template-columns"] {
            grid-template-columns: 1fr !important;
            gap: 20px !important;
        }

        /* Карточки категорий */
        .category-card,
        .categories-section a[style*="background: #fff"] {
            padding: 20px !important;
        }

            .category-card h3,
            .categories-section a[style*="background: #fff"] h3 {
                font-size: 1.2rem !important;
                margin-bottom: 10px !important;
            }

            .category-card p {
                font-size: 0.9rem !important;
                line-height: 1.5 !important;
            }

            /* Тёмная карточка "Прочие товары" */
            .category-card.dark,
            .categories-section > div > div[style*="background: #000"] {
                padding: 20px !important;
                margin-top: 0 !important;
            }

                .category-card.dark h3 {
                    font-size: 1.3rem !important;
                    margin-bottom: 15px !important;
                }

                .category-card.dark li {
                    font-size: 0.85rem !important;
                    padding: 6px 0 !important;
                }
}

/* ===== О КОМПАНИИ ===== */
@media (max-width: 768px) {
    .home-about-section {
        padding: 40px 20px !important;
    }

    .home-about-container {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center !important;
    }

    .home-about-image {
        order: -1 !important; /* картинка сверху */
        max-width: 250px !important;
        margin: 0 auto !important;
    }

    .home-about-image-wrapper {
        width: 200px !important;
        height: 200px !important;
        max-height: 250px !important;
    }

    .home-about-content {
        text-align: center !important;
    }

        .home-about-content h2 {
            font-size: 1.8rem !important;
            margin-bottom: 20px !important;
        }

        .home-about-content p {
            font-size: 0.95rem !important;
            line-height: 1.6 !important;
            margin-bottom: 15px !important;
        }

    .home-about-btn {
        display: inline-block !important;
        margin-top: 15px !important;
        padding: 12px 30px !important;
    }
}

/* ===== ХИТЫ ПРОДАЖ ===== */
@media (max-width: 768px) {
    .bestsellers-section {
        padding: 40px 15px !important;
    }

        .bestsellers-section h2 {
            font-size: 1.6rem !important;
            text-align: left !important;
            margin-bottom: 25px !important;
        }

    /* Карточки — в 1 колонку */
    .bestsellers-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .bestseller-card {
        max-width: 100% !important;
    }

    .bestseller-image {
        height: 200px !important;
    }

    .bestseller-card h3 {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    .bestseller-subtitle {
        font-size: 0.85rem !important;
    }

    .bestseller-price {
        font-size: 1.5rem !important;
        margin-bottom: 15px !important;
    }

    .add-to-cart-btn {
        padding: 10px !important;
        font-size: 0.95rem !important;
    }
}

/* ===== ФУТЕР ===== */
@media (max-width: 768px) {
    footer {
        padding: 40px 20px !important;
    }

        .footer-content,
        .footer-columns,
        footer .row {
            display: flex !important;
            flex-direction: column !important;
            gap: 30px !important;
        }

    .footer-column {
        text-align: center !important;
    }

    .footer-logo {
        display: flex !important;
        justify-content: center !important;
        margin-bottom: 20px !important;
    }

    .footer-column h4 {
        font-size: 1.1rem !important;
        margin-bottom: 15px !important;
    }

    .footer-column ul {
        list-style: none !important;
        padding: 0 !important;
    }

        .footer-column ul li {
            margin-bottom: 8px !important;
        }

            .footer-column ul li a {
                font-size: 0.9rem !important;
            }

    .footer-bottom {
        text-align: center !important;
        margin-top: 30px !important;
        padding-top: 20px !important;
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 375px) ===== */
@media (max-width: 375px) {
    .hero-section h1 {
        font-size: 1.5rem !important;
    }

    .categories-section h2,
    .bestsellers-section h2 {
        font-size: 1.4rem !important;
    }

    .home-about-content h2 {
        font-size: 1.5rem !important;
    }

    .feature-text h3 {
        font-size: 0.85rem !important;
    }
}
/* ============================================
   ШАПКА AG-MOTOR — АДАПТИВ
   ============================================ */

@media (max-width: 768px) {
    /* Основной контейнер шапки — в столбик */
    .header-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 15px !important;
        gap: 15px !important;
    }

    /* Логотип — по центру */
    .logo {
        margin: 0 auto !important;
        display: block !important;
    }

    .logo-img {
        max-width: 160px !important;
        height: auto !important;
    }

    /* Меню — по центру, перенос разрешён */
    .main-menu {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 12px !important;
        width: 100% !important;
        padding: 10px 0 !important;
    }

        .main-menu a {
            font-size: 14px !important;
            white-space: nowrap !important;
            padding: 6px 10px !important;
        }

    /* Правая панель (корзина + кнопки) — в столбик по центру */
    .header-right {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
    }

    /* Корзина — по центру */
    .cart-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 10px 20px !important;
        font-size: 14px !important;
    }

    /* Кнопки Войти/Регистрация — в ряд по центру */
    .header-auth-buttons {
        display: flex !important;
        gap: 10px !important;
        justify-content: center !important;
        width: 100% !important;
    }

        .header-auth-buttons .btn-login,
        .header-auth-buttons .btn-register {
            padding: 10px 20px !important;
            font-size: 14px !important;
        }

    /* Блок с информацией о пользователе (после входа) */
    .header-user-info {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
    }

        .header-user-info .btn-admin,
        .header-user-info .btn-manager,
        .header-user-info .btn-logout {
            padding: 8px 14px !important;
            font-size: 13px !important;
        }

    /* Форма выхода */
    .logout-form {
        margin: 0 !important;
    }

    /* Если другие секции тоже перекрываются — добавьте отступ */
    .categories-section,
    .home-about-section,
    .bestsellers-section {
        scroll-margin-top: 280px !important; /* для якорных ссылок */
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 375px) ===== */
@media (max-width: 375px) {
    .logo-img {
        max-width: 130px !important;
    }

    .main-menu a {
        font-size: 13px !important;
        padding: 5px 8px !important;
    }

    .cart-btn {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
}

/* ============================================
   УМНАЯ ШАПКА — скрывается при скролле вниз
   ============================================ */

@media (max-width: 768px) {
    .site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background: #FFE733 !important;
        transition: transform 0.3s ease !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    }

        /* Сдвиг вверх при скрытии */
        .site-header.header-hidden {
            transform: translateY(-100%) !important;
        }

    /* Отступ для контента, чтобы шапка не перекрывала */
    body {
        padding-top: 0 !important;
    }

    .hero-section {
        margin-top: 0 !important;
        padding-top: 340px !important; /* отступ под фиксированную шапку */
    }
}

/* ============================================
   ФИКСИРОВАННАЯ ШАПКА НА ДЕСКТОПЕ
   ============================================ */

@media (min-width: 769px) {
    .site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background: #FFE733 !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    }

    /* Отступ для контента, чтобы шапка не перекрывала */
    .hero-section {
        padding-top: 100px !important; /* подберите под высоту вашей шапки */
    }

    /* Для якорных ссылок */
    .categories-section,
    .home-about-section,
    .bestsellers-section {
        scroll-margin-top: 100px !important;
    }
}

/* ===== HERO-СЕКЦИЯ — ЦЕНТРИРОВАНИЕ ===== */

/* Контейнер по центру */
.hero-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    max-width: 900px !important;
    margin: 0 auto !important;
}

/* Заголовок по центру */
.hero-section h1 {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Фичи по центру */
.features-section {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 40px !important;
    margin: 0 auto !important;
    flex-wrap: wrap !important;
}

/* Каждая фича */
.feature-item {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    text-align: left !important;
}

.feature-text h3 {
    text-align: left !important;
    margin: 0 !important;
}

/* ===== СКРЫТЬ КНОПКУ "РАЗДЕЛЫ КАТАЛОГА" ===== */
.catalog-btn {
    display: none !important;
}

/* ===== ЗАГОЛОВКИ ПО ЦЕНТРУ ===== */

/* "Разделы каталога" */
.categories-section h2,
.categories-section .section-title {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* "Хиты продаж" */
.bestsellers-section h2,
.bestsellers-section .section-title {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

