/*
 * BPBytes login page — fully custom markup (custom/themes/BPBytes/login.tpl), safe to restructure
 * freely. Rendered inside the normal header.tpl/footer.tpl <body> (with $AUTHENTICATED false, so
 * no sidebar/topbar/content wrappers are present) — .bpbytes-login itself provides the full-page
 * flex layout rather than a body class.
 *
 * Design: a floating card (not full-bleed panels) centered on the page background, split into a
 * dark brand side and a light form side — a common modern SaaS login pattern.
 */

.bpbytes-login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 32px 20px;
    box-sizing: border-box;
}

.bpbytes-login__shell {
    display: flex;
    width: 100%;
    max-width: 1080px;
    min-height: 600px;
    background: var(--bp-surface);
    border-radius: var(--bp-radius-xl);
    box-shadow: var(--bp-shadow-lg);
    overflow: hidden;
}

.bpbytes-login__brand {
    flex: 1 1 48%;
    background: var(--bp-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px;
    position: relative;
    overflow: hidden;
}

.bpbytes-login__brand img {
    max-width: 170px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.bpbytes-login__brand h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.25;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.bpbytes-login__brand p {
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 360px;
    line-height: 1.65;
    margin: 0;
    position: relative;
    z-index: 1;
}

.bpbytes-login__form-side {
    flex: 1 1 58%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.bpbytes-login__card {
    width: 100%;
    max-width: 360px;
}

.bpbytes-login__card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--bp-text);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.bpbytes-login__card .bpbytes-login__subtitle {
    color: var(--bp-text-muted);
    font-size: 13.5px;
    margin: 0 0 28px;
}

.bpbytes-login__card .bpbytes-field {
    margin-bottom: 16px;
}

.bpbytes-login__card label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bp-text-muted);
    margin-bottom: 6px;
}

.bpbytes-login__card input[type="text"],
.bpbytes-login__card input[type="password"] {
    width: 100% !important; /* core CSS forces 200px !important on text/password inputs */
    height: 46px;
    border: 1px solid var(--bp-border-strong);
    border-radius: var(--bp-radius);
    padding: 0 14px;
    font-size: 14px;
    color: var(--bp-text);
    background: var(--bp-surface);
    box-sizing: border-box;
    transition: border-color var(--bp-transition), box-shadow var(--bp-transition);
}

.bpbytes-login__card input[type="text"]::placeholder,
.bpbytes-login__card input[type="password"]::placeholder {
    color: var(--bp-text-faint);
}

.bpbytes-login__card input[type="text"]:focus,
.bpbytes-login__card input[type="password"]:focus {
    border-color: var(--bp-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--bp-primary-soft);
}

/* Color/hover/box-shadow come from the shared "primary action button" rule in components.css
   now — this just adds the login button's own full-width sizing on top of it. */
.bpbytes-login__card #bigbutton {
    width: 100%;
    height: 46px;
    border-radius: var(--bp-radius);
    border: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
    cursor: pointer;
}

.bpbytes-login__divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--bp-text-faint);
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
}

.bpbytes-login__divider::before,
.bpbytes-login__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bp-border);
}

.bpbytes-login__card input[name="SSO"] {
    width: 100%;
    height: 46px;
    border-radius: var(--bp-radius);
    background: var(--bp-surface);
    border: 1px solid var(--bp-border-strong);
    color: var(--bp-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--bp-transition), border-color var(--bp-transition);
}

.bpbytes-login__card input[name="SSO"]:hover {
    background: var(--bp-surface-alt);
    border-color: var(--bp-text-faint);
}

.bpbytes-login__forgot {
    text-align: center;
    margin-top: 16px;
}

.bpbytes-login__forgot a {
    font-size: 13px;
    color: var(--bp-primary);
    text-decoration: none;
    font-weight: 500;
}

.bpbytes-login__forgot a:hover {
    text-decoration: underline;
}

.bpbytes-login__forgot a:focus {
    outline: none;
}

.bpbytes-login__forgot a:focus-visible {
    outline: 2px solid var(--bp-primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* #forgot_password_dialog sits in its own <form> right after the SSO button with no spacing
   of its own — toggled visible by the "Forgot Password?" link's onclick. */
#forgot_password_dialog {
    /* padding, not margin — margin-top on a lone first-child div can collapse against its
       parent <form>'s own top edge and disappear visually; padding never collapses. */
    padding-top: 20px;
}

/* The "forgot password" mini-form's own submit — <input type="button" id="generate_pwd_button">
   — never matched #bigbutton or input[name="SSO"], so it fell back to a completely unstyled
   native button. */
/* Color/hover/box-shadow come from the shared "primary action button" rule in components.css
   now — this just adds this button's own full-width sizing on top of it. */
.bpbytes-login__card #generate_pwd_button {
    width: 100%;
    height: 46px;
    border-radius: var(--bp-radius);
    border: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: 4px;
    cursor: pointer;
}

.bpbytes-login__footer {
    text-align: center;
    margin-top: 32px;
    font-size: 11.5px;
    color: var(--bp-text-faint);
}

.bpbytes-login__footer a {
    color: var(--bp-text-faint);
}

.bpbytes-login .error {
    color: var(--bp-danger);
    font-size: 12.5px;
    display: block;
    margin-bottom: 14px;
}

@media (max-width: 860px) {
    .bpbytes-login {
        padding: 0;
    }

    .bpbytes-login__shell {
        flex-direction: column;
        max-width: none;
        min-height: 100vh;
        border-radius: 0;
    }

    .bpbytes-login__brand {
        flex: 0 0 auto;
        padding: 36px 32px;
        min-height: 200px;
    }

    .bpbytes-login__brand h1 {
        white-space: normal;
    }

    .bpbytes-login__form-side {
        flex: 1 1 auto;
        padding: 32px 28px;
    }
}

/* ---- Review fixes ---- */

/* Placeholder text: was 2.6:1 on white, now above the 4.5:1 minimum for readable text */
.bpbytes-login__card input[type="text"]::placeholder,
.bpbytes-login__card input[type="password"]::placeholder {
    color: #6b7086;
    opacity: 1;
}

/* Error / notice message: a soft alert box instead of bare red text */
.bpbytes-login__card span.error,
.bpbytes-login__card .error {
    display: block;
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: var(--bp-radius);
    border: 1px solid #f5c2c7;
    border-left: 4px solid var(--bp-danger);
    background: var(--bp-danger-soft);
    color: #9b1c2c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

/* Empty messages stay hidden (!important: some carry an inline display:inline) */
.bpbytes-login__card span.error:empty,
.bpbytes-login__card .error:empty,
.bpbytes-login__card #generate_success:empty {
    display: none !important;
}

/* The forgot-password result carries both success and failure text, so it uses a neutral
   notice style, not the red error one */
.bpbytes-login__card #generate_success:not(:empty) {
    display: block !important;
    border-color: #c9c4ee;
    border-left-color: var(--bp-primary);
    background: var(--bp-primary-soft);
    color: var(--bp-title);
}

/* Space between the SSO button and the forgot-password fields that open below it */
.bpbytes-login__card form.passform {
    margin-top: 0;
}



/* Forgot-password Submit keeps its normal look while the request runs (the full-page loader shows progress) */
.bpbytes-login__card #generate_pwd_button:disabled {
    opacity: 1;
    cursor: progress;
}

/* The forgot-password result sits below the Submit button, in space that is reserved up front, so
   neither the fields nor the vertically-centred card move when a message appears */
.bpbytes-login__card #forgot_password_dialog:not([style*="none"]) {
    display: block !important;
    position: relative;
    padding-bottom: 76px;
}

.bpbytes-login__card #generate_success:not(:empty) {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
}
