/* ========================================
   PRODUCT IMAGE CAROUSEL FIX
   Mobile Responsive Product Images
   ======================================== */

/* ===========================================
   MAIN PRODUCT IMAGE - MOBILE FIX
   =========================================== */

.product-info-image-area,
.product-info-image-are {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
}

.product-info-image-area img,
.product-info-image-are img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: block;
    object-fit: contain;
    border-radius: 8px;
}

/* Prevent image overflow */
#mainProductImage {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 500px;
    object-fit: contain;
}

/* ===========================================
   THUMBNAIL IMAGES - MOBILE FIX
   =========================================== */

.product-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px !important;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.thumbnail-img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0;
    margin: 0 !important;
}

.thumbnail-img:hover,
.thumbnail-img:active {
    border-color: #03045e !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(3, 4, 94, 0.3) !important;
}

/* Active thumbnail indicator */
.thumbnail-img.active {
    border-color: #03045e !important;
    box-shadow: 0 4px 12px rgba(3, 4, 94, 0.4) !important;
}

/* ===========================================
   PRODUCT DETAILS SECTION - MOBILE
   =========================================== */

.product-details {
    overflow-x: hidden !important;
    width: 100%;
}

.product-details .container {
    max-width: 100%;
    overflow-x: hidden;
}

.product-details-top-area {
    overflow-x: hidden;
}

.product-details-top-area .row {
    margin: 0;
}

.product-details-top-area .col-lg-6 {
    padding-left: 15px;
    padding-right: 15px;
}

/* ===========================================
   MOBILE SPECIFIC ADJUSTMENTS
   =========================================== */

@media (max-width: 767px) {
    
    /* Main product image */
    .product-info-image-area,
    .product-info-image-are {
        margin-bottom: 20px;
        padding: 10px;
    }
    
    #mainProductImage {
        max-height: 300px;
    }
    
    /* Thumbnail images - smaller on mobile */
    .thumbnail-img {
        width: 60px !important;
        height: 60px !important;
    }
    
    /* Product info section */
    .product-details-info-area {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: 20px;
    }
    
    /* Product title */
    .product-details-info-area h3 {
        font-size: 22px !important;
        margin-bottom: 15px;
    }
    
    /* Price */
    .product-details-info-area .price {
        font-size: 24px !important;
        font-weight: 700;
        color: #03045e;
        margin-bottom: 15px;
    }
    
    /* Action buttons */
    .product-action-buttons {
        margin-top: 20px !important;
        margin-bottom: 20px;
    }
    
    .product-action-buttons .default-button {
        font-size: 14px !important;
        padding: 12px 20px !important;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    /* Social icons */
    .product-details-social-icons ul {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    /* Ensure no horizontal scroll */
    .product-details-top-area .col-lg-6 {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ===========================================
   TABLET ADJUSTMENTS (768px - 991px)
   =========================================== */

@media (min-width: 768px) and (max-width: 991px) {
    
    #mainProductImage {
        max-height: 400px;
    }
    
    .thumbnail-img {
        width: 70px !important;
        height: 70px !important;
    }
    
    .product-details-info-area {
        padding-left: 10px !important;
        margin-top: 20px;
    }
}

/* ===========================================
   LARGE MOBILE / SMALL TABLET
   =========================================== */

@media (min-width: 576px) and (max-width: 767px) {
    
    .thumbnail-img {
        width: 70px !important;
        height: 70px !important;
    }
    
    #mainProductImage {
        max-height: 350px;
    }
}

/* ===========================================
   EXTRA SMALL DEVICES (< 576px)
   =========================================== */

@media (max-width: 575px) {
    
    /* Even smaller thumbnails for tiny screens */
    .thumbnail-img {
        width: 55px !important;
        height: 55px !important;
    }
    
    .product-thumbnails {
        gap: 8px;
    }
    
    /* Compact main image */
    #mainProductImage {
        max-height: 250px;
    }
    
    .product-info-image-area,
    .product-info-image-are {
        padding: 8px;
    }
    
    /* Smaller action buttons */
    .product-action-buttons .default-button {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
}

/* ===========================================
   LANDSCAPE MODE (Mobile devices)
   =========================================== */

@media (max-width: 991px) and (orientation: landscape) {
    
    #mainProductImage {
        max-height: 200px;
    }
    
    .product-thumbnails {
        justify-content: flex-start;
    }
    
    .thumbnail-img {
        width: 50px !important;
        height: 50px !important;
    }
}

/* ===========================================
   PREVENT HORIZONTAL SCROLL
   =========================================== */

@media (max-width: 991px) {
    
    /* Critical overflow fixes */
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .product-details,
    .product-details .container,
    .product-details-top-area,
    .product-details-top-area .row {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    
    /* Ensure all columns stay within bounds */
    .col-lg-6,
    .col-md-6,
    .col-sm-12 {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    /* All images must respect container width */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* ===========================================
   STICKY FOOTER/MENU FIX
   =========================================== */

@media (max-width: 991px) {
    
    /* Ensure page doesn't cause horizontal scroll */
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Fix sticky elements positioning */
    .sticky-footer,
    .sticky-menu,
    .navbar-area,
    .main-nav,
    .main-responsive-nav {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Ensure WhatsApp button doesn't cause scroll */
    .float {
        right: 10px !important;
        z-index: 999 !important;
    }
    
    /* Social media icons positioning */
    .a2a_kit {
        left: 5px !important;
        z-index: 998 !important;
    }
}

/* ===========================================
   IMAGE LOADING STATE
   =========================================== */

.product-info-image-area img,
.product-info-image-are img {
    background: #f0f0f0;
    transition: opacity 0.3s ease;
}

.product-info-image-area img[src=""],
.product-info-image-are img[src=""] {
    opacity: 0.5;
}

/* ===========================================
   THUMBNAIL SCROLLBAR STYLING
   =========================================== */

.product-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #03045e;
    border-radius: 10px;
}

.product-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #023e8a;
}

/* ===========================================
   ZOOM EFFECT (Optional Enhancement)
   =========================================== */

.product-info-image-area:hover #mainProductImage,
.product-info-image-are:hover #mainProductImage {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    .product-thumbnails,
    .product-action-buttons,
    .product-details-social-icons {
        display: none !important;
    }
    
    #mainProductImage {
        max-height: none !important;
        page-break-inside: avoid;
    }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

.thumbnail-img:focus {
    outline: 3px solid #0077b6;
    outline-offset: 2px;
}

#mainProductImage:focus {
    outline: 2px solid #0077b6;
    outline-offset: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .thumbnail-img {
        border-width: 3px !important;
    }
    
    .thumbnail-img:hover,
    .thumbnail-img.active {
        border-color: #000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .thumbnail-img,
    #mainProductImage,
    .product-info-image-area img,
    .product-info-image-are img {
        transition: none !important;
        transform: none !important;
    }
}
