﻿/* Modal container */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent backdrop */
    z-index: 1000;
    overflow: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    display: flex; /* Center modal content */
    justify-content: center;
    align-items: center;
    visibility: visible; /* Visible by default */
    opacity: 1;
    transition: opacity 0.2s;
}

/* Class to hide modal */
.modal-hidden {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.2s, opacity 0.2s;
}

/* Modal content */
.modal-content {
    background-color: #fff;
    box-sizing: border-box;
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

    /* Iframe styling */
    .modal-content iframe {
        width: 100%;
        height: 100%;
        border: none;
        box-sizing: border-box;
        display: block; /* Ensure iframe fills container */
    }

/* Close button */
.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    text-align: center;
    cursor: pointer;
    z-index: 1001;
    padding: 10px;
    line-height: 1;
}

/* Mobile-specific styles */
@media (max-width: 767px) {
    .modal {
        box-shadow: 0px 0px 0px 100px white;
    }

    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        /* Fallback for safe-area-inset-* */
        padding-top: constant(safe-area-inset-top, 20px); /* Older WebKit */
        padding-top: env(safe-area-inset-top, 20px); /* Modern browsers */
        padding-bottom: constant(safe-area-inset-bottom, 20px);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

        .modal-content iframe {
            height: 100vh; /* Full viewport height */
            min-height: 100vh;
        }
}

/* Non-mobile styles */
@media (min-width: 768px) {
    .modal-content {
        width: 50vw; /* Shrink to 50% of viewport width */
        max-width: 500px; /* Cap at 500px */
        height: 85vh; /* Shrink to 85% of viewport height */
        max-height: 900px; /* Cap at 900px */
        border-radius: 8px; /* Rounded corners */
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Shadow for depth */
    }

        .modal-content iframe {
            height: 100%; /* Fit iframe to modal content */
        }
}
