/* Magnolia Custom Modals Styles */

.magnolia-modal {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 10001; /* Higher than quick-exit modal */
    justify-content: center;
    align-items: center;
}

.magnolia-modal.is-active {
    display: flex;
}

.magnolia-modal__overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    z-index: 40;
}

.magnolia-modal__overlay--persistent {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    opacity: 0;
    transition: opacity 150ms ease-in-out;
}

.magnolia-modal__overlay--persistent.is-active {
    opacity: 1;
}

.magnolia-modal__wrap {
    position: relative;
    z-index: 100;
    opacity: 0;
    transition: opacity 150ms ease-in-out;
    max-width: 90%;
    max-height: 90vh;
}

.magnolia-modal.is-active .magnolia-modal__wrap {
    opacity: 1;
}

.magnolia-modal__container {
    background-color: white;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    max-height: 90vh;
    margin: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.magnolia-modal__content {
    padding: 3.5rem;
}

.magnolia-modal__content > *:first-child {
    margin-top: 0;
}

.magnolia-modal__content > *:last-child {
    margin-bottom: 0;
}

.magnolia-modal__content img {
    max-width: 100%;
    height: auto;
}

.magnolia-modal__close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: #333;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.5rem;
    z-index: 10;
    transition: color 0.2s ease;
}

.magnolia-modal__close-btn:hover {
    color: #000;
}

.magnolia-modal__close-btn::before {
    content: "×";
    display: block;
}

@media (max-width: 768px) {
    .magnolia-modal__container {
        max-width: 95%;
        margin: 1rem auto;
    }

    .magnolia-modal__content {
        padding: 2rem;
    }

    .magnolia-modal__close-btn {
        top: 10px;
        right: 10px;
    }
}

/* Ensure the modal content respects WordPress block editor styles */
.magnolia-modal__content .wp-block-image {
    margin-bottom: 1em;
}

.magnolia-modal__content .wp-block-heading {
    margin-top: 0;
}
