/**
 * PraxisIQ Registration Modal.
 *
 * Overlay + centered dialog that wraps the plugin's [praxisiq_beitritt]
 * shortcode. Uses the theme's CSS variables so it auto-inherits brand
 * colors. Opens via [data-praxisiq-open-registration] triggers, closes
 * via [data-praxisiq-close-registration] + ESC key (handled in JS).
 */

/* ── Trigger styles ────────────────────────────────────────────── */

.praxisiq-register-trigger--nav {
    margin-left: 0.75rem;
    white-space: nowrap;
}

/* Floating Action Button (mobile / marketing pages) */
.praxisiq-register-fab {
    position: fixed;
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 950;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.4rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--secondary, #0891B2), var(--accent, #0D9488));
    color: #fff;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(8, 145, 178, 0.45), 0 6px 10px -6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.praxisiq-register-fab:hover,
.praxisiq-register-fab:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 30px -6px rgba(8, 145, 178, 0.55);
    outline: none;
}
.praxisiq-register-fab:focus-visible {
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.35), 0 10px 25px -5px rgba(8, 145, 178, 0.45);
}
.praxisiq-register-fab__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.praxisiq-register-fab__label {
    display: inline-block;
}
@media (max-width: 520px) {
    /* Shrink to icon-only on narrow screens */
    .praxisiq-register-fab {
        padding: 0.9rem;
        border-radius: 50%;
    }
    .praxisiq-register-fab__label {
        display: none;
    }
}

/* Hide the floating button while the modal is open — it's distracting
   and can sit on top of the close button on some layouts. */
body.praxisiq-modal-open .praxisiq-register-fab {
    display: none;
}

/* ── Modal shell ───────────────────────────────────────────────── */

.praxisiq-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.praxisiq-modal.is-open {
    display: flex;
}

.praxisiq-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: praxisiq-modal-fade 0.2s ease-out;
}

.praxisiq-modal__dialog {
    position: relative;
    width: min(860px, 100%);
    margin: 2rem auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: praxisiq-modal-pop 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.praxisiq-modal__body {
    padding: 2.5rem 2rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
}

/* Tighter padding on mobile and make the dialog edge-to-edge */
@media (max-width: 640px) {
    .praxisiq-modal {
        padding: 0;
    }
    .praxisiq-modal__dialog {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        min-height: 100vh;
        width: 100%;
    }
    .praxisiq-modal__body {
        padding: 3.5rem 1.25rem 2rem;
    }
}

/* ── Close button ──────────────────────────────────────────────── */

.praxisiq-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100, #F1F5F9);
    color: var(--gray-700, #334155);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.praxisiq-modal__close:hover {
    background: var(--gray-200, #E2E8F0);
    color: var(--primary, #0C4A6E);
}
.praxisiq-modal__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.35);
}

/* ── Lock body scroll when modal is open ─────────────────────────*/

body.praxisiq-modal-open {
    overflow: hidden;
    /* Reserve scrollbar gap so layout doesn't jump */
    scrollbar-gutter: stable;
}

/* ── Animations ────────────────────────────────────────────────── */

@keyframes praxisiq-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes praxisiq-modal-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .praxisiq-modal__backdrop,
    .praxisiq-modal__dialog {
        animation: none;
    }
}

/* ── Form width override inside the modal ─────────────────────── */
/* The plugin's .pm-form-wrapper caps at 820px; inside a 860px modal
   that's perfect, but we kill its centering margin so the form uses
   the full modal width (the dialog itself is already centered). */
.praxisiq-modal .pm-form-wrapper {
    max-width: none;
    margin: 0;
}

/* Smaller tier cards inside the modal so they don't push the form
   horizontally on tablets. */
@media (max-width: 900px) {
    .praxisiq-modal .pm-radio-group {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 520px) {
    .praxisiq-modal .pm-radio-group {
        grid-template-columns: 1fr;
    }
}
