/* Magic Login — OTP login page */

/* Design tokens */
:root {
    --nomon-bg-page: #ffffff;
    --nomon-bg-card: #ffffff;
    --nomon-bg-input-idle: #fbfbfb;
    --nomon-bg-input-active: #ffffff;
    --nomon-ink: #1a1a1a;
    --nomon-ink-muted: #6b6b6b;
    --nomon-ink-subtle: #3a3a3a;
    --nomon-rule-input: #cccccc;
    --nomon-rule-card: #f1f1f1;
    --nomon-accent: #2271b1;
    --nomon-wp-logo: #0075a7;
    --nomon-error: #b3261e;
    --nomon-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* Spinner animation */
@keyframes nomon-spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   Full-page layout (wp-login.php takeover)
   ================================================ */
.nomon-login-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--nomon-bg-page);
    display: grid;
    grid-template-rows: auto 1fr auto;
    font-family: var(--nomon-font);
    color: var(--nomon-ink);
    padding: 56px 56px 32px;
    box-sizing: border-box;
}

.nomon-login-page *,
.nomon-login-page *::before,
.nomon-login-page *::after {
    box-sizing: border-box;
}

/* Header — WP logo */
.nomon-login-header {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 32px;
}

.nomon-login-header img {
    width: 72px;
    height: 72px;
    display: block;
}

/* Main — card area */
.nomon-login-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Footer — Nomon logo */
.nomon-login-footer {
    display: flex;
    justify-content: center;
}

.nomon-login-footer img {
    height: 16px;
    width: auto;
    display: block;
    opacity: 0.4;
}

/* ================================================
   The card
   ================================================ */
.nomon-login-card {
    width: 560px;
    max-width: 100%;
    background: var(--nomon-bg-card);
    border: 1px solid var(--nomon-rule-card);
    border-radius: 4px;
    padding: 64px 64px 56px;
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.02),
        0 36px 80px -28px rgba(20, 20, 30, 0.10),
        0 12px 24px -16px rgba(20, 20, 30, 0.06);
}

/* ================================================
   Typography
   ================================================ */
.nomon-login-eyebrow {
    font-family: var(--nomon-font);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.28em;
    color: var(--nomon-ink-muted);
    text-transform: uppercase;
    margin-bottom: 22px;
    text-align: center;
}

.nomon-login-eyebrow--success {
    color: var(--nomon-accent);
}

.nomon-login-headline {
    font-family: var(--nomon-font);
    font-size: 52px;
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    text-align: center;
}

.nomon-login-description {
    font-family: var(--nomon-font);
    font-size: 17px;
    line-height: 1.55;
    color: var(--nomon-ink-subtle);
    max-width: 380px;
    margin: 0 auto 36px;
    text-align: center;
}

.nomon-login-description--otp {
    max-width: 420px;
    margin-bottom: 32px;
}

.nomon-login-description strong {
    color: var(--nomon-ink);
    font-weight: 500;
    font-style: normal;
}

/* ================================================
   Form
   ================================================ */
.nomon-login-form {
    max-width: 360px;
    margin: 0 auto;
}

/* Email input */
.nomon-login-input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--nomon-font);
    font-size: 16px;
    color: var(--nomon-ink);
    background: var(--nomon-bg-input-idle);
    border: 1px solid var(--nomon-rule-input);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nomon-login-input:focus {
    border-color: var(--nomon-accent);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.13);
    background: var(--nomon-bg-input-active);
}

.nomon-login-input--error {
    border-color: var(--nomon-error);
}

.nomon-login-input--error:focus {
    border-color: var(--nomon-error);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.13);
}

/* OTP input */
.nomon-login-input--otp {
    padding: 16px 14px;
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-align: center;
    text-transform: uppercase;
}

/* Error text */
.nomon-login-error {
    font-family: var(--nomon-font);
    font-size: 12px;
    color: var(--nomon-error);
    margin-top: 8px;
    text-align: center;
}

/* hCaptcha widget */
.nomon-login-hcaptcha {
    margin-top: 20px;
}

.nomon-login-hcaptcha .h-captcha {
    display: flex;
    justify-content: center;
}

/* ================================================
   Buttons
   ================================================ */
.nomon-login-btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--nomon-ink);
    color: #ffffff;
    border: none;
    border-radius: 0;
    font-family: var(--nomon-font);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.18s ease;
    margin-top: 20px;
}

.nomon-login-btn-primary:hover {
    background: var(--nomon-accent);
}

.nomon-login-btn-primary:disabled {
    background: #d8d8d8;
    cursor: not-allowed;
}

.nomon-login-btn-primary:disabled:hover {
    background: #d8d8d8;
}

.nomon-login-btn-ghost {
    padding: 13px 22px;
    background: transparent;
    color: var(--nomon-ink);
    border: 1px solid #d8d8d8;
    border-radius: 0;
    font-family: var(--nomon-font);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.18s ease;
}

.nomon-login-btn-ghost:hover {
    border-color: var(--nomon-ink);
}

/* OTP action row */
.nomon-login-actions {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Resend row */
.nomon-login-resend {
    margin-top: 24px;
    font-family: var(--nomon-font);
    font-size: 13px;
    color: var(--nomon-ink-muted);
    text-align: center;
}

.nomon-login-resend button {
    background: none;
    border: none;
    padding: 0;
    color: var(--nomon-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-family: var(--nomon-font);
    font-size: 13px;
}

/* Privacy footer */
.nomon-login-privacy {
    margin-top: 28px;
    font-family: var(--nomon-font);
    font-size: 12px;
    color: var(--nomon-ink-muted);
    text-align: center;
    line-height: 1.6;
}

.nomon-login-privacy a {
    color: var(--nomon-ink);
    text-underline-offset: 3px;
}

/* Spinner */
.nomon-login-spinner {
    width: 14px;
    height: 14px;
    animation: nomon-spin 0.8s linear infinite;
}

/* Honeypot */
.nomon-login-confirm {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* Success step */
.nomon-login-success {
    text-align: center;
}

/* ================================================
   WooCommerce My Account — native styling
   ================================================ */

/* Hide WooCommerce original form elements when OTP is active */
.woocommerce-form-login > .woocommerce-form-row,
.woocommerce-form-login > p.form-row:not(.nomon-wc-actions),
.woocommerce-form-login > .woocommerce-form-login__rememberme,
.woocommerce-form-login > .lost_password {
    display: none !important;
}

.nomon-wc-magic-login .nomon-wc-description {
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.nomon-wc-magic-login .nomon-wc-otp-input {
    font-family: monospace;
    font-size: 20px;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
}

.nomon-wc-magic-login .nomon-wc-error {
    color: #b3261e;
    font-size: 13px;
    margin-top: 8px;
}

.nomon-wc-magic-login .nomon-wc-hcaptcha {
    margin: 12px 0;
}

.nomon-wc-magic-login .nomon-wc-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nomon-wc-magic-login .nomon-wc-back {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.nomon-wc-magic-login .nomon-wc-back:hover {
    color: #333;
    text-decoration: underline;
}

.nomon-wc-magic-login .nomon-wc-resend {
    font-size: 13px;
    color: #666;
    margin-top: 12px;
}

.nomon-wc-magic-login .nomon-wc-resend button {
    background: none;
    border: none;
    padding: 0;
    color: #333;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
}

/* Hide wp-login.php original elements (when using full page takeover) */
#login,
#loginform,
#nav,
#backtoblog,
.privacy-policy-page-link,
.language-switcher {
    display: none !important;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 640px) {
    .nomon-login-page {
        padding: 24px 16px 20px;
        min-height: 100vh;
        min-height: 100dvh;
        grid-template-rows: auto 1fr auto;
    }

    .nomon-login-header {
        padding-bottom: 20px;
    }

    .nomon-login-header img {
        width: 48px;
        height: 48px;
    }

    .nomon-login-main {
        padding-top: 0;
    }

    .nomon-login-card {
        width: 100%;
        padding: 32px 20px 28px;
        box-shadow: none;
        border: none;
    }

    .nomon-login-eyebrow {
        margin-bottom: 14px;
    }

    .nomon-login-headline {
        font-size: 32px;
        margin-bottom: 12px;
    }

    .nomon-login-description {
        font-size: 15px;
        margin-bottom: 24px;
    }

    .nomon-login-form {
        max-width: 100%;
    }

    .nomon-login-input--otp {
        font-size: 22px;
        padding: 14px 10px;
    }

    .nomon-login-actions {
        margin-top: 24px;
    }

    .nomon-login-btn-primary {
        padding: 12px 20px;
    }

    .nomon-login-btn-ghost {
        padding: 11px 16px;
    }

    .nomon-login-privacy {
        margin-top: 20px;
    }
}

@media (max-width: 380px) {
    .nomon-login-headline {
        font-size: 26px;
    }

    .nomon-login-input--otp {
        font-size: 18px;
        letter-spacing: 0.12em;
    }

    .nomon-login-actions {
        flex-direction: column;
        gap: 8px;
    }

    .nomon-login-actions .nomon-login-btn-ghost,
    .nomon-login-actions .nomon-login-btn-primary {
        width: 100%;
    }
}
