/* ------------------------------------------------------------------ *
 * Nedroma passwordless auth modal
 * Scoped under #nef-auth-modal so it survives Divi/theme styles.
 * ------------------------------------------------------------------ */
#nef-auth-modal, #nef-auth-modal * { box-sizing: border-box; }

.nef-modal[hidden] { display: none; }

.nef-modal {
    --nef-accent: #0f7a4d;      /* deep emerald: focus, active step, success */
    --nef-accent-weak: #0f7a4d26;
    --nef-ink: #14181f;
    --nef-muted: #667085;
    --nef-border: #e3e6ea;
    --nef-surface: #ffffff;
    --nef-error: #c0392b;
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* --- overlay --- */
.nef-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 22, .55);
    opacity: 0;
    transition: opacity .18s ease;
}
.nef-modal.is-open .nef-modal__overlay { opacity: 1; }

/* --- box --- */
.nef-modal__box {
    position: relative;
    width: min(94vw, 400px);
    background: var(--nef-surface);
    color: var(--nef-ink);
    border-radius: 14px;
    padding: 26px 26px 24px;
    box-shadow: 0 24px 60px -12px rgba(12, 16, 22, .45);
    opacity: 0;
    transform: translateY(10px) scale(.97);
    transition: opacity .2s ease, transform .22s cubic-bezier(.2, .7, .3, 1);
    font-family: inherit;
}
.nef-modal.is-open .nef-modal__box { opacity: 1; transform: none; }

.nef-modal__x {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: 0; background: transparent;
    font-size: 22px; line-height: 1; color: var(--nef-muted);
    border-radius: 8px; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.nef-modal__x:hover { background: #f2f4f6; color: var(--nef-ink); }

/* --- head --- */
.nef-modal__head { text-align: center; margin-bottom: 18px; }
.nef-modal__badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-bottom: 10px;
    font-size: 22px; border-radius: 50%;
    background: var(--nef-accent-weak);
}
.nef-modal__title {
    margin: 0; padding: 0;
    font-size: 1.28rem; font-weight: 700; letter-spacing: -.01em;
    color: var(--nef-ink); line-height: 1.2;
}

/* --- step dots --- */
.nef-steps { display: flex; gap: 7px; justify-content: center; margin-top: 12px; }
.nef-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--nef-border);
    transition: background .2s ease, transform .2s ease;
}
.nef-dot.is-active { background: var(--nef-accent); transform: scale(1.15); }

/* --- steps / content --- */
.nef-step[hidden] { display: none; }
.nef-lead { margin: 0 0 14px; font-size: .95rem; line-height: 1.45; color: var(--nef-muted); text-align: center; }

/* Scoped under #nef-auth-modal + !important to override Divi's aggressive input/button theming. */
#nef-auth-modal .nef-input {
    width: 100% !important;
    padding: 15px 16px !important;
    font-size: 1rem !important; line-height: 1.3 !important;
    font-family: inherit; color: var(--nef-ink) !important;
    background: #fff !important;
    border: 1px solid var(--nef-border) !important;
    border-radius: 10px !important;
    margin: 0 0 14px !important;
    height: auto !important;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#nef-auth-modal .nef-input::placeholder { color: #aab1bb; opacity: 1; }
#nef-auth-modal .nef-input:focus {
    outline: none !important;
    border-color: var(--nef-accent) !important;
    box-shadow: 0 0 0 3px var(--nef-accent-weak) !important;
}
#nef-auth-modal .nef-input--code {
    text-align: center;
    font-size: 1.6rem !important;
    letter-spacing: .5em;
    padding: 15px 16px !important;
    padding-left: .5em !important; /* offset letter-spacing so it looks centered */
    font-weight: 600;
}

#nef-auth-modal .nef-btn {
    position: relative;
    display: block !important; width: 100% !important; float: none !important;
    padding: 14px 16px !important;
    font-size: 1rem !important; font-weight: 600; font-family: inherit;
    line-height: 1.2 !important;
    color: #fff !important;
    background: var(--nef-ink) !important;
    border: 0 !important; border-radius: 9px !important;
    text-transform: none !important; letter-spacing: normal !important;
    cursor: pointer;
    transition: background .15s ease, transform .05s ease, opacity .15s ease;
}
#nef-auth-modal .nef-btn:hover { background: #000 !important; }
#nef-auth-modal .nef-btn:active { transform: translateY(1px); }
#nef-auth-modal .nef-btn:disabled { opacity: .65; cursor: default; }
#nef-auth-modal .nef-btn.is-loading { color: transparent !important; pointer-events: none; }
#nef-auth-modal .nef-btn.is-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, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nef-spin .6s linear infinite;
}

.nef-link {
    display: inline-block; margin: 12px auto 0; padding: 4px 6px;
    background: none; border: 0; cursor: pointer;
    color: var(--nef-muted); font-size: .88rem; font-family: inherit;
    text-decoration: underline; text-underline-offset: 2px;
}
.nef-link:hover { color: var(--nef-accent); }

.nef-error[hidden] { display: none; }
.nef-error {
    margin: 12px 0 0; font-size: .88rem; line-height: 1.4;
    color: var(--nef-error); text-align: center;
}
/* "Créer mon compte" link inside the unrecognised-email error. */
.nef-error a {
    display: inline-block;
    margin-top: 6px;
    color: var(--nef-accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.nef-error a:hover { color: var(--nef-ink); }

/* --- done / success --- */
.nef-step--done { text-align: center; padding: 8px 0 4px; }
.nef-check {
    width: 54px; height: 54px; margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--nef-accent-weak);
    position: relative;
}
.nef-check::after {
    content: "";
    position: absolute; left: 50%; top: 46%;
    width: 15px; height: 8px;
    border-left: 3px solid var(--nef-accent);
    border-bottom: 3px solid var(--nef-accent);
    transform: translate(-50%, -50%) rotate(-45deg);
    transform-origin: center;
    animation: nef-check .3s ease .05s both;
}
.nef-done-msg { margin: 0; font-size: 1.02rem; font-weight: 600; color: var(--nef-ink); }

/* --- keyframes --- */
@keyframes nef-spin { to { transform: rotate(360deg); } }
@keyframes nef-check {
    from { opacity: 0; transform: translate(-50%, -50%) rotate(-45deg) scale(.5); }
    to   { opacity: 1; transform: translate(-50%, -50%) rotate(-45deg) scale(1); }
}
@keyframes nef-shake {
    10%, 90% { transform: translateX(-1px); }
    30%, 70% { transform: translateX(2px); }
    50%      { transform: translateX(-3px); }
}
.nef-shake { animation: nef-shake .3s ease; }

@media (prefers-reduced-motion: reduce) {
    .nef-modal__overlay,
    .nef-modal__box { transition: none; }
    .nef-btn.is-loading::after,
    .nef-check::after,
    .nef-shake { animation: none; }
    .nef-modal__box { transform: none; }
}
