/**
 * Retailer Popup Styles
 *
 * Responsive modal popup styles with overlay, centered positioning,
 * and mobile-friendly design.
 *
 * @category  Mondor
 * @package   Mondor_RetailerPopup
 */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    --retailer-popup-overlay-bg: rgba(0, 0, 0, 0.75);
    --retailer-popup-close-size: 44px;
    --retailer-popup-close-bg: #ffffff;
    --retailer-popup-close-color: #333333;
    --retailer-popup-close-hover-bg: #f0f0f0;
    --retailer-popup-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --retailer-popup-border-radius: 8px;
    --retailer-popup-z-index: 9999999;
    --retailer-popup-animation-duration: 0.3s;
}

/* ============================================
   Body State - Prevent Scrolling
   ============================================ */
body.retailer-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   Overlay Container
   ============================================ */
.retailer-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--retailer-popup-z-index);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--retailer-popup-animation-duration) ease,
                visibility var(--retailer-popup-animation-duration) ease;
}

.retailer-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Background Backdrop
   ============================================ */
.retailer-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--retailer-popup-overlay-bg);
    cursor: pointer;
}

/* ============================================
   Popup Container
   ============================================ */
.retailer-popup-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: transparent;
    border-radius: var(--retailer-popup-border-radius);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform var(--retailer-popup-animation-duration) ease;
    z-index: 1;
}

.retailer-popup-overlay.active .retailer-popup-container {
    transform: scale(1);
}

/* ============================================
   Close Button
   ============================================ */
.retailer-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: var(--retailer-popup-close-size);
    height: var(--retailer-popup-close-size);
    min-width: var(--retailer-popup-close-size);
    min-height: var(--retailer-popup-close-size);
    background-color: var(--retailer-popup-close-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    color: var(--retailer-popup-close-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10;
    padding: 0;
}

.retailer-popup-close:hover,
.retailer-popup-close:focus {
    background-color: var(--retailer-popup-close-hover-bg);
    transform: scale(1.1);
    outline: none;
}

.retailer-popup-close:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

.retailer-popup-close span {
    display: block;
    margin-top: -2px;
}

/* ============================================
   Popup Link (Clickable Area)
   ============================================ */
.retailer-popup-link {
    display: block;
    cursor: pointer;
    text-decoration: none;
    line-height: 0;
    border-radius: var(--retailer-popup-border-radius);
    overflow: hidden;
    box-shadow: var(--retailer-popup-shadow);
}

.retailer-popup-link:focus {
    outline: 3px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* ============================================
   Popup Image
   ============================================ */
.retailer-popup-image {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--retailer-popup-border-radius);
}

/* ============================================
   Accessibility - Visually Hidden
   ============================================ */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================
   Tablet Styles (max-width: 1024px)
   ============================================ */
@media screen and (max-width: 1024px) {
    .retailer-popup-overlay {
        padding: 15px;
    }

    .retailer-popup-container {
        max-width: 95vw;
        max-height: 90vh;
    }

    .retailer-popup-image {
        max-height: 80vh;
    }

    .retailer-popup-close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 24px;
    }
}

/* ============================================
   Mobile Styles (max-width: 768px)
   ============================================ */
@media screen and (max-width: 768px) {
    .retailer-popup-overlay {
        padding: 10px;
    }

    .retailer-popup-container {
        max-width: 98vw;
        max-height: 92vh;
    }

    .retailer-popup-image {
        max-height: 75vh;
        border-radius: 6px;
    }

    .retailer-popup-close {
        top: 5px;
        right: 5px;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 22px;
    }

    .retailer-popup-link {
        border-radius: 6px;
    }
}

/* ============================================
   Small Mobile Styles (max-width: 480px)
   ============================================ */
@media screen and (max-width: 480px) {
    :root {
        --retailer-popup-border-radius: 4px;
    }

    .retailer-popup-overlay {
        padding: 8px;
    }

    .retailer-popup-container {
        max-width: 100%;
        max-height: 95vh;
    }

    .retailer-popup-image {
        max-height: 70vh;
    }

    .retailer-popup-close {
        top: 3px;
        right: 3px;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 20px;
    }
}

/* ============================================
   Landscape Mobile Orientation
   ============================================ */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .retailer-popup-overlay {
        padding: 10px;
    }

    .retailer-popup-image {
        max-height: 85vh;
        max-width: 80vw;
    }

    .retailer-popup-close {
        top: 5px;
        right: 5px;
    }
}

/* ============================================
   High DPI / Retina Support
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .retailer-popup-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   Reduced Motion Preference
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .retailer-popup-overlay,
    .retailer-popup-container,
    .retailer-popup-close {
        transition: none;
    }
}

/* ============================================
   Print Styles - Hide Popup
   ============================================ */
@media print {
    .retailer-popup-overlay {
        display: none !important;
    }
}
