/* Dcat 的独立登录布局需要占满视口，保留其他后台页面的容器样式。 */
body.dcat-admin-body:has(.gooce-login) :is(.app-content.content, .content-body, section.content) {
    margin: 0;
    padding: 0;
}

/* 清除 Dcat 为登录内容生成的 Bootstrap 栅格沟槽，避免手机端横向溢出。 */
.row:has(> .col-md-12 > .gooce-login) {
    margin-inline: 0;
}

.col-md-12:has(> .gooce-login) {
    padding-inline: 0;
}

.gooce-login {
    --login-blue: #1555ed;
    --login-ink: #15213a;
    --login-muted: #64728a;
    --login-border: #d7dfed;
    --login-danger: #b42318;

    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 51% 49%;
    min-height: 100vh;
    min-height: 100svh;
    overflow: clip;
    color-scheme: light;
    background: #fbfcff url('../../images/admin/login/paper.webp') center / 100% 100% no-repeat;
    color: var(--login-ink);
    font-family: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    letter-spacing: 0;

    &::before {
        content: '';
        position: absolute;
        z-index: -1;
        inset: 0 auto 0 0;
        width: 53.25%;
        clip-path: polygon(0 0, 100% 0, 85.3% 100%, 0 100%);
        background: url('../../images/admin/login/waves.webp') left bottom / 100% auto no-repeat,
            linear-gradient(148deg, #1f64c6 0, #1a3994 27%, #173788 72%, #2142c1 100%);
    }

    & :is(h1, h2, p) { margin: 0; }
    & :is(h1, h2) { font-weight: 780; letter-spacing: 0; }
    & :is(button, input) { font: inherit; }
    & :is(button, input):focus-visible { outline: 2px solid var(--login-blue); outline-offset: 3px; }

    & .login-brand {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: clamp(35px, 5.4vh, 64px) 5.35vw 26px 6.25vw;
        color: #fff;
    }

    & .login-wordmark { display: flex; align-items: center; gap: 14px; }
    & .login-wordmark img { display: block; flex: none; width: 54px; height: 54px; object-fit: contain; }
    & .login-wordmark strong { display: block; font-size: 38px; line-height: 1; font-weight: 800; }
    & .login-wordmark small { display: block; margin-top: 8px; color: #eef5ff; font-size: 18px; font-weight: 650; }
    & .login-divider {
        width: 49px;
        height: 2px;
        margin: clamp(24px, 4.4vh, 49px) 0 clamp(23px, 4.1vh, 44px);
        background: #52b0f9;
    }
    & h1 { color: #fff; font-size: 50px; line-height: 1.24; }
    & .login-brand-copy { margin-top: 15px; color: #cbdcf8; font-size: 21px; line-height: 1.6; }

    & .login-modules {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 18px;
        width: 100%;
        margin-top: clamp(22px, 4.2vh, 44px);
    }
    & .login-module {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: center;
        gap: 14px;
        min-height: 84px;
        padding: 14px 18px;
        border: 1px solid #8cbaf414;
        border-radius: 8px;
        background: #8bb7ff14;
    }
    & .login-module .feather { color: #75b5ff; font-size: 34px; }
    & .login-module :is(strong, small) { display: block; }
    & .login-module strong { font-size: 19px; font-weight: 700; line-height: 1.35; }
    & .login-module small { margin-top: 5px; color: #c4d6f3; font-size: 14px; line-height: 1.45; }
    & .login-illustration {
        display: block;
        width: min(100%, 545px);
        height: auto;
        max-height: min(36vh, 400px);
        margin: auto 0 0 2%;
        padding-top: 18px;
        object-fit: contain;
        object-position: center bottom;
    }

    & .login-signin { position: relative; display: grid; place-items: center; padding: 52px 5.35vw 110px 7.2vw; }
    & .login-signin-inner { width: 100%; max-width: 565px; }
    & h2 { color: var(--login-ink); font-size: 49px; line-height: 1.22; }
    & .login-signin-copy { margin-top: 16px; color: var(--login-muted); font-size: 21px; line-height: 1.55; }
    & #login-form { display: grid; gap: 31px; margin-top: 47px; }
    & .login-field {
        display: flex;
        align-items: center;
        gap: 17px;
        min-height: 68px;
        padding-left: 22px;
        border: 1px solid var(--login-border);
        border-radius: 10px;
        background: #ffffffd9;
        color: #586783;
    }
    & .login-field .feather { flex: none; font-size: 22px; }
    & .login-field:focus-within { border-color: var(--login-blue); box-shadow: 0 0 0 3px #1555ed1d; }
    & .login-field:has([aria-invalid='true']) { border-color: var(--login-danger); }
    & .login-field input {
        flex: 1;
        align-self: stretch;
        min-width: 0;
        padding: 0 12px 0 0;
        border: 0;
        outline: none;
        background: transparent;
        color: var(--login-ink);
        font-size: 19px;
    }
    & .login-field input::placeholder { color: #697690; opacity: 1; }

    & .login-password-toggle {
        display: grid;
        place-items: center;
        flex: none;
        width: 46px;
        height: 46px;
        margin-right: 12px;
        padding: 0;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: #586783;
        cursor: pointer;
    }
    & .login-password-toggle:hover { background: #edf3ff; }

    & .login-captcha { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
    & .login-captcha-refresh {
        display: grid;
        place-items: center;
        padding: 0 6px;
        border: 1px solid var(--login-border);
        border-radius: 8px;
        background: #fff;
        cursor: pointer;
    }
    & .login-captcha-refresh img { display: block; max-width: min(124px, 27vw); }
    & .login-remember {
        display: inline-flex;
        align-items: center;
        justify-self: start;
        gap: 10px;
        margin: 0;
        color: #34415b;
        font-size: 17px;
        cursor: pointer;
    }
    & .login-remember input { width: 19px; height: 19px; margin: 0; accent-color: var(--login-blue); }
    & .login-submit {
        display: grid;
        place-items: center;
        width: 100%;
        min-height: 68px;
        margin-top: 18px;
        padding: 0 16px;
        border: 0;
        border-radius: 9px;
        background: var(--login-blue);
        color: #fff;
        font-size: 21px;
        font-weight: 750;
        cursor: pointer;
    }
    & .login-submit:hover { background: #1147cf; }
    & .login-submit:disabled { opacity: .65; cursor: wait; }
    & .login-error { min-height: 24px; margin-top: 12px; color: var(--login-danger); font-size: 14px; }
    & .login-footnote {
        position: absolute;
        inset: auto 5.35vw clamp(28px, 10vh, 104px) 7.2vw;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        color: var(--login-muted);
        font-size: 16px;
    }
    & .login-footnote .feather { font-size: 21px; }

    /* 验证码打开时留出额外一行，在短视口保持表单和页脚互不遮挡。 */
    & .login-signin:has(.login-captcha) { padding-bottom: 136px; }
    & .login-signin:has(.login-captcha) .login-footnote { bottom: 32px; }

    @media (max-width: 1399px) {
        & :is(h1, h2) { font-size: 38px; }
        & :is(.login-brand-copy, .login-signin-copy) { font-size: 18px; }
        & .login-module { padding-inline: 14px; gap: 11px; }
    }

    @media (max-width: 1120px) {
        & :is(h1, h2) { font-size: 32px; }
        & .login-wordmark strong { font-size: 31px; }
        & .login-wordmark small { font-size: 15px; }
        & .login-module { grid-template-columns: 25px minmax(0, 1fr); min-height: 74px; padding: 12px; }
        & .login-module .feather { font-size: 24px; }
        & .login-module strong { font-size: 16px; }
        & .login-module small { font-size: 12px; }
    }

    @media (min-width: 821px) and (max-height: 780px) {
        & .login-brand { padding-top: 28px; }
        & .login-divider { margin: 22px 0; }
        & .login-modules { margin-top: 19px; }
        & .login-illustration { max-height: 31vh; }
        & .login-footnote { bottom: 30px; }
        & #login-form { gap: 22px; margin-top: 33px; }
        & :is(.login-field, .login-submit) { min-height: 56px; }
    }

    /* 手机端缩短品牌区，让表单成为首屏主要内容。 */
    @media (max-width: 820px) {
        & { grid-template-columns: minmax(0, 1fr); align-content: start; background: #fbfcff; }
        &::before { display: none; }
        & .login-brand {
            padding: 26px max(22px, calc((100% - 480px) / 2)) 30px;
            background: #193d99 url('../../images/admin/login/waves.webp') center bottom / cover no-repeat;
        }
        & .login-wordmark { gap: 10px; }
        & .login-wordmark img { width: 38px; height: 38px; }
        & .login-wordmark strong { font-size: 27px; }
        & .login-wordmark small { margin-top: 5px; font-size: 12px; }
        & h1 { margin-top: 21px; font-size: 24px; }
        & .login-brand-copy { margin-top: 7px; font-size: 13px; }
        & :is(.login-divider, .login-modules, .login-illustration) { display: none; }
        & .login-signin, & .login-signin:has(.login-captcha) { padding: 34px 22px 24px; }
        & .login-signin-inner { max-width: 480px; }
        & h2 { font-size: 27px; }
        & .login-signin-copy { margin-top: 9px; font-size: 15px; }
        & #login-form { gap: 17px; margin-top: 26px; }
        & .login-field { min-height: 52px; gap: 12px; padding-left: 16px; }
        & :is(.login-field input, .login-remember) { font-size: 16px; }
        & .login-field .feather { font-size: 19px; }
        & .login-password-toggle { margin-right: 4px; }
        & .login-submit { min-height: 52px; margin-top: 4px; font-size: 17px; }
        & .login-footnote { position: static; margin-top: 20px; font-size: 13px; }
        & .login-footnote .feather { font-size: 17px; }
    }
}
