/* SWDA-3355 — MFA / 2FA pages styling. Reuses login.css palette and admin module cards.
   Selectors are intentionally prefixed (.mfa-* and .messagelist .warning.mfa-nudge)
   so that no existing admin or login styling is affected. */

.mfa-page #content {
    max-width: 720px;
    margin: 0 auto;
    padding: 30px 20px;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.mfa-page #content-main {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* All /accounts/* pages should share one stable frame regardless of content
   height (no vertical jump between reauthenticate/reset/2fa/email pages). */
body.allauth-page.djangocms-admin-style {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 0;
    box-sizing: border-box;
    background-color: #f2f6f9;
}

body.allauth-page.djangocms-admin-style #container {
    --loginWidth: 630px;
    top: 0 !important;
    width: var(--loginWidth) !important;
    min-width: var(--loginWidth) !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible;
}

body.allauth-page.djangocms-admin-style #container #header-logo {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 auto 30px !important;
    text-align: center;
}

body.allauth-page.djangocms-admin-style #container #header-logo .login__logo {
    width: 247px !important;
    display: inline-block;
    padding: 0 !important;
}

body.allauth-page.djangocms-admin-style #container #header #branding {
    padding: 0 65px 0 65px !important;
}

body.allauth-page.djangocms-admin-style #container #content {
    margin: 0 !important;
    padding: 12px 65px 30px 65px !important;
}

.mfa-page #content > h1,
.mfa-page__module > h1 {
    text-align: center;
    margin-bottom: 20px !important;
}

.mfa-page__module {
    background: #fff;
    border: 0;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 0 0 20px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.mfa-page__module + .mfa-page__module {
    margin-top: 20px;
}

.mfa-page__module h2 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1E222D;
    text-align: center;
}

.mfa-page__module > h1,
.mfa-page__module > p {
    text-align: center;
}

.mfa-page__panel-body {
    margin-bottom: 16px;
    text-align: center;
}

.mfa-page__panel-body p {
    text-align: center;
}

.mfa-page__panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.mfa-page__panel-actions > .sc-button,
.mfa-page__panel-actions > .sc-button-2,
.mfa-recovery-codes__actions > .sc-button,
.mfa-recovery-codes__actions > .sc-button-2 {
    width: auto !important;
    min-width: 180px;
    padding: 0 24px;
    text-decoration: none;
}

/* Manage screens include radio choices (account/email). Prevent login text-field
   styles from blowing up radio controls into large bordered boxes. */
.mfa-page #content-main .form-row input[type="radio"],
.mfa-page #content-main .form-row input[type="checkbox"] {
    width: auto !important;
    height: auto !important;
    margin: 0 8px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    accent-color: #7E3BC6;
    vertical-align: middle;
}

.mfa-page #content-main .form-row label {
    float: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* TOTP enrollment QR + secret */
.mfa-totp__qr {
    display: flex;
    justify-content: center;
    margin: 16px 0 24px 0;
}

.mfa-totp__qr img {
    width: 100%;
    max-width: 240px;
    height: auto;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    box-sizing: border-box;
}

.mfa-totp__secret {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.mfa-totp__secret label {
    flex: 0 0 100%;
    font-weight: 700;
    color: #1E222D;
}

.mfa-totp__secret__value {
    flex: 1 1 240px;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    background: #f7f7f9;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
}

.mfa-totp__copy {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 16px;
    height: 36px;
}

.mfa-totp__secret .help {
    flex: 0 0 100%;
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #6b7280;
}

/* Recovery codes list */
.mfa-recovery-codes {
    margin: 16px 0;
}

.mfa-recovery-codes__list {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #f7f7f9;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    resize: vertical;
}

.mfa-recovery-codes__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

/* SWDA-3354 nudge banner — distinct admin warning row.
   The `.warning` class is added by Django's messages framework when level=WARNING,
   and `mfa-nudge` is added via `extra_tags` in soulclickBackend/nudge.py. */
ul.messagelist li.mfa-nudge,
ul.messagelist li.warning.mfa-nudge {
    border-left: 4px solid #7E3BC6;
    background: #2e3238 !important;
    color: #fff !important;
    padding: 12px 16px 12px 65px !important; /* keep icon gutter so first word is never hidden */
    font-weight: 500;
}

ul.messagelist li.mfa-nudge,
ul.messagelist li.mfa-nudge * {
    color: #fff !important;
}

body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta,
body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta:hover,
body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta:focus,
body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta:active,
body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta:link,
body.djangocms-admin-style ul.messagelist li.mfa-nudge .mfa-nudge__cta:visited {
    color: #7E3BC6 !important;
    text-decoration-color: #7E3BC6 !important;
    -webkit-text-fill-color: #7E3BC6 !important;
    text-decoration: underline;
    font-weight: 700;
}

/* Allauth /accounts/* pages: compact header when AdminSite `has_permission` is false
   (MFA views do not go through the admin) — match #user-tools density */
.allauth-mfa-user-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.35rem;
}

.allauth-mfa-user-tools__sep {
    user-select: none;
}

.allauth-mfa-user-tools__logout {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: baseline;
}

.allauth-mfa-user-tools__logout-btn {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    padding: 0 0 0 0.15rem;
    margin: 0;
    vertical-align: baseline;
}
