/*
 * BVO public/unauthenticated pages — modern refresh.
 *
 * Scope: activated only where <main class="bvo-public-page"> is set —
 *   themed_standard_login.php, register.php, forgot.php, reactivate.php.
 * Custom-themed sites (CUSTOM_LOGIN_PAGE) do NOT set the class and are
 * untouched. Every rule below is prefixed with .bvo-public-page so this
 * file can be included site-wide from head.php with no side effects.
 *
 * No JS hooks, IDs, names, or form structure change — this is CSS-only.
 * Materialize/Bootstrap markup and classes are preserved.
 */

.bvo-public-page {
    background: linear-gradient(180deg, #f5f8fb 0%, #e6eef4 100%);
    min-height: 80vh;
    padding: 8px 0 56px;
}

/* Single centered 460px column for the whole login flow. Materialize's
   col offsets (col s12 m10 offset-m1 l6 offset-l3 xl4 offset-xl4) put the
   heading wrapper and the card on different X axes at wide viewports;
   collapsing them into one column here gives one shared axis so the
   heading, description, and card left edges line up. */
.bvo-public-page section.section > .wrapper {
    max-width: 492px;   /* 460 card + 16 side padding × 2 */
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
    float: none;
}
.bvo-public-page section.section > .wrapper > .row {
    margin-left: 0;
    margin-right: 0;
}
.bvo-public-page section.section > .wrapper > .row > .col {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    width: 100%;
    left: 0;
    float: none;
}

/* Logo — was 100% width / max 551px (huge). Shrink to something proportional.
   Two +25% bumps applied on user request; caps now 220/88 desktop and 175/69 mobile. */
.bvo-public-page .logged_out_header_logo {
    width: auto;
    height: auto;
    max-width: 220px;
    max-height: 88px;
    margin: 24px auto 12px;
    display: block;
}
@media (max-width: 600px) {
    .bvo-public-page .logged_out_header_logo {
        max-width: 175px;
        max-height: 69px;
        margin: 16px auto 8px;
    }
}

/* Hero — logo, heading and description all CENTER-aligned. The
   `.center-align` class is already there in the markup, so we just need
   to preserve it and let it apply consistently across login (via
   #welcomeback_leader), register, forgot and reactivate. */
.bvo-public-page .black-text.center-align {
    text-align: center;
    padding: 0;
}
.bvo-public-page .black-text.center-align .logged_out_header_logo {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.bvo-public-page .black-text.center-align h1,
.bvo-public-page .black-text.center-align p {
    text-align: center;
}

.bvo-public-page h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    color: #1a2c40;
    margin: 12px 0 6px;
    line-height: 1.2;
}
.bvo-public-page .description.flow-text,
.bvo-public-page .black-text.center-align .flow-text {
    color: #4a5b6d;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 16px;
}

/* Remove the ancient grey band behind the card */
.bvo-public-page .grey.lighten-2,
.bvo-public-page .grey.lighten-3,
.bvo-public-page .grey.lighten-4 {
    background-color: transparent !important;
}

/* Section spacing calmed down */
.bvo-public-page #welcomeback_leader {
    padding: 20px 0 8px;
}
.bvo-public-page section.section {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* The card. Width is inherited from the shared 460px column above; the
   card itself is a block that fills that column. Do NOT set margin:0 auto
   here — the card element also carries Materialize's `col ... offset-*`
   classes, and margin:auto would clobber offset-* margin-left and shift
   the card out of the shared column. Padding forced with !important
   because register.php's card sits inside additional col wrappers that
   introduce their own Materialize `.col` padding and shrink the effective
   left/right gutter otherwise. */
.bvo-public-page .card.cardBorder {
    border-radius: 14px;
    box-shadow: 0 12px 32px -12px rgba(15, 30, 55, 0.18),
                0 4px 12px -6px rgba(15, 30, 55, 0.08);
    padding: 32px !important;
    background: #ffffff;
    border: none !important;
    width: 100%;
    margin: 0;
    float: none;
    left: 0;
}
/* The form sits at 0/0 inside the card and inherits card padding.
   Bootstrap's ancient signin.css sets .form-signin { max-width:330px }
   for external installs; guard against it accidentally loading here. */
.bvo-public-page .card.cardBorder .form-signin {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
/* Materialize's `.row` uses margin:0 -0.75rem to bleed content past the
   parent's padding; cancel that so form rows respect the card padding. */
.bvo-public-page .card.cardBorder .form-signin > .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.bvo-public-page .card.cardBorder .form-signin > .row > .col.input-field {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
@media (max-width: 600px) {
    .bvo-public-page .card.cardBorder {
        padding: 24px 20px 20px;
        margin: 0 8px;
        border-radius: 12px;
    }
}

/* Collapse decorative empty spacer rows (rows whose only child column
   holds a single non-breaking-space <p>). Kept as display:none so the
   DOM stays untouched but the visual dead-space disappears. */
.bvo-public-page .form-signin .row:has(> .col > p:only-child) {
    display: none;
}
/* Older-browser fallback: at least tighten the vertical rhythm */
.bvo-public-page .form-signin .row {
    margin-bottom: 6px;
}
.bvo-public-page .form-signin .row .col p {
    margin: 0;
}

/* Inputs — force a consistent underline style. Bootstrap's .form-control
   (used by register.php's fields) otherwise wins the border cascade and
   renders inputs as boxes with a grey box-border, which reads inconsistent
   next to Materialize's underline style on login.php. */
.bvo-public-page .input-field input:not([type="checkbox"]):not([type="hidden"]) {
    height: 44px;
    font-size: 15px;
    color: #1a2c40;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-bottom: 1.5px solid #c0cbd5 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 0 4px !important;
    box-sizing: content-box;
}
.bvo-public-page .input-field input:hover:not([readonly]) {
    border-bottom-color: #8a99a8 !important;
}
.bvo-public-page .input-field input:focus:not([readonly]) {
    border-bottom-color: #26a69a !important;
    box-shadow: 0 1px 0 0 #26a69a !important;
    outline: none;
}
.bvo-public-page .input-field label {
    font-size: 15px;
    color: #6b7c8d;
}
.bvo-public-page .input-field label.active {
    color: #4a5b6d !important;
    font-size: 13px;
    font-weight: 500;
}

/* Primary button */
.bvo-public-page .btn.teal,
.bvo-public-page #signin_btn,
.bvo-public-page #reactivate_btn,
.bvo-public-page #mfa_go_btn,
.bvo-public-page #mfa_sign_in_from_setup_btn,
.bvo-public-page #mfa_setup_code_btn,
.bvo-public-page #mfa_show_qr_code_btn,
.bvo-public-page #unlock_yes_btn,
.bvo-public-page #unlock_go_btn {
    height: 46px;
    line-height: 46px;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: 8px !important;
    text-transform: none;
    padding: 0 20px;
    box-shadow: 0 4px 14px -4px rgba(38, 166, 154, 0.4);
    transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s;
}
.bvo-public-page .btn.teal:hover,
.bvo-public-page #signin_btn:hover {
    box-shadow: 0 6px 18px -4px rgba(38, 166, 154, 0.5);
    transform: translateY(-1px);
}
.bvo-public-page .btn.teal:active,
.bvo-public-page #signin_btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px -2px rgba(38, 166, 154, 0.5);
}
/* Grey disabled state */
.bvo-public-page .btn.grey {
    box-shadow: none;
    border-radius: 8px !important;
    height: 46px;
    line-height: 46px;
    text-transform: none;
    font-weight: 500;
}
/* Disabled / loading button (Bootstrap's button-loading toggles this).
   Keep the same solid teal look, just dimmed — no light-teal outline
   that looks like a broken state. */
.bvo-public-page .btn.teal[disabled],
.bvo-public-page .btn.teal.disabled,
.bvo-public-page button[disabled].btn {
    opacity: 0.7;
    box-shadow: none;
    cursor: wait;
    color: #ffffff !important;
    background-color: #26a69a !important;
    border: none !important;
}
/* Materialize's waves-ripple leaves a semi-transparent expanding circle
   inside the button. In a normal browser it fades in ~750ms; in a headless
   screenshot right after click it freezes mid-animation and reads as a
   pale outlined button. Hide it entirely on public-page buttons — the
   ripple is decorative, not functional. */
.bvo-public-page .btn .waves-ripple {
    display: none !important;
}
/* Cancel / danger buttons */
.bvo-public-page .btn.red {
    border-radius: 8px !important;
    height: 46px;
    line-height: 46px;
    text-transform: none;
    font-weight: 500;
    box-shadow: 0 4px 14px -4px rgba(211, 47, 47, 0.35);
}

/* Show/hide password toggle */
.bvo-public-page .show_hide_passwords {
    font-size: 13px;
    color: #4a5b6d;
    padding: 6px 0 10px;
}
.bvo-public-page .show_hide_passwords label {
    color: #4a5b6d !important;
}

/* Secondary links (forgot password / sign up / resend activation) */
.bvo-public-page .form-signin a {
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
    font-weight: 500;
}
.bvo-public-page .form-signin a:hover {
    border-bottom-color: currentColor;
}
/* Neutralise the ancient inline `font-size:large` on Forgot Password */
.bvo-public-page .form-signin a[href="/forgot.php"] {
    font-size: 14px !important;
    display: inline-block;
    padding: 4px 8px;
}

/* Divider between primary action + secondary links */
.bvo-public-page .form-signin .row:last-of-type {
    margin-bottom: 0;
}

/* MFA + unlock 6-digit code inputs */
.bvo-public-page .ge_mfa_code_cl,
.bvo-public-page .ge_unlock_code_cl {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    height: 52px;
    border: 1.5px solid #d5dde5 !important;
    border-radius: 8px;
    background: #fafbfd;
    padding: 0 4px;
    box-shadow: none !important;
    color: #1a2c40;
}
.bvo-public-page .ge_mfa_code_cl:focus,
.bvo-public-page .ge_unlock_code_cl:focus {
    border-color: #26a69a !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(38, 166, 154, 0.15) !important;
    outline: none;
}

/* Message boxes */
.bvo-public-page #ge_login_msgbox,
.bvo-public-page #ge_reactivate_msgbox,
.bvo-public-page #ge_use_mfa_msgbox,
.bvo-public-page #mfa_session_msg,
.bvo-public-page #ge_send_logout_msgbox,
.bvo-public-page #ge_use_logout_msgbox,
.bvo-public-page #ad_register_msgbox {
    min-height: 24px;
    font-size: 14px;
}
.bvo-public-page .err_msg_bad {
    color: #b71c1c;
    background: #ffebee;
    border-radius: 6px;
    padding: 8px 12px;
    display: inline-block;
    margin-top: 4px;
}
.bvo-public-page .err_msg_good {
    color: #1b5e20;
    background: #e8f5e9;
    border-radius: 6px;
    padding: 8px 12px;
    display: inline-block;
    margin-top: 4px;
}

/* Per-field validation errors.
   Markup pattern (register.php): <label>Field:<div class="err_msg right" id="…_errmsg"></div></label>
   plus JS sets inline background rgb(255, 228, 220) on invalid inputs.
   Recompose so labels read cleanly: label text left, error text right, on
   one line; input gets a soft red underline instead of the peach fill. */
.bvo-public-page .input-field > label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    white-space: normal;
    min-width: 0;
    /* Keep Materialize's `position: absolute` (needed for its float-label
       animation) — only add right padding so the flex-aligned error text
       sits inside the invalid pill instead of at its very edge. */
    padding-right: 10px;
    box-sizing: border-box;
}
.bvo-public-page .input-field > label .err_msg {
    color: #c62828;
    font-weight: 500;
    font-size: 12px;
    text-align: right;
    max-width: 100%;
    float: none !important;   /* defeat Materialize .right float:right */
    margin: 0;
    line-height: 1.3;
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;   /* wrap long single tokens rather than overflow */
}
/* Free-standing err_msg (not inside a label — e.g. the password summary
   line "Your password should be more than 6 characters long"). Its
   .right class from Materialize floats it right by default; force it
   to be a full-width CENTRE-aligned line so it visually pairs with the
   two password fields above it and matches the other form-level
   messages (they're already centred). */
.bvo-public-page .input-field > .err_msg,
.bvo-public-page .row > .col > .err_msg,
.bvo-public-page .input-field > .err_msg.right,
.bvo-public-page .row > .col > .err_msg.right {
    color: #c62828;
    font-weight: 500;
    font-size: 13px;
    margin: 4px 0 8px;
    text-align: center !important;
    float: none !important;
    display: block;
    width: 100%;
}
/* Invalid input: JS applies inline `background-color: <peach> !important`.
   Different browsers serialise the same colour differently in the style
   attribute — real Chrome/Safari store it as `#FFE4DC`, headless
   Chromium as `rgb(255, 228, 220)`. Match every plausible form,
   case-insensitively. The `:not()` chain gives this rule 0-5-1
   specificity so it beats the general input rule (0-4-1). */
.bvo-public-page .input-field input:not([type="checkbox"]):not([type="hidden"])[style*="#FFE4DC" i],
.bvo-public-page .input-field input:not([type="checkbox"]):not([type="hidden"])[style*="rgb(255, 228, 220)" i],
.bvo-public-page .input-field input:not([type="checkbox"]):not([type="hidden"])[style*="rgb(255,228,220)" i],
.bvo-public-page .input-field input:not([type="checkbox"]):not([type="hidden"])[style*="rgb(255 228 220)" i] {
    background-image: linear-gradient(#fff5f5, #fff5f5) !important;
    background-color: #fff5f5 !important;
    border-bottom-color: #d33 !important;
    box-shadow: 0 1px 0 0 #d33 !important;
}
/* Wrapper styling for the invalid row: soft pink background + red left
   strip + rounded corners. Drop the `>` child combinator inside :has()
   because older Safari (≤16) supports :has() but not with combinators;
   the whole rule gets discarded if the parser can't handle it. Plain
   descendant selector works from Safari 15.4 up. */
.bvo-public-page .input-field:has(input[style*="#FFE4DC" i]),
.bvo-public-page .input-field:has(input[style*="rgb(255, 228, 220)" i]),
.bvo-public-page .input-field:has(input[style*="rgb(255,228,220)" i]),
.bvo-public-page .input-field:has(input[style*="rgb(255 228 220)" i]) {
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #d33;
    padding-left: 10px !important;
    padding-right: 0 !important;
    box-sizing: border-box;
}

/* Form-level error at the bottom of the form (Bootstrap alert-danger).
   Give it a proper alert appearance to match the field-level errors. */
.bvo-public-page .form-signin .alert-danger {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    display: block;
    margin: 8px 0 0;
}
/* Success variant for the same msgbox */
.bvo-public-page .form-signin .alert-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    display: block;
    margin: 8px 0 0;
}

/* Invalid shake feedback (kept from original .invalid class hook) */
.bvo-public-page .form-signin.invalid {
    animation: bvoPublicShake 0.4s ease-in-out;
}
@keyframes bvoPublicShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Fieldsets used by MFA setup */
.bvo-public-page fieldset {
    border: 1px solid #e5ecf2;
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
    background: #fafbfd;
}
.bvo-public-page fieldset legend {
    font-size: 13px;
    color: #4a5b6d;
    padding: 0 8px;
    font-weight: 500;
}
