/* ===========================================================================
   Страницы «Регистрация» (content/users/regform.php) и «Забыл пароль»
   (content/users/forgot_password.php): карточка в стиле сайта, поля с
   подписями над полем, ошибки у полей, белая кнопка во всю ширину.
   Шаг «код отправлен» - общие с формой входа классы .auth-sent, .auth-otp,
   .auth-link (templates/nero/assets/css/style.css).
   Заголовок страницы - один, h1 шаблона (название материала).
   =========================================================================== */

.ab-auth {
    width: 100%;
    max-width: 30rem;
    margin: 0 auto;
}

.ab-auth--wide {
    max-width: 42rem;
}

.ab-auth__card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 2rem;
    background: var(--gray-darker, #232323);
    border: 1px solid #313131;
    border-radius: 1.25rem;
    color: var(--white, #F8FAF9);
}

.ab-auth__lead {
    margin: 0;
    font-size: var(--text-base, .875rem);
    line-height: 1.5;
    color: var(--white, #F8FAF9);
    opacity: .6;
}

.ab-auth__lead a,
.ab-auth__inline-link {
    color: var(--white, #F8FAF9);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ab-auth__section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid #313131;
}

.ab-auth__section-title {
    margin: 0;
    font-size: var(--text-sm, .75rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--white, #F8FAF9);
    opacity: .5;
}

.ab-auth__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ab-auth__grid:empty {
    display: none;
}

/* ---------- Поле с подписью ---------- */
.ab-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.ab-field__label {
    font-size: var(--text-sm, .75rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--white, #F8FAF9);
    opacity: .7;
}

.ab-field__req {
    margin-left: 2px;
    opacity: .6;
}

.ab-field__control {
    position: relative;
}

.ab-field__input {
    display: block;
    width: 100%;
    height: 48px; /* как в форме входа: 48px на ПК, 54px на телефоне (ниже) */
    padding: 0 1rem;
    border: 1px solid #333;
    border-radius: calc(.75rem + 4px);
    background: var(--black, #1B1B1B);
    color: var(--white, #F8FAF9);
    font-family: inherit;
    font-size: calc(var(--text-base, .875rem) + 1px);
    line-height: 1.2;
    outline: none;
    box-shadow: none;
    transition: border-color .2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ab-field__input::placeholder {
    color: var(--white, #F8FAF9);
    opacity: .25;
}

.ab-field__input:focus {
    border-color: var(--white, #F8FAF9);
}

/* Автозаполнение - общее правило style.css (заливка цвета поля --ab-autofill-bg, по умолчанию #1B1B1B, как здесь) */
.ab-field__input:-webkit-autofill {
    -webkit-text-fill-color: var(--white, #F8FAF9);
    -webkit-box-shadow: 0 0 0 1000px var(--ab-autofill-bg, var(--black, #1B1B1B)) inset;
    caret-color: var(--white, #F8FAF9);
}

.ab-field--password .ab-field__input {
    padding-right: 3.25rem;
}

.ab-field__eye {
    position: absolute;
    top: 50%;
    right: .375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: .625rem;
    background: none;
    color: var(--white, #F8FAF9);
    opacity: .5;
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity .2s ease;
}

.ab-field__eye:hover,
.ab-field__eye[aria-pressed="true"] {
    opacity: 1;
}

.ab-field__eye svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

.ab-field__hint {
    font-size: var(--text-xs, .625rem);
    line-height: 1.4;
    color: var(--white, #F8FAF9);
    opacity: .5;
}

.ab-field__error {
    font-size: var(--text-sm, .75rem);
    line-height: 1.35;
    color: #FF8A86;
}

.ab-field__error:empty {
    display: none;
}

.ab-field--error .ab-field__input {
    border-color: #ED3C38;
}

.ab-field--error .ab-field__hint {
    display: none;
}

/* ---------- Сегмент: физлицо / ИП / юрлицо, e-mail / телефон ---------- */
.ab-seg {
    display: flex;
    gap: .25rem;
    padding: .25rem;
    border: 1px solid #333;
    border-radius: .875rem;
    background: var(--black, #1B1B1B);
}

.ab-seg__item {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 .5rem;
    border: 1px solid transparent;
    border-radius: .625rem;
    background: none;
    color: var(--white, #F8FAF9);
    font-family: inherit;
    font-size: var(--text-sm, .75rem);
    font-weight: 500;
    line-height: 1.1;
    text-align: center;
    opacity: .5;
    cursor: pointer;
    transition: opacity .2s ease, border-color .2s ease, background-color .2s ease;
}

.ab-seg__item:hover {
    opacity: .85;
}

.ab-seg__item[aria-checked="true"] {
    opacity: 1;
    border-color: var(--white, #F8FAF9);
    background: var(--gray-darker, #232323);
}

.ab-seg__item:focus-visible {
    outline: 2px solid var(--white, #F8FAF9);
    outline-offset: 2px;
}

/* ---------- Согласия (модуль users_agreement_module_new.php) - компактные галочки ---------- */
.ab-auth .ui-input--agreement {
    height: auto;
    margin: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    transform: none;
}

.ab-auth .ui-input--agreement:focus-within {
    transform: none;
    box-shadow: none;
}

.ab-auth .ui-input--agreement:has(.agreement-input:checked),
.ab-auth .ui-input--agreement.agreement-active {
    background: none;
}

.ab-auth .agreement-label,
.ab-auth .ui-input--agreement:has(.agreement-input:checked) .agreement-label,
.ab-auth .ui-input--agreement.agreement-active .agreement-label,
.ab-auth .agreement-input:checked + .agreement-label {
    padding-left: 2rem;
    font-size: var(--text-sm, .75rem);
    line-height: 1.5;
    color: var(--white, #F8FAF9);
}

.ab-auth .agreement-text,
.ab-auth .agreement-link,
.ab-auth .ui-input--agreement:has(.agreement-input:checked) .agreement-text,
.ab-auth .ui-input--agreement:has(.agreement-input:checked) .agreement-link,
.ab-auth .ui-input--agreement.agreement-active .agreement-text,
.ab-auth .ui-input--agreement.agreement-active .agreement-link {
    color: var(--white, #F8FAF9);
    padding-top: 0;
}

.ab-auth .agreement-text {
    opacity: .8;
}

/* Квадратная галочка вместо круга */
.ab-auth .agreement-label::before,
.ab-auth .ui-input--agreement:has(.agreement-input:checked) .agreement-label::before,
.ab-auth .ui-input--agreement.agreement-active .agreement-label::before {
    top: 0;
    width: 1.25rem;
    height: 1.25rem;
    transform: none;
    border: 1px solid #4a4a4a;
    border-radius: .375rem;
    background: var(--black, #1B1B1B);
}

.ab-auth .agreement-label::after,
.ab-auth .ui-input--agreement:has(.agreement-input:checked) .agreement-label::after,
.ab-auth .ui-input--agreement.agreement-active .agreement-label::after {
    top: .3rem;
    left: .4375rem;
    width: .375rem;
    height: .625rem;
    border: solid var(--black, #1B1B1B);
    border-width: 0 2px 2px 0;
    border-radius: 0;
    background: none;
    transform: rotate(45deg) scale(0);
}

.ab-auth .agreement-input:checked + .agreement-label::before {
    border-color: var(--white, #F8FAF9);
    background: var(--white, #F8FAF9);
}

.ab-auth .agreement-input:checked + .agreement-label::after {
    transform: rotate(45deg) scale(1);
}

.ab-auth .agreement-input:focus-visible + .agreement-label::before {
    outline: 2px solid var(--white, #F8FAF9);
    outline-offset: 2px;
}

.ab-auth .ui-input--agreement.ab-agree--error .agreement-label::before {
    border-color: #ED3C38;
}

.ab-auth__agree {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

/* ---------- Кнопки ---------- */
.ab-auth__submit.btn {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border-radius: calc(.75rem + 4px);
    padding: 0 1.5rem;
    font-weight: 600;
    line-height: 1;
}

.ab-auth__submit[disabled] {
    opacity: .85;
    cursor: progress;
    pointer-events: none;
}

.ab-auth__foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    flex-wrap: wrap;
    font-size: var(--text-sm, .75rem);
    line-height: 1.4;
}

.ab-auth__foot-text {
    color: var(--white, #F8FAF9);
    opacity: .5;
}

/* Ошибка формы целиком (ответ сервера) */
.ab-auth__error {
    padding: .75rem 1rem;
    border-radius: .75rem;
    background: rgba(237, 60, 56, .1);
    border: 1px solid rgba(237, 60, 56, .35);
    color: #FF8A86;
    font-size: var(--text-sm, .75rem);
    line-height: 1.45;
}

.ab-auth__error:empty,
.ab-auth__error[hidden] {
    display: none;
}

/* Спиннер на кнопках */
.ab-auth .btn-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: .5rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    vertical-align: -3px;
    animation: ab-auth-spin .7s linear infinite;
}

@keyframes ab-auth-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Сообщение-результат (письмо отправлено, ошибка) ---------- */
.ab-auth__result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.ab-auth__result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--black, #1B1B1B);
    border: 1px solid #333;
    color: var(--white, #F8FAF9);
}

.ab-auth__result--error .ab-auth__result-icon {
    color: #FF8A86;
    border-color: rgba(237, 60, 56, .35);
}

.ab-auth__result-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.ab-auth__result-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.ab-auth__result-text {
    margin: 0;
    font-size: var(--text-base, .875rem);
    line-height: 1.5;
    opacity: .7;
}

/* Поле кода на странице - фон карточки темнее, чем в выпадающей форме */
.ab-auth .auth-otp__field {
    background: var(--black, #1B1B1B);
}

.ab-auth .auth-sent__change {
    background: var(--black, #1B1B1B);
}

/* ---------- «Мои данные» для гостя: форма входа из шапки (login_form_new.php) прямо на странице ---------- */
.ab-login-page {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.ab-login-page .ab-auth__h1 {
    margin-bottom: 2rem;
}

/* Зачем вход (гость открыл личный раздел, ?need= - profileform.php): плашка над формой - иконка в круге, светлая рамка */
.ab-login-need {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 1rem;
    padding: 14px 18px 14px 14px;
    background: rgba(248, 250, 249, .04);
    border: 1px solid rgba(248, 250, 249, .28);
    border-radius: 1.25rem;
    animation: ab-login-need-in .35s cubic-bezier(.2, .7, .2, 1) both;
}

.ab-login-need__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white, #F8FAF9);
    color: var(--black, #1B1B1B);
}

.ab-login-need__icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.ab-login-need__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
    font-size: calc(var(--text-base, .875rem) + 1px);
    font-weight: 500;
    line-height: 1.3;
    color: var(--white, #F8FAF9);
}

.ab-login-need__text span {
    font-size: var(--text-sm, .75rem);
    font-weight: 400;
    color: var(--white, #F8FAF9);
    opacity: .5;
}

@keyframes ab-login-need-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ab-login-need { animation: none; }
}

.ab-login-page__row {
    display: grid;
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    gap: 3rem;
    padding: 2.5rem;
    background: var(--gray-darker, #232323);
    border: 1px solid #313131;
    border-radius: 1.25rem;
    overflow: hidden;
}

.ab-login-page__main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

/* Выпадающее меню из шапки, поставленное в поток страницы: всегда видно, без тени и позиционирования */
.ab-login.dropdown__menu {
    position: static;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    overflow: visible;
    transition: none;
    z-index: auto;
}

.ab-login .dropdown__title {
    display: none;
}

.ab-login .ui-input,
.ab-login .ui-input__field,
.ab-login .auth-otp__field,
.ab-login .auth-sent__change {
    --ab-autofill-bg: var(--black, #1B1B1B); /* заливка автозаполнения (style.css) - в цвет поля */
    background: var(--black, #1B1B1B);
}

.ab-login-page__note {
    margin: 0;
    font-size: var(--text-sm, .75rem);
    line-height: 1.5;
    color: rgba(248, 250, 249, .5);
}

.ab-login-page__note .auth-link {
    color: var(--white, #F8FAF9);
}

.ab-login-page__note .auth-link {
    padding: 0;
    display: inline;
}

.ab-login-page__promo {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    padding-left: 3rem;
    border-left: 1px solid #333;
}

.ab-login-page__promo-name {
    margin: 0;
    font-size: var(--text-sm, .75rem);
    color: var(--white, #F8FAF9);
    opacity: .5;
}

.ab-login-page__promo-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--white, #F8FAF9);
    opacity: .5;
}

.ab-login-page__promo-title span {
    opacity: 1;
    color: var(--white, #F8FAF9);
}

.ab-login-page__promo-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    align-self: flex-start;
    font-size: var(--text-base, .875rem);
    font-weight: 500;
    color: var(--white, #F8FAF9);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.ab-login-page__promo-link svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

/* Машина: прижата к низу колонки. Корма в самой картинке обрезана (машина «выезжает» из кадра справа), поэтому картинка
   доходит до правого края карточки (за поле 2.5rem, карточка обрезает лишнее) - срез совпадает с краем карточки.
   Фон у картинки прозрачный; общие правила .page-content img (тень, скругление, отступ) - не для неё, иначе видна рамка */
.ab-login-page__promo-img {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin: auto -2.5rem 0 0;
    padding-top: 1rem;
}

/* Тень под колёсами - машина стоит, а не висит */
.ab-login-page__promo-img::after {
    content: "";
    position: absolute;
    left: 4%;
    right: 0;
    bottom: -6px;
    height: 22px;
    background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.ab-login-page .ab-login-page__promo-img img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0;
    object-fit: contain;
    object-position: right bottom;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 768px) {
    /* На телефоне - только форма на фоне страницы: без карточки и без промо с машиной */
    .ab-login-page {
        width: auto;
        margin-left: -4px;
        margin-right: -4px;
    }

    .ab-login-page .ab-auth__h1 {
        margin-bottom: 1.5rem;
    }

    .ab-login-page__row {
        display: block;
        padding: 0;
        background: none;
        border: 0;
        border-radius: 0;
        overflow: visible;
    }

    .ab-login-page__promo {
        display: none;
    }

    .ab-login .ui-input,
    .ab-login .ui-input__field,
    .ab-login .auth-otp__field,
    .ab-login .auth-sent__change {
        --ab-autofill-bg: var(--gray-darker, #232323);
        background: var(--gray-darker, #232323);
    }
}

/* ---------- Форма прямо на фоне страницы (регистрация, вход на «Мои данные»): без карточки, одна колонка ---------- */
.ab-auth--page {
    max-width: 480px;
}

.ab-auth--page .ab-auth__h1 {
    margin-bottom: 2rem;
}

.ab-auth--page .ab-auth__card {
    gap: calc(1.25rem + 6px); /* отступы как в форме входа (круг 3: +6px) */
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
}

.ab-auth--page .ab-auth__section {
    gap: calc(1.25rem + 6px);
    padding-top: 0;
    border-top: 0;
}

.ab-auth--page .ab-auth__grid {
    grid-template-columns: 1fr;
    gap: calc(1.25rem + 6px);
}

.ab-auth--page .ab-auth__foot {
    margin-top: -0.25rem;
}

@media (max-width: 768px) {
    /* высота полей и кнопок - как в форме входа на телефоне */
    .ab-field__input,
    .ab-auth__submit.btn {
        height: 54px;
        min-height: 54px;
    }

    /* поля во всю ширину с отступом 16px от краёв экрана (у .second-container на телефоне 20px) */
    .ab-auth--page {
        width: auto;
        margin-left: -4px;
        margin-right: -4px;
    }

    .ab-auth--page .ab-auth__h1 {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .ab-auth__card {
        padding: 1.25rem 1rem;
        gap: 1rem;
        border-radius: 1rem;
    }

    .ab-auth__grid {
        grid-template-columns: 1fr;
    }

    .ab-seg__item {
        font-size: var(--text-xs, .625rem);
        padding: 0 .25rem;
    }
}
