/**
 * LMX SSO Logins - Magic Link Modal Styles
 *
 * Loaded asynchronously (non-render-blocking) since the modal
 * is only visible after user interaction.
 *
 * @package LMX_SSO_Logins
 * @since   2.2.0
 */

/* -- Overlay -------------------------------------------------------------- */

.lmx-magic-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.lmx-magic-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* -- Dialog card ---------------------------------------------------------- */

.lmx-magic-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    text-align: center;
    animation: lmx-modal-in 0.25s ease-out;
}

@keyframes lmx-modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* -- Close button --------------------------------------------------------- */

.lmx-magic-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.15s, color 0.15s;
    line-height: 1;
    padding: 0;
}

.lmx-magic-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* -- Dialog content ------------------------------------------------------- */

.lmx-magic-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lmx-magic-dialog-icon svg {
    width: 28px;
    height: 28px;
    stroke: #374151;
}

.lmx-magic-dialog-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
    line-height: 1.3;
}

.lmx-magic-dialog-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* -- Waiting spinner (code step) ------------------------------------------ */

.lmx-magic-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 20px;
}

.lmx-magic-waiting-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-top-color: #374151;
    border-radius: 50%;
    animation: lmx-spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* -- Email input ---------------------------------------------------------- */

.lmx-magic-email {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 12px;
}

.lmx-magic-email:focus {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.1);
}

/* -- Submit button -------------------------------------------------------- */

.lmx-magic-submit {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    position: relative;
}

.lmx-magic-submit:active {
    transform: scale(0.98);
}

/* -- Loading state -------------------------------------------------------- */

.lmx-magic-submit.lmx-magic-loading {
    color: transparent;
    pointer-events: none;
}

.lmx-magic-submit.lmx-magic-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lmx-spin 0.6s linear infinite;
}

@keyframes lmx-spin {
    to {
        transform: rotate(360deg);
    }
}

/* -- Sent-to row ---------------------------------------------------------- */

.lmx-magic-sent-to-row {
    margin: 0 0 20px;
    font-size: 14px;
    color: #374151;
}

.lmx-magic-sent-to {
    font-weight: 600;
    color: #111827;
}

.lmx-magic-edit-email {
    font-size: 13px;
    color: inherit;
    text-decoration: underline;
    margin-left: 6px;
}

.lmx-magic-edit-email:hover {
    opacity: 0.7;
}

/* -- OTP digit inputs ----------------------------------------------------- */

.lmx-magic-digits {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.lmx-magic-digit {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    padding: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    box-sizing: border-box;
    background: #fff;
}

.lmx-magic-digit:focus {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.1);
}

.lmx-magic-digit-dash {
    font-size: 20px;
    color: #9ca3af;
    margin: 0 2px;
    user-select: none;
}

/* -- Code meta (countdown + resend) --------------------------------------- */

.lmx-magic-code-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 4px;
}

.lmx-magic-countdown {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.lmx-magic-meta-sep {
    color: #d1d5db;
}

.lmx-magic-resend {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.lmx-magic-resend:hover {
    opacity: 0.7;
}

.lmx-magic-resend-disabled {
    color: #9ca3af;
    pointer-events: none;
    text-decoration: none;
}

/* -- Success state -------------------------------------------------------- */

.lmx-magic-success {
    color: #059669;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    padding: 24px 0;
}

/* -- Error display -------------------------------------------------------- */

.lmx-magic-error {
    background-color: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 480px) {
    .lmx-magic-dialog {
        padding: 32px 20px 24px;
        border-radius: 12px;
    }

    .lmx-magic-digit {
        width: 38px;
        height: 46px;
        font-size: 18px;
    }

    .lmx-magic-digits {
        gap: 4px;
    }

    .lmx-magic-digit-dash {
        margin: 0;
    }
}