/* =================================================
   9. МОБИЛЬНАЯ АДАПТАЦИЯ (@media max-width: 768px)
   ================================================= */

@media (max-width: 768px) {
    /* Общая структура */
    html, body { overflow-x: clip; width: 100%; }
    
    /* Страница товара (отступ 65px под прилипающую панель) */
    .single-product { 
        padding-bottom: 65px; 
    }

    /* Страница корзины (отступ 97px) */
    .woocommerce-cart { 
        padding-bottom: 97px; 
    }

    .product-page-wrap { padding: 0 10px 16px; }
    .product-layout-custom { display: flex; flex-direction: column; gap: 16px; }
    .product-left, .product-right { display: contents; }
    
    .product-left-cell, .product-right-cell { 
        width: 100%; padding: 20px 15px !important; box-sizing: border-box; 
    }
  
    .woocommerce-checkout form.checkout {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Порядок блоков */
    .cell-title { order: 1; }
    .cell-price { order: 2; }
    .cell-delivery { order: 3; }
    .cell-related { order: 4; }
    .cell-attributes { order: 5; }
    .cell-description { order: 6; }
    .cell-reviews { order: 7; }

    /* Галерея на мобилках */
    .product-gallery-main {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .product-gallery-main::-webkit-scrollbar { display: none; }

    .product-gallery-main-item {
        flex: 0 0 100% !important;
        min-width: 100% !important;
        scroll-snap-align: start !important;
    }

    .product-gallery-thumbs-wrapper, .gallery-arrow { display: none !important; }

    /* Липкая панель заказа (Sticky) */
    .single-product .product-right form.cart {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #fff !important;
        border-top: 1px solid #eee !important;
        padding: 10px 40px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        z-index: 9999 !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
        margin: 0 !important;
    }

    .mobile-sticky-price {
        flex: 1 !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #107b1e !important;
        white-space: nowrap;
    }

    .single-product .product-right form.cart .quantity {
        flex: 0 0 60px !important;
        margin: 0 !important;
    }
    .single-product .product-right form.cart .quantity input.qty {
        width: 100% !important;
        height: 44px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px;
        text-align: center;
    }

    .single-product .product-right form.cart button.single_add_to_cart_button {
        flex: 0 0 50px !important;
        width: 50px !important;
        height: 44px !important;
        text-indent: -9999px !important;
        position: relative !important;
        background-color: #ff5a00 !important;
        border-radius: 6px !important;
        border: none !important;
    }

    .single-product .product-right form.cart button.single_add_to_cart_button::before {
        content: "" !important;
        position: absolute !important;
        top: 0; left: 0; right: 0; bottom: 0;
        text-indent: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'%3E%3C/line%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 24px;
    }

    .mobile-sticky-cart-link {
        flex: 0 0 40px !important;
        position: relative !important;
        display: block !important;
        text-decoration: none;
    }

    .cart-badge {
        position: absolute !important;
        top: -8px !important;
        right: -8px !important;
        background: #ff5a00 !important;
        color: #fff !important;
        font-size: 10px !important;
        min-width: 18px !important;
        height: 18px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-weight: bold;
    }

 /* Поповеры и прочее */
    .brand-popover { display: none; }
    .brand-popover.is-open { display: block !important; }
}