/* Sign-in screens rendered by layouts/main_login.php (login, forget password).
   Loaded after Bootstrap and admin.css, so the selectors below are scoped to .auth-card
   to win over them. */

html#inner {
    --auth-primary: #062A5A;
    --auth-primary-hover: #0B3F85;
    --auth-accent: #2563eb;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #dbe2ea;
    --auth-danger: #dc2626;
    --auth-aside-width: min(44vw, 680px);

    min-height: 100%;
    background-color: #f4f6f9;
}

/* font family, size and line height are the ones the page had with Bootstrap 3 */
body.auth-page {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    margin: 0;
    padding: 24px 16px 24px calc(var(--auth-aside-width) + 16px);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857143;
    background: transparent;
    color: var(--auth-text);
}

.auth-input > .js-toggle-password {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 46px;
    padding: 0;
    color: #64748b;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.auth-field input[type="password"],
.auth-field input[type="text"] {
    padding-right: 44px;
}

/* margin:auto centres the form and still lets a tall form scroll from its top */
.auth-shell {
    width: 100%;
    max-width: 380px;
    margin: auto;
}

/* no box around the form: it sits straight on the page, right of the side panel */
.auth-card {
    padding: 0;
}

/* ---------- side panel ---------- */

/* fixed on the left of a wide screen; on a narrow screen it becomes the bar at the top */
.auth-aside {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: var(--auth-aside-width);
    padding: 48px 56px;
    color: #fff;
    background-color: var(--auth-primary);
    background-image:
        radial-gradient(ellipse 70% 50% at 20% 30%, rgba(59, 130, 246, 0.25), transparent 70%),
        radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1.5px),
        linear-gradient(160deg, #0b3a78 0%, var(--auth-primary) 60%, #04173a 100%);
    background-size: auto, 24px 24px, auto;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 24px;
    font-size: 26px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
}

.auth-name {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.2;
}

.auth-title {
    margin: 10px 0 0;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
}

.auth-copyright {
    position: absolute;
    bottom: 28px;
    left: 56px;
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- map of Laos behind the form ---------- */

/* images/laos-map.svg: border from Natural Earth 1:10m (public domain), drawn with a dot fill */
body.auth-page::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--auth-aside-width);
    z-index: -1;
    background: url(../images/laos-map.svg) no-repeat center / auto 86%;
    opacity: 0.1;
    pointer-events: none;
}

/* heading of the form: "Login", "Forget password" */
.auth-section-title {
    margin: 0 0 24px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--auth-text);
}

/* ---------- fields ---------- */

/* .auth-field is the box of one field: the forms set it through fieldConfig, the captcha block has it in its markup */
.auth-field {
    margin: 0 0 18px;
    padding: 0;
}

.auth-field > label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: #334155;
}

.auth-input {
    position: relative;
}

.auth-input > .fa {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 46px;
    font-size: 16px;
    line-height: 46px;
    text-align: center;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s;
}

.auth-input:focus-within > .fa {
    color: var(--auth-primary);
}

/* "background" also clears the tick and warning icons Bootstrap 5 puts in a validated input */
.auth-field .form-control,
.auth-field .form-control.is-valid,
.auth-field .form-control.is-invalid {
    height: 46px;
    margin: 0;
    padding: 0 14px 0 44px;
    font-size: 15px;
    color: var(--auth-text);
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-field .form-control:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: 0;
}

.auth-field:has(.is-invalid) > label,
.auth-field .invalid-feedback {
    color: var(--auth-danger);
}

.auth-field .form-control.is-invalid {
    border-color: var(--auth-danger);
}

.auth-field .form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Bootstrap 5 shows an error only right after an invalid input; here the input sits inside .auth-input */
.auth-field .invalid-feedback {
    display: block;
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.4;
}

.auth-field .invalid-feedback:empty {
    display: none;
}

/* ---------- captcha ---------- */

.auth-captcha {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-captcha .auth-input {
    flex: 1 1 auto;
    min-width: 0;
}

.auth-captcha img {
    flex: 0 0 auto;
    height: 46px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    cursor: pointer;
}

.auth-hint {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--auth-muted);
}

/* ---------- alert ---------- */

.auth-card .alert {
    position: relative;
    margin: 0 0 18px;
    padding: 10px 36px 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: none;
}

.auth-card .alert.alert-danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.auth-card .alert > .fa {
    margin-right: 4px;
    font-size: 14px;
}

.auth-card .alert .btn-close {
    top: 3px;
    right: 2px;
    padding: 10px;
    font-size: 10px;
}

/* ---------- actions ---------- */

.auth-card .btn.auth-submit {
    display: block;
    width: 100%;
    height: 46px;
    margin: 6px 0 0;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 500;
    line-height: 46px;
    letter-spacing: 0;
    text-transform: none;
    color: #fff;
    background-color: var(--auth-primary);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 8px 16px -8px rgba(6, 42, 90, 0.6);
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.auth-card .btn.auth-submit:hover,
.auth-card .btn.auth-submit:focus {
    background-color: var(--auth-primary-hover);
    box-shadow: 0 10px 20px -8px rgba(6, 42, 90, 0.65);
}

.auth-card .btn.auth-submit:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.auth-card .btn.auth-submit:active {
    transform: translateY(1px);
}

.auth-card .btn.auth-submit .fa {
    margin-right: 6px;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.auth-card .auth-links a {
    font-weight: 500;
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-card .auth-links a.auth-back {
    color: var(--auth-muted);
}

.auth-card .auth-links a:hover,
.auth-card .auth-links a:focus {
    color: var(--auth-accent);
    text-decoration: underline;
}

@media (max-width: 900px) {
    body.auth-page {
        padding-left: 16px;
    }

    body.auth-page::before {
        left: 0;
    }

    .auth-aside {
        position: static;
        width: auto;
        margin: -24px -16px 0;
        padding: 28px 24px;
    }

    .auth-badge,
    .auth-copyright {
        display: none;
    }

    .auth-name {
        font-size: 24px;
    }

    .auth-title {
        margin-top: 4px;
        font-size: 14px;
    }

    /* the form starts under the bar, not in the middle of the space left */
    .auth-shell {
        margin: 28px auto auto;
    }
}
