/**
 * Sitewide FormAssembly link → modal iframe styling.
 * See src/UI/FaModal.php and assets/js/fa-modal.js for the wiring.
 *
 * All rules use !important because native <dialog> is styled by
 * both the UA sheet and, on Elementor pages, kit-6 selectors
 * that can win on specificity for buttons/iframes inside our
 * dialog.
 */

/* Freeze the page under the modal so tall FA forms don't drag
   the underlying page scroll along with them on iOS. */
html.wsp-fa-modal-open,
html.wsp-fa-modal-open body {
    overflow: hidden !important;
}

.wsp-fa-modal {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    width: 760px !important;
    max-width: 92vw !important;
    height: 88vh !important;
    max-height: 900px !important;
    background: #ffffff !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35) !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
}

.wsp-fa-modal::backdrop {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(2px) !important;
}

.wsp-fa-modal__iframe {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    background: #ffffff !important;
}

/* ── Loader ────────────────────────────────────────────────────
   Simple overlay: solid white background hides the (empty) iframe
   beneath. Toggled via display so we sidestep opacity/transition
   quirks in some browser engines. */
.wsp-fa-modal__loader {
    position: absolute !important;
    inset: 0 !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
    background: #ffffff !important;
    color: #4a4a4a !important;
    font-family: inherit !important;
    font-size: 0.95rem !important;
    display: none !important;
    z-index: 5 !important;
}
.wsp-fa-modal--loading .wsp-fa-modal__loader {
    display: flex !important;
}
.wsp-fa-modal__loader-text {
    color: #4a4a4a !important;
    font-weight: 500 !important;
}
.wsp-fa-modal__spinner {
    width: 42px !important;
    height: 42px !important;
    border: 3px solid #e5e5e5 !important;
    border-top-color: #0a0a0a !important;
    border-radius: 50% !important;
    animation: wsp-fa-modal-spin 0.8s linear infinite !important;
}
@keyframes wsp-fa-modal-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .wsp-fa-modal__spinner { animation-duration: 2s !important; }
}

.wsp-fa-modal__close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 10 !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #111 !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    font-family: inherit !important;
    transition: background 0.15s, transform 0.1s !important;
}
.wsp-fa-modal__close:hover {
    background: #ffffff !important;
    transform: scale(1.05) !important;
}
.wsp-fa-modal__close:focus-visible {
    outline: 2px solid #0a0a0a !important;
    outline-offset: 2px !important;
}
.wsp-fa-modal__close svg {
    display: block !important;
}

/* Mobile — go fullscreen. Small screens don't have room for a
   comfortable rounded modal, and FA forms tend to be tall. */
@media (max-width: 640px) {
    .wsp-fa-modal {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    .wsp-fa-modal__close {
        top: 12px !important;
        right: 12px !important;
    }
}
