/* CSS Custom Properties for Demo Modals */
:root {
    --demo-modal-overlay: rgba(15, 23, 42, 0.9);
    --demo-modal-spinner: #f8fafc;
    --demo-modal-zindex: 9999;
    --demo-modal-radius: 12px;
}

/* Prevent background scrolling when modal is active */
body.demo-modal-open {
    overflow: hidden;
}

/* Base overlay styling */
.demo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--demo-modal-overlay);
    z-index: var(--demo-modal-zindex);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.demo-modal-overlay.active {
    opacity: 1;
}

/* Modal Content Container */
.demo-modal-container {
    position: relative;
    width: 90vw;
    height: 90vh;
    background-color: #ffffff;
    border-radius: var(--demo-modal-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.demo-modal-overlay.active .demo-modal-container {
    transform: scale(1);
}

/* Close Button */
.demo-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    background-color: #dc2626; /* Prominent bright red */
    color: #ffffff;
    border: 2px solid #ffffff; /* Contrast border to pop against iframe content */
    border-radius: 50%;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s, transform 0.1s;
}

.demo-modal-close:hover {
    background-color: #b91c1c; /* Darker red on hover */
    transform: scale(1.05);
}

.demo-modal-close:active {
    transform: scale(0.95);
}

/* Iframe Styling */
.demo-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    background-color: #ffffff;
}

.demo-modal-iframe.loaded {
    opacity: 1;
}

/* Loading Spinner */
.demo-modal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(41, 98, 255, 0.2);
    border-top-color: var(--brand-primary, #2962FF);
    border-radius: 50%;
    animation: demo-modal-spin 1s linear infinite;
    z-index: 5;
}

@keyframes demo-modal-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .demo-modal-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .demo-modal-close {
        top: 15px;
        right: 15px;
        width: 46px; /* Consistent large touch target for mobile */
        height: 46px;
    }
}
