/* ========================================
   Product Zoom Popup - Full Width Display
   Applies to Magnific Popup image zoom overlay
   Strategy: Override inline max-height, use full viewport width, prevent upscaling
   Fix: Force WIDTH priority over HEIGHT, no upscaling beyond original resolution
   ======================================== */

/* Prevent horizontal overflow at root level */
.mfp-wrap {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Magnific Popup Container - Full viewport width */
.mfp-container {
    max-width: 100vw !important;
    padding: 0 !important;
}

.mfp-content {
    max-width: 100vw !important;
    padding: 0 !important;
}

/* Magnific Popup Image Container - Full width with small margin */
.mfp-figure {
    max-width: 98vw !important;
    margin: 0 auto !important;
}

/* Ensure figure element respects container */
.mfp-figure figure {
    max-width: 100% !important;
    margin: 0 auto !important;
}

/* Magnific Popup Image - CRITICAL FIX */
.mfp-img {
    /* CRITICAL: Override inline max-height from JavaScript */
    max-height: none !important;

    /* Full width display, no upscaling */
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;

    /* Display and positioning */
    display: block !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center top !important;
}

/* Image wrapper */
.mfp-img-container {
    max-width: 98vw !important;
    padding: 0 !important;
}

/* Move title and counter to top - CRITICAL VISIBILITY FIX */
.mfp-bottom-bar {
    /* Force visibility */
    display: block !important;
    visibility: visible !important;

    /* Fixed positioning at top-center with safe distance from edge */
    position: fixed !important;
    top: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: auto !important;

    /* Visual styling */
    /*background: rgba(0, 0, 0, 0.85) !important;*/
    padding: 10px 20px !important;
    border-radius: 4px !important;

    /* Z-index ABOVE all other elements including close button */
    z-index: 1050 !important;

    /* Width constraints */
    max-width: calc(100vw - 160px) !important;
    min-height: 30px !important;

    /* Layout control */
    white-space: nowrap !important;
    pointer-events: none !important;

    /* Prevent any clipping */
    overflow: visible !important;
    clip-path: none !important;
}

.mfp-title {
    display: inline-block !important;
    visibility: visible !important;
    color: #ffffff !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin: 0 12px 0 0 !important;
    vertical-align: middle !important;
}

.mfp-counter {
    display: inline-block !important;
    visibility: visible !important;
    color: #ffffff !important;
    font-size: 12px !important;
    opacity: 0.9 !important;
    vertical-align: middle !important;
}

/* Close button - ensure visibility */
.mfp-close {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    position: fixed !important;
    top: 10px !important;
    right: 20px !important;
    z-index: 1049 !important;
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.5) !important;
    width: 44px !important;
    height: 44px !important;
    /*border-radius: 50% !important;*/
    opacity: 0.9 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    font-size: 28px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.mfp-close:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Navigation arrows - ensure visibility */
.mfp-arrow {
    display: block !important;
    visibility: visible !important;
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 1048 !important;
    opacity: 0.8 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.mfp-arrow-left {
    left: 20px !important;
}

.mfp-arrow-right {
    right: 20px !important;
}

.mfp-arrow:hover {
    opacity: 1 !important;
}

/* Responsive - maintain full width */
@media (max-width: 768px) {
    .mfp-bottom-bar {
        top: 50px !important;
        padding: 8px 16px !important;
        max-width: calc(100vw - 120px) !important;
    }

    .mfp-title {
        font-size: 13px !important;
        margin-right: 10px !important;
    }

    .mfp-counter {
        font-size: 11px !important;
    }

    .mfp-close {
        top: 5px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
    }

    .mfp-arrow-left {
        left: 10px !important;
    }

    .mfp-arrow-right {
        right: 10px !important;
    }
}

@media (max-width: 480px) {
    .mfp-img {
        max-width: 96vw !important;
    }

    .mfp-figure {
        max-width: 96vw !important;
    }

    .mfp-img-container {
        max-width: 96vw !important;
    }

    .mfp-bottom-bar {
        top: 45px !important;
        padding: 6px 12px !important;
        max-width: calc(100vw - 90px) !important;
    }

    .mfp-title {
        font-size: 12px !important;
        margin-right: 8px !important;
        max-width: 200px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .mfp-counter {
        font-size: 11px !important;
    }

    .mfp-close {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
    }
}
