/* ========================================
   PRODUCT DETAILS PAGE - IMAGE OPTIMIZATION
   ======================================== */

/* ===== DESKTOP VIEW (768px and above) ===== */
@media (min-width: 768px) {
    /* Main product image container */
    .product-img-section-md {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Main image swiper */
    .mySwiper-preview.gallery-top-1 {
        height: 500px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #f8f8f8;
        border-radius: 8px;
        overflow: hidden;
    }

    /* Main image slides */
    .mySwiper-preview .swiper-slide,
    .mySwiper-preview .product-swiper-slide {
        height: 500px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff;
        padding: 10px;
    }

    /* Main product images */
    .mySwiper-preview .swiper-slide img,
    .mySwiper-preview .product-swiper-slide img {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
        border-radius: 4px;
    }

    /* Thumbnail container - restored to original */
    .image-Thumbnail-container {
        padding: 0;
        margin: 0;
    }

    /* Thumbnail swiper - restored to original design */
    .mySwiper-thumb.gallery-thumbs-1 {
        height: 400px;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 0;
    }

    /* Thumbnail slides - restored to original design */
    .mySwiper-thumb .swiper-slide,
    .mySwiper-thumb .product-swiper-slide {
        width: 100%;
        opacity: 0.7;
        padding: 5px;
        border: solid 1px var(--border-color);
        border-radius: 6px;
        background: var(--bs-white);
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    /* Thumbnail images - restored to original */
    .mySwiper-thumb .swiper-slide img,
    .mySwiper-thumb .product-swiper-slide img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }

    /* Active thumbnail - restored to original */
    .mySwiper-thumb .swiper-slide-thumb-active {
        opacity: 1;
    }

    /* Remove custom hover effects - back to original */
    .mySwiper-thumb .swiper-slide:hover {
        opacity: 1;
    }
}

/* ===== MOBILE VIEW (767px and below) ===== */
@media (max-width: 767px) {
    /* Remove container padding */
    .container.py-4 {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    /* Mobile swiper container */
    .mySwiper {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent;
    }

    /* Mobile swiper wrapper */
    .mySwiper .swiper-wrapper {
        height: auto !important;
        min-height: auto !important;
    }

    /* Mobile slides */
    .mySwiper .swiper-slide {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff;
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 5px;
    }

    /* Mobile product images */
    .mySwiper .swiper-slide img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        min-height: 250px !important;
        max-height: 400px !important;
        object-fit: contain !important;
        object-position: center !important;
        background: #ffffff;
        border-radius: 4px;
    }

    /* Center slide content */
    .mySwiper .center-swiper-slide {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
    }

    /* Mobile pagination */
    .mySwiper .swiper-pagination {
        position: relative !important;
        bottom: auto !important;
        margin-top: 15px !important;
        text-align: center;
    }

    /* Pagination bullets */
    .mySwiper .swiper-pagination-bullet {
        background: var(--primary-color, #007bff) !important;
        opacity: 0.3;
        margin: 0 4px;
    }

    .mySwiper .swiper-pagination-bullet-active {
        opacity: 1 !important;
        transform: scale(1.2);
    }
}

/* ===== UNIVERSAL FIXES ===== */
/* Remove any conflicting zoom styles */
.zoom_03 {
    cursor: zoom-in !important;
}

/* Ensure video elements fit properly */
.swiper-slide video {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* Fix for swiper navigation buttons */
.swiper-button-next,
.swiper-button-prev {
    color: var(--primary-color, #007bff) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 16px !important;
    font-weight: bold !important;
}

/* Responsive adjustments for larger screens */
@media (min-width: 1200px) {
    .mySwiper-preview.gallery-top-1 {
        height: 600px !important;
    }

    .mySwiper-preview .swiper-slide,
    .mySwiper-preview .product-swiper-slide {
        height: 600px !important;
    }

    .mySwiper-thumb.gallery-thumbs-1 {
        height: 600px;
        padding: 15px 0;
    }

    .mySwiper-thumb .swiper-slide,
    .mySwiper-thumb .product-swiper-slide {
        margin-bottom: 10px;
        padding: 8px;
    }
}

/* ===== ADDITIONAL FIXES ===== */
/* Fix for any remaining spacing issues */
.product-img-section-md .row {
    margin: 0 !important;
}

/* Add 5px gap between main image and thumbnail gallery on desktop */
@media (min-width: 768px) {
    .product-img-section-md .col-md-10 {
        padding: 0 !important;
        padding-right: 2.5px !important; /* Half of 5px gap */
    }

    .product-img-section-md .col-md-2 {
        padding: 0 !important;
        padding-left: 2.5px !important; /* Half of 5px gap */
    }
}

/* Ensure proper aspect ratios */
.swiper-slide {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Fix for image loading states */
.swiper-slide img[src=""],
.swiper-slide img:not([src]) {
    background: #f0f0f0;
    min-height: 200px;
}

/* Smooth transitions */
.swiper-slide img {
    transition: all 0.3s ease !important;
}

/* Fix for video elements in slides */
.swiper-slide video {
    border-radius: 4px !important;
    background: #000000;
}

/* Ensure zoom cursor shows properly */
.zoom_03:hover {
    cursor: zoom-in !important;
}

/* Fix for mobile landscape orientation */
@media (max-width: 767px) and (orientation: landscape) {
    .mySwiper .swiper-slide img {
        max-height: 300px !important;
    }
}

/* Fix for very small screens */
@media (max-width: 480px) {
    .mySwiper .swiper-slide img {
        min-height: 200px !important;
        max-height: 350px !important;
    }

    .mySwiper .center-swiper-slide {
        padding: 5px !important;
    }
}
