/* =========================================
   18. АДАПТИВНОСТЬ (МОБИЛЬНЫЕ)
   ========================================= */

@media (max-width: 1100px) {
    .nav { gap: 15px; }
    .nav__link { font-size: 15px; }
    .nav-catalog__btn { padding: 10px 18px; font-size: 15px; }
}

@media (max-width: 992px) {
    .category-card { width: calc(50% - 12px); }
    .partner-card { width: calc(33.333% - 16px); }
}

@media (max-width: 900px) {
    .header__search { display: none; }
    .header__search-toggle { display: inline-flex; }
    .header__search--open {
        display: flex !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-color);
        height: 56px;
        background: #fff;
        z-index: 200;
    }
    .product-page {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px;
    }
    .footer__top {
        flex-direction: column;
        gap: 40px;
    }
    .footer__brand {
        max-width: 100%;
    }
    .footer__slogan {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    /* Шапка */
    :root { --header-height: 70px; }
    .nav { display: none !important; }
    .header__top { display: none; }
    .header__inner { height: 70px; gap: 12px; }
    .logo__img { height: 40px; max-width: 130px; }
    .header__actions { gap: 4px !important; }
    .header__actions .btn--icon { padding: 4px 8px !important; font-size: 20px !important; }

    /* Бургер и каталог */
    .header__burger {
        display: inline-flex !important;
        font-size: 24px;
        padding: 8px 12px;
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--text-main);
    }
    .header__mobile-catalog {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap;
        height: 40px;
    }

    /* Скрываем каталог в основном меню */
    .nav-catalog { display: none; }

    /* Остальное */
    .hero__title { font-size: 30px; }
    .breadcrumbs { font-size: 12px; gap: 6px; margin-top: 16px; }
    .subcategories-grid { flex-direction: column; align-items: center; }
    .subcategory-card { width: 100%; max-width: 300px; }
    .category-grid { gap: 16px; }
    .category-card { width: 100%; max-width: 100%; }
    .category-card__image { height: 140px; }
    .category-card__title { padding: 12px; font-size: 15px; }
    .page-content { padding: 20px; }
    .contact-item { flex-direction: column; align-items: flex-start; gap: 4px; }

    /* Кнопка назад */
    .btn-back-fixed { bottom: 20px; right: 20px; padding: 12px 24px; font-size: 14px; }

    /* Админка */
    .admin-products { grid-template-columns: 1fr; }
    .section-title { font-size: 22px; }

    /* Страница товара */
    .product-page__buy > div {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    .product-page__buy .js-qty-minus,
    .product-page__buy .js-qty-plus {
        padding: 0 20px !important;
    }
    .product-page__buy .btn {
        width: 100%;
        justify-content: center;
    }
    .product-page__main-image img {
        padding: 10px !important;
    }
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .tabs::-webkit-scrollbar {
        display: none;
    }
    .tabs__item {
        white-space: nowrap;
        padding: 12px 14px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 600px) {
    .footer { padding: 40px 0 20px; }
    .footer__contact-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .footer__logo { height: 56px; }
    .footer__slogan { font-size: 16px; margin-bottom: 24px; }
    .footer__contacts { font-size: 14px; }
    .footer__bottom { font-size: 11px; }
    .partners-grid { gap: 12px; }
    .partner-card { width: calc(50% - 6px); padding: 16px 8px; min-width: 140px; }
    .partner-card__logo { height: 50px; margin-bottom: 8px; }
    .partner-card__name { font-size: 11px; }
}

@media (max-width: 480px) {
    .header__inner {
        height: auto !important;
        padding: 12px 0;
        flex-wrap: wrap;
    }
    .header__user { display: none; }
    .btn--icon { padding: 4px 6px !important; font-size: 18px !important; }
    .cart-badge { font-size: 10px !important; padding: 1px 5px !important; top: -4px !important; right: -4px !important; }
}

/* =========================================
   ТЕЛЕФОНЫ: страница товара, корзина, кнопка «Назад»
   ========================================= */
@media (max-width: 768px) {
    /* Товар: фото → название, цена, кнопки → описание */
    .product-page {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 16px;
        margin-top: 12px !important;
    }
    .product-page__media { display: contents; }
    .product-page__gallery { order: 1; margin-bottom: 0; }
    .product-page__info    { order: 2; }
    .product-page .tabs-block { order: 3; }
    .product-page__main-image { margin-bottom: 8px; }
    .product-page__thumb { width: 56px; height: 56px; }
    .product-page__title { font-size: 20px; line-height: 1.3; }
    .product-page__sku { margin-bottom: 10px; }
    .product-page__price { font-size: 26px; margin-bottom: 8px; }
    .product-page__buy { margin-top: 12px !important; }
    .product-page__buy > div { gap: 10px !important; }
    .product-page__buy > div > div:first-child { width: 100%; }
    .product-page__buy #product-qty { flex: 1; }
    .product-page__info-blocks { margin-top: 16px !important; gap: 10px !important; }
    .product-page__info-blocks > div { max-width: none !important; padding: 12px 14px !important; }
    .tabs { flex-wrap: wrap; overflow: visible; padding: 0 8px; }
    .tabs__item { padding: 10px 8px !important; font-size: 11px !important; }
    .tabs-content { padding: 16px; font-size: 14px; }

    /* Корзина: фото | название + артикул | ✕ ; ниже — сумма слева, количество справа */
    .cart-item {
        grid-template-columns: 64px 1fr 28px !important;
        grid-template-areas:
            "img title remove"
            "price price qty" !important;
        gap: 10px 12px !important;
        align-items: center !important;
    }
    .cart-item > div:nth-child(2) { align-self: start; }
    .cart-item__qty { grid-column: 2 / 4; grid-row: 2; justify-self: end !important; }
    .cart-item__price { grid-column: 1 / 3; grid-row: 2; margin-top: 0 !important; }
    .cart-item__qty .btn { width: 36px; height: 36px !important; padding: 0 !important; }

    /* «Назад» — маленькая круглая кнопка-стрелка, не закрывает текст и кнопки */
    .btn-back-fixed {
        width: 48px;
        height: 48px;
        padding: 0 !important;
        right: 14px !important;
        bottom: 14px !important;
        border-radius: 50%;
        justify-content: center;
        font-size: 0 !important;
        gap: 0;
        opacity: 0.92;
    }
    .btn-back-fixed::before {
        content: "←";
        font-size: 22px;
        line-height: 1;
    }
    .btn-back-fixed:hover { transform: none; }
}
