/* Shared presentation for the frontend login and registration forms. */
:root {
    /* Keep short and long pages in the same layout viewport. */
    scrollbar-gutter: stable;
    --app-content-top-gap: 24px;
    --app-shell-max-width: 540px;
    --app-header-unit: min(10vw, 54px);
    --app-header-height: calc(var(--app-header-unit) * 1.22666667);
    --app-header-title-inset: calc(75px + var(--app-header-unit) * .93333333);
}

/* Legacy style.css makes only some pages' viewport scrollbars 4px wide.
   Restore native sizing so their reserved space matches the homepage. */
:root::-webkit-scrollbar,
body.auth-page::-webkit-scrollbar,
body.app-page::-webkit-scrollbar {
    width: auto;
    height: auto;
}

:root::-webkit-scrollbar-thumb,
:root::-webkit-scrollbar-track,
body.auth-page::-webkit-scrollbar-thumb,
body.auth-page::-webkit-scrollbar-track,
body.app-page::-webkit-scrollbar-thumb,
body.app-page::-webkit-scrollbar-track {
    background: revert;
    border-radius: revert;
}

/* Respect the configured image, including its own background and padding. */
.auth-logo {
    border-radius: 0;
}

.site-logo-frame {
    position: relative;
    display: block;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
}

.home-brand .site-logo-frame > img.site-logo-image,
.site-brand-link .site-logo-frame > img.site-logo-image {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

.auth-nav-link.site-brand-link {
    flex-shrink: 0;
    width: 32px;
}

body.auth-page {
    margin: 0;
    min-height: 100vh;
    background: #fff;
    color: #2a2a2a;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

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

.auth-shell {
    --auth-unit: min(10vw, 54px);
    width: 100%;
    max-width: var(--app-shell-max-width);
    min-height: 100vh;
    margin: 0 auto;
    background: #fff;
}

.auth-header {
    position: fixed;
    z-index: 999;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    max-width: var(--app-shell-max-width);
    height: calc(var(--app-header-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) calc(var(--app-header-unit) * .4) 0;
    margin: 0 auto;
    transform: none;
    background: #fff;
    border-bottom: 1px solid #f5f5f5;
    box-shadow: 0 1px 10px rgba(191, 199, 221, .25);
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial, Roboto, "PingFang SC", miui, "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
}

.auth-nav-actions {
    display: flex;
    align-items: center;
    gap: calc(var(--app-header-unit) * .26666667);
}

.auth-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #343a40;
    font: inherit;
    text-decoration: none;
}

.auth-nav-link:hover,
.auth-nav-link:focus,
.auth-nav-link:active {
    color: #343a40;
    text-decoration: none;
}

.auth-nav-link[aria-expanded="true"] {
    color: #ad4f37;
}

.auth-nav-link:focus-visible {
    outline: 2px solid #343a40;
    outline-offset: 2px;
    border-radius: 4px;
}

.auth-icon {
    display: block;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

@font-face {
    font-family: auth-service-icons;
    src: url('/red/fonts/auth-service-icons.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

.auth-service-icon {
    display: block;
    width: 24px;
    height: 24px;
    font-family: auth-service-icons;
    font-size: 24px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
}

.auth-main {
    padding: calc(var(--app-header-height) + env(safe-area-inset-top) + var(--app-content-top-gap)) calc(var(--auth-unit) * .4) calc(28px + env(safe-area-inset-bottom));
}

.auth-brand {
    text-align: center;
}

.auth-logo {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto;
    object-fit: contain;
}

.auth-site-name {
    margin-top: 12px;
    font-size: calc(var(--auth-unit) * .4);
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.auth-tagline {
    margin: calc(var(--auth-unit) * .53333333) 0 0;
    color: #909399;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.auth-form-box {
    padding: calc(var(--auth-unit) * .53333333) 0;
}

.auth-form {
    margin: calc(var(--auth-unit) * .53333333) 0 0;
    padding: 0;
}

.auth-field {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: calc(var(--auth-unit) * .53333333);
    padding: calc(var(--auth-unit) * .4);
    border-radius: calc(var(--auth-unit) * .8);
    background: #f7f8fa;
    color: #a2a2a2;
}

.auth-field:focus-within {
    box-shadow: 0 0 0 1px rgba(173, 79, 55, .24);
}

.auth-input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: #323233;
    font-family: inherit;
    font-size: 14px;
    line-height: 24px;
    text-align: left;
}

.auth-input::placeholder {
    color: #c8c9cc;
    opacity: 1;
}

.auth-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.auth-input::-webkit-inner-spin-button,
.auth-input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.auth-input::-ms-reveal,
.auth-input::-ms-clear {
    display: none;
}

.auth-password-toggle {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 24px;
    margin: 0 -8px 0 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #969799;
    cursor: pointer;
}

.auth-password-toggle .auth-icon {
    width: 18px;
    height: 18px;
}

.auth-password-toggle::before,
.auth-password-toggle::after {
    display: none !important;
    content: none !important;
}

.auth-password-toggle .auth-icon[hidden] {
    display: none !important;
}

.auth-password-toggle .auth-eye-closed,
.auth-password-toggle[aria-pressed="true"] .auth-eye-open {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-eye-closed {
    display: block;
}

.auth-submit {
    display: block;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 10px 16px;
    border: 1px solid #ad4f37;
    border-radius: calc(var(--auth-unit) * .8);
    background: #faeeec;
    color: #ad4f37;
    font: inherit;
    font-size: max(14px, calc(var(--auth-unit) * .32));
    line-height: 1.4;
    cursor: pointer;
}

.auth-submit:hover,
.auth-submit:focus {
    background: #f7e3df;
}

.auth-register {
    display: block;
    margin-top: calc(var(--auth-unit) * .53333333);
    color: #2a2a2a;
    font-size: max(14px, calc(var(--auth-unit) * .32));
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.auth-register:hover,
.auth-register:focus {
    color: #ad4f37;
    text-decoration: none;
}

.auth-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.auth-phone-group {
    margin-bottom: calc(var(--auth-unit) * .53333333);
}

.auth-phone-group .auth-phone-field {
    margin-bottom: 0;
}

.auth-dial-control,
.auth-dial-fixed {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #dcdfe6;
    color: #323233;
    font-size: 14px;
    line-height: 24px;
    white-space: nowrap;
}

.auth-dial-control {
    position: relative;
}

.auth-dial-arrow {
    width: 0;
    height: 0;
    border-top: 4px solid currentColor;
    border-right: 3px solid transparent;
    border-left: 3px solid transparent;
}

.auth-dial-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.auth-dial-control:focus-within {
    outline: 1px solid #ad4f37;
    outline-offset: 3px;
    border-radius: 2px;
}

/* Keep the native viewport and its scrollbar allocation unchanged at all times. */
:root { overflow-y: scroll; scroll-behavior: auto; }
:root.app-scroll-locked { overscroll-behavior: none; }
:root.app-scroll-locked > body.auth-page,
:root.app-scroll-locked > body.app-page {
    position: fixed !important;
    top: var(--app-scroll-top);
    left: var(--app-scroll-left);
    right: auto;
    bottom: auto;
    width: 100% !important;
    overflow: visible;
}
/* Neutralize the old plugin's body positioning and Bootstrap's second gutter. */
body.auth-page.body-no-scroll, body.app-page.body-no-scroll { position: static; width: auto; overflow: visible; }
body.app-page.modal-open, body.auth-page.modal-open { padding-right: 0 !important; }
body.app-page .modal, body.auth-page .modal { padding-right: 0 !important; padding-left: 0 !important; }

.auth-language-modal {
    --auth-unit: min(10vw, 54px);
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.auth-language-modal[hidden] {
    display: none !important;
}

.auth-language-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .35);
    cursor: default;
    opacity: 0;
    transition: opacity .5s ease;
}

.auth-language-sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--app-shell-max-width);
    max-height: 80vh;
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    outline: none;
    background: #fff;
    color: #2a2a2a;
    transform: translateY(100%);
    transition: transform .5s ease-in-out;
}

.auth-language-modal.is-open .auth-language-backdrop {
    opacity: 1;
}

.auth-language-modal.is-open .auth-language-sheet {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .auth-language-backdrop,
    .auth-language-sheet {
        transition: none;
    }
}

.auth-language-heading {
    position: relative;
    flex-shrink: 0;
    min-height: 48px;
}

.auth-language-heading h2 {
    margin: 0;
    padding: 12px 48px;
    color: #2a2a2a;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
}

.auth-language-close {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #bfc2c8;
    cursor: pointer;
}

.auth-language-close svg {
    width: 22px;
    height: 22px;
}

.auth-language-list {
    padding: 10px calc(var(--auth-unit) * .4) calc(var(--auth-unit) * .4);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.auth-language-option {
    display: flex;
    align-items: center;
    gap: calc(var(--auth-unit) * .26666667);
    width: 100%;
    margin-bottom: calc(var(--auth-unit) * .26666667);
    padding: calc(var(--auth-unit) * .4);
    border-radius: calc(var(--auth-unit) * .26666667);
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, .08);
    color: #2a2a2a;
    font-size: max(14px, calc(var(--auth-unit) * .32));
    line-height: 24px;
    text-decoration: none;
}

.auth-language-option:last-child {
    margin-bottom: 0;
}

.auth-language-option[aria-current="true"],
.auth-language-option:hover,
.auth-language-option:focus {
    color: #ad4f37;
    text-decoration: none;
}

.auth-language-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.auth-language-symbol {
    flex-shrink: 0;
    width: 25px;
    height: 25px;
}

.auth-language-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-left: auto;
    color: #ad4f37;
}

.auth-language-empty {
    margin: 0;
    padding: 24px 0;
    color: #909399;
    text-align: center;
}

.auth-language-page .auth-header {
    justify-content: space-between;
}

.auth-registration-page .auth-header {
    justify-content: space-between;
}

.auth-registration-page .auth-back-link .auth-icon {
    width: 20px;
    height: 20px;
}

.auth-registration-page .auth-form-box {
    padding: 0;
}

.auth-language-page-title {
    margin: 0;
    color: #323233;
    font-size: calc(var(--app-header-unit) * .42666667);
    font-weight: 500;
    line-height: 22px;
    text-align: center;
}

@media (min-width: 821px) {
    :root {
        --app-shell-max-width: 375px;
        --app-header-unit: 37.5px;
    }

    .auth-shell {
        --auth-unit: 37.5px;
    }

    .auth-language-modal {
        --auth-unit: 37.5px;
    }
}
