/* === MOBILE OPTIMIZATION FIX === */
/* Critical fixes for mobile overflow issues */

/* Base mobile setup */
@media (max-width: 768px) {
    /* Prevent all overflow */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw;
        position: relative;
    }

    * {
        box-sizing: border-box;
    }

    .container {
        max-width: 100% !important;
        padding: 0 16px !important;
        overflow: hidden;
    }

    /* Product Gallery Fixes */
    .product-gallery {
        overflow: hidden;
        margin: 0 -12px;
        padding: 0 12px;
    }

    .main-image {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .main-image img {
        width: 100% !important;
        max-width: 100%;
        height: 350px;
        object-fit: cover;
    }

    .image-badge {
        max-width: 90%;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Thumbnail Slider Fix - Critical */
    .thumbnail-slider {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 0 4px;
    }

    .thumbnails {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px 0;
        max-width: 100%;
    }

    .thumbnails::-webkit-scrollbar {
        display: none;
    }

    .thumbnail {
        width: 70px;
        height: 70px;
        min-width: 70px;
        flex-shrink: 0;
    }

    .slider-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        flex-shrink: 0;
    }

    /* Product Info */
    .product-title {
        font-size: 22px;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .product-features {
        flex-wrap: wrap;
        width: 100%;
    }

    .feature-item {
        font-size: 13px;
        white-space: nowrap;
    }

    /* Badges */
    .badge-hot {
        font-size: 12px;
        padding: 6px 12px;
        max-width: calc(100% - 20px);
        white-space: normal;
        text-align: center;
        line-height: 1.3;
    }

    /* Buttons - Full Width */
    .cart-actions {
        width: 100%;
    }

    .btn {
        width: 100%;
        max-width: 100%;
        padding: 14px 20px;
        font-size: 14px;
        white-space: normal;
        text-align: center;
        line-height: 1.4;
    }

    /* Variants - Fix Overflow */
    .variant-options {
        width: 100%;
    }

    .variant-option {
        width: 100%;
        max-width: 100%;
        padding: 12px;
    }

    /* Text Wrapping */
    h1, h2, h3, h4, h5, h6, p, span {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Section Spacing */
    section {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .product-wrapper {
        max-width: 100%;
        width: 100%;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px !important;
    }

    /* Thumbnail even smaller */
    .thumbnail {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }

    .thumbnails {
        gap: 6px;
    }

    .main-image img {
        height: 300px;
    }

    .product-title {
        font-size: 18px;
    }

    .badge-hot {
        font-size: 11px;
        padding: 5px 10px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    .variant-option {
        padding: 10px 8px;
    }

    .variant-image {
        width: 60px;
        height: 60px;
    }
}

