/*
 * Sign-in pages (layouts/auth): plain CSS, no Bootstrap or SmartAdmin. The look is the classic one the pages had on
 * SmartAdmin: the livery's textured page, a panel with a grey title band and a grey band with the buttons
 * (.auth-card-footer) on the right, square fields with the icon after a divider, Bootstrap's blue button. The header
 * and footer keep the livery colours from the livery stylesheet; only their layout is set here (with the ids
 * repeated, so it wins over the livery's #header rules).
 */
:root {
    --auth-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --auth-field-font: "Open Sans", Helvetica, Arial, sans-serif;
    --auth-text: #333;
    --auth-text-muted: #666;
    --auth-band-bg: rgba(248, 248, 248, .9);
    --auth-band-border: rgba(0, 0, 0, .1);
    --auth-border: #ddd;
    --auth-field-border: #bdbdbd;
    --auth-field-focus: #5d98cc;
    --auth-icon: #a2a2a2;
    --auth-primary: #337ab7;
    --auth-primary-border: #2e6da4;
    --auth-primary-hover: #286090;
    --auth-primary-hover-border: #204d74;
    --auth-danger-bg: #c26565;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body.auth-page {
    height: 100%;
}

/* The textured page, as SmartAdmin's; a livery with its own .brms-login background keeps it (!important there) */
html body.auth-page.brms-login {
    margin: 0;
    background: url(../img/mybg.png) #fff;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    color: #636b6f;
    font-family: var(--auth-font);
    font-size: 14px;
    line-height: 1.6;
}

/* Header and footer colour where the livery has none of its own (it came from SmartAdmin's theme before): no
   specificity, so every livery rule wins (e.g. black for BRMS, navy for Mr Peele) */
:where(#header.auth-header),
:where(.page-footer.auth-footer) {
    background-color: #2c3742;
}

/* Header with the logo, in the livery colour */
body.auth-page #header#header.auth-header {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 100%;
    /* !important: some liveries set the header height with !important on small screens */
    height: 70px !important;
    margin: 0;
    padding: 0 16px;
    border: 0;
}
body.auth-page .auth-header img {
    display: block;
    max-width: 100%;
    max-height: 60px;
}

.auth-main {
    flex: 1 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 15px 32px;
}

/* The panel: the title band, the white body and the band with the buttons */
.auth-card {
    width: 100%;
    max-width: 350px;
    padding: 0 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--auth-border);
    border-radius: 4px;
    box-shadow: 0 1px 1px #ececec;
}

.auth-title {
    margin: 0 -14px 25px;
    padding: 15px 13px;
    background: var(--auth-band-bg);
    border-bottom: 1px solid var(--auth-band-border);
    color: #232323;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.6;
}

.auth-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 18px -14px 0;
    padding: 17px 14px 15px;
    background: var(--auth-band-bg);
    border-top: 1px solid var(--auth-band-border);
}

.auth-alert {
    margin: 0 0 15px;
    padding: 10px 0;
    background: var(--auth-danger-bg);
    color: #fff;
    font-weight: 700;
    text-align: center;
}

.auth-alert-success {
    padding: 10px;
    background: #dff0d8;
    border: 1px solid #d6e9c6;
    color: #3c763d;
    font-weight: 400;
}

/* Small print below the button (e.g. Customer Service on Forgot Password) */
.auth-note {
    flex: 1 1 100%;
    margin: 10px 0 0;
    color: var(--auth-text-muted);
    font-size: 13px;
}
.auth-note a {
    color: var(--auth-primary);
    text-decoration: none;
}
.auth-note a:hover {
    text-decoration: underline;
}

/* Fields */
.auth-field {
    margin-bottom: 15px;
}
.auth-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--auth-text);
    font-size: 13px;
    font-weight: 400;
    line-height: 19px;
}
.auth-input {
    position: relative;
}
.auth-input input {
    display: block;
    width: 100%;
    height: 32px;
    padding: 5px 37px 5px 10px;
    border: 1px solid var(--auth-field-border);
    border-radius: 0;
    background: #fff;
    color: #404040;
    font-family: var(--auth-field-font);
    font-size: 13px;
    transition: border-color .3s;
}
.auth-input input:focus {
    outline: none;
    border-color: var(--auth-field-focus);
}

/* The icon in the field (user) and the show/hide password button, after a divider */
.auth-input-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    padding-left: 3px;
    border-left: 1px solid var(--auth-field-border);
    color: var(--auth-icon);
}
.auth-input-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.auth-input-button {
    padding-right: 0; /* no browser button padding, so the eye is centred like the span icons */
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    background: none;
    cursor: pointer;
}
.auth-input-button:hover {
    color: var(--auth-text);
}
.auth-input-button:focus-visible {
    outline: 1px solid var(--auth-field-focus);
}
.auth-input-button .auth-icon-hide,
.auth-input-button.is-shown .auth-icon-show {
    display: none;
}
.auth-input-button.is-shown .auth-icon-hide {
    display: block;
}

.auth-field-error {
    margin: 6px 0 0;
    color: #a94442;
    font-size: 13px;
}

.auth-link {
    display: inline-block;
    margin-top: 6px;
    padding: 0 1px;
    color: var(--auth-primary);
    font-size: 13px;
    line-height: 15px;
    text-decoration: none;
}
.auth-link:hover {
    text-decoration: underline;
}

/* The button */
.auth-button {
    display: inline-block;
    height: 31px;
    margin: 0;
    padding: 0 22px;
    border: 1px solid var(--auth-primary-border);
    border-radius: 2px;
    background: var(--auth-primary);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .05);
    color: #fff;
    font-family: var(--auth-field-font);
    font-size: 15px;
    font-weight: 300;
    line-height: 29px;
    cursor: pointer;
}
.auth-button:hover {
    background: var(--auth-primary-hover);
    border-color: var(--auth-primary-hover-border);
}
.auth-button:focus-visible {
    outline: 1px dotted #333;
    outline-offset: 2px;
}
/* Sign in / Reset Password: greyed out until the required fields are filled in. It stays clickable,
   so a click shows the browser's "fill in this field" hint, and submits a form the browser autofilled */
#login-form:invalid .auth-button,
#reset-form:invalid .auth-button {
    opacity: .65;
}

/* Text pages (e.g. "Check your e-mail") and the new password form */
.auth-card-wide {
    max-width: 540px;
}
.auth-text {
    margin: 0 0 15px;
    color: var(--auth-text);
    font-size: 13px;
}
.auth-text a {
    color: var(--auth-primary);
    text-decoration: none;
}
.auth-subtitle {
    margin: 20px 0 10px;
    color: var(--auth-text);
    font-family: var(--auth-field-font);
    font-size: 17px;
    font-weight: 300;
}
.auth-list {
    margin: 0 0 15px;
    padding-left: 20px;
    color: var(--auth-text);
    font-size: 13px;
}
.auth-list li {
    margin-bottom: 2px;
}
.auth-note .auth-subtitle {
    margin-top: 0;
    font-size: 15px;
}
.auth-note .auth-list {
    margin-bottom: 0;
    color: var(--auth-text-muted);
}
/* Fields without an icon */
.auth-input input.auth-input-plain {
    padding-right: 10px;
}

/* Messages after e-mail links (client/message): centred, without the bands, like before */
.auth-message {
    padding: 20px;
    text-align: center;
}
.auth-message .auth-title {
    margin: 10px 0 20px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--auth-text-muted);
    font-family: var(--auth-field-font);
    font-size: 22px;
}
.auth-message .auth-text {
    font-size: 15px;
}
.auth-text-spaced {
    margin-top: 20px;
}

/* A link that looks like the button (e.g. "Back to login page") */
a.auth-button.auth-button-link {
    color: #fff;
    text-decoration: none;
}
.auth-button.auth-button-secondary {
    border-color: #ccc;
    background: #fff;
    color: var(--auth-text);
}
a.auth-button.auth-button-secondary {
    color: var(--auth-text);
}
.auth-button.auth-button-secondary:hover {
    background: #e6e6e6;
    border-color: #adadad;
}
/* Cancel & Logout */
.auth-button.auth-button-danger {
    border-color: #aa4a24;
    background: #bf5329;
}
.auth-button.auth-button-danger:hover {
    border-color: #8b3d1e;
    background: #9f4522;
}
/* Two buttons (e.g. Cancel & Logout, Change Password): one on each side, a single one on the right */
.auth-actions {
    display: flex;
    flex: 1 1 100%;
    gap: 10px;
    justify-content: space-between;
}
.auth-actions .auth-button:last-child {
    margin-left: auto;
}

/* Two-factor authentication: QR code beside the steps, six code fields, a spinner while the code is checked */
.auth-qr-setup {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 10px;
}
.auth-qrcode {
    flex: 0 0 auto;
    padding: 8px;
    border: 1px solid var(--auth-border);
    background: #fff;
}
.auth-qrcode svg,
.auth-qrcode img {
    display: block;
    width: 160px;
    height: 160px;
}
.auth-qr-setup .auth-list {
    margin: 0;
}
.auth-qr-setup .auth-list li {
    margin-bottom: 10px;
}
.auth-qr-setup a {
    color: var(--auth-primary);
    text-decoration: none;
}
/* The code entry's title is centred over the centred code fields */
.auth-title-center {
    text-align: center;
}
.auth-otp {
    margin-bottom: 25px;
    text-align: center;
}
.auth-otp-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
}
.auth-otp-input {
    width: 40px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--auth-field-border);
    border-radius: 0;
    background: #fff;
    color: #404040;
    font-family: var(--auth-field-font);
    font-size: 20px;
    text-align: center;
    transition: border-color .3s;
}
.auth-otp-input:focus {
    outline: none;
    border-color: var(--auth-field-focus);
}
.auth-submitting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 0;
    color: var(--auth-text-muted);
}
.auth-submitting[hidden] {
    display: none;
}
.auth-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--auth-border);
    border-top-color: var(--auth-primary);
    border-radius: 50%;
    animation: auth-spin .8s linear infinite;
}
@keyframes auth-spin {
    to { transform: rotate(360deg); }
}
@media (max-width: 520px) {
    .auth-qr-setup {
        flex-direction: column;
        align-items: center;
    }
    .auth-otp-inputs {
        gap: 6px;
    }
}

/* Footer in the livery colour */
body.auth-page .page-footer.auth-footer {
    position: static;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 15px 16px;
    border: 0;
    color: #fff;
    font-size: 14px;
    text-align: center;
}
body.auth-page .page-footer.auth-footer a {
    color: #fff;
}

@media (max-width: 480px) {
    body.auth-page #header#header.auth-header {
        height: 60px !important;
    }
    body.auth-page .auth-header img {
        max-height: 44px;
    }
}
