/**
 * Image Popup Styles
 * Responsive popup with dark overlay and close button
 */

/* Overlay - Dark background */
.qtp-image-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

/* Show overlay when active */
.qtp-image-popup-overlay.qtp-popup-show {
    opacity: 1;
    visibility: visible;
}

/* Popup container */
.qtp-image-popup-container {
    position: relative;
    max-width: 45%;
    max-height: 45%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

/* Scale up container when popup is shown */
.qtp-image-popup-overlay.qtp-popup-show .qtp-image-popup-container {
    transform: scale(1);
}

/* Picture element wrapper */
.qtp-image-popup-picture {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Image styling */
.qtp-image-popup-image {
    display: block;
    max-width: 100%;
    max-height: 40vh;
    height: auto;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Link wrapper - no extra styling needed, just ensures clickability */
.qtp-image-popup-link {
    display: block;
    cursor: pointer;
    text-decoration: none;
}

/* Close button */
.qtp-image-popup-close {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.qtp-image-popup-close:hover {
    background-color: #f0f0f0;
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.qtp-image-popup-close:active {
    transform: translateX(-50%) scale(0.95);
}

.qtp-image-popup-close svg {
    width: 24px;
    height: 24px;
}

/* Prevent body scroll when popup is open */
body.qtp-popup-open {
    overflow: hidden;
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
    .qtp-image-popup-overlay {
        padding: 15px;
    }

    .qtp-image-popup-container {
        max-width: 70%;
        max-height: 70%;
    }

    .qtp-image-popup-image {
        max-height: 35vh;
        border-radius: 6px;
    }

    .qtp-image-popup-close {
        bottom: -55px;
        width: 40px;
        height: 40px;
    }

    .qtp-image-popup-close svg {
        width: 20px;
        height: 20px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .qtp-image-popup-overlay {
        padding: 10px;
    }

    .qtp-image-popup-image {
        max-height: 30vh;
        border-radius: 4px;
    }

    .qtp-image-popup-close {
        bottom: -50px;
        width: 36px;
        height: 36px;
    }

    .qtp-image-popup-close svg {
        width: 18px;
        height: 18px;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .qtp-image-popup-image {
        max-height: 40vh;
    }

    .qtp-image-popup-close {
        bottom: -45px;
    }
}

/* Accessibility - Focus styles */
.qtp-image-popup-close:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.qtp-image-popup-close:focus:not(:focus-visible) {
    outline: none;
}

.qtp-image-popup-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Animation for close button appearance */
@keyframes qtp-close-button-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.qtp-image-popup-overlay.qtp-popup-show .qtp-image-popup-close {
    animation: qtp-close-button-appear 0.3s ease 0.2s backwards;
}
