.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.auth-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.auth-modal__dialog {
    position: relative;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    z-index: 1;
}

.auth-modal__content {
    position: relative;
    background: #fff;
    padding: 32px 40px 40px;
    border-radius: 8px;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

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

.auth-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: #fff;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: 50%;
}

.auth-modal__close:hover {
    color: #333;
}

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

.auth-modal__header {
    display: block;
    padding-right: 36px;
    margin-bottom: 24px;
}

.auth-modal__tabs {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #eee;
}

.auth-modal__tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.auth-modal__tab:hover {
    color: #666;
}

.auth-modal__tab.is-active {
    color: #0cb28b;
    border-bottom-color: #0cb28b;
    font-weight: 500;
}

.auth-modal__panel .authorization {
    margin: 0;
    display: block !important;
    width: 100% !important;
    max-width: 100%;
}

.auth-modal__panel .authorization_form.page-block,
.auth-modal__panel .authorization .authorization_form {
    padding: 0;
    margin: 0;
    box-shadow: none;
    display: block !important;
    width: 100% !important;
    max-width: 100%;
    float: none;
}

.auth-modal__panel .authorization_form::after {
    content: '';
    display: table;
    clear: both;
}

.auth-modal__panel .authorization_form .input-group-1 {
    float: none !important;
    clear: both !important;
    width: 100%;
    margin: 0 0 16px;
}

.auth-modal__panel .authorization_form .auth-mode-switch,
.auth-modal__panel .authorization_form .auth-email-disclaimer,
.auth-modal__panel .authorization_form .message_err,
.auth-modal__panel .authorization_form .auth-message_err,
.auth-modal__panel .authorization_form .reg-message_err,
.auth-modal__panel .authorization_form .recovery-message_err {
    float: none !important;
    clear: both !important;
    width: 100%;
}

.auth-modal__panel .authorization_form .agreement {
    padding: 0 !important;
    margin: 16px 0 !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
}

.auth-modal__panel .authorization_form .agreement .check-box-1 {
    float: none !important;
    margin: 0;
    width: 100%;
}

.auth-modal__panel .authorization_form .agreement .check-box-1 label {
    display: block;
    width: 100%;
    max-width: 100%;
}

.auth-modal__panel .authorization_form .links {
    margin: 0 0 16px !important;
    padding: 0 !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    list-style: none;
}

.auth-modal__panel .authorization_form .links li {
    float: none !important;
    margin: 0 !important;
    width: 100%;
}

.auth-modal__panel .authorization_form .links a {
    display: inline-block;
}

.auth-modal__panel .authorization_form .auth-submit,
.auth-modal__panel .authorization_form button[type="submit"] {
    float: none !important;
    clear: both !important;
}

.auth-modal__panel .authorization_form .input-group-1 .caption {
    float: none !important;
    width: 100% !important;
    height: auto;
    line-height: 1.28;
    margin: 0 0 5px;
}

.auth-modal__panel .authorization_form .input-group-1 .input-field,
.auth-modal__panel .authorization_form .input-group-1 .select-box {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
}

.auth-modal__panel .authorization_form .button--large,
.auth-modal__panel .authorization_form .reg-send-code,
.auth-modal__panel .authorization_form .reg-verify,
.auth-modal__panel .authorization_form .reg-register,
.auth-modal__panel .authorization_form .recovery-submit,
.auth-modal__panel .authorization_form .recovery-verify,
.auth-modal__panel .authorization_form .recovery-reset {
    width: 100%;
    margin-left: 0 !important;
}

.auth-modal__panel .authorization_form .captcha_bitrix img {
    max-width: 100%;
    height: auto;
}

.auth-modal__panel .authorization_form .captcha_bitrix input {
    width: 100% !important;
    max-width: 100%;
}

.auth-modal__panel .auth-mode-switch {
    max-width: 100%;
}

.auth-modal__panel .auth-email-disclaimer {
    max-width: 100%;
}

.auth-modal__panel .reg-step,
.auth-modal__panel .recovery-step {
    max-width: 100%;
}

.auth-denied {
    text-align: center;
    padding: 40px 20px;
}

.auth-denied__title {
    font-size: 22px;
    margin: 0 0 12px;
    color: #333;
}

.auth-denied__text {
    font-size: 15px;
    line-height: 1.5;
    color: #666;
    margin: 0 0 24px;
}

.auth-denied__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

body.auth-modal-open {
    overflow: hidden;
}

@media screen and (max-width: 480px) {
    .auth-modal__dialog {
        width: 94%;
    }

    .auth-modal__content {
        padding: 28px 20px 24px;
    }

    .auth-modal__header {
        padding-right: 32px;
    }

    .auth-modal__close {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
    }

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

    .auth-modal__tab {
        padding: 12px 10px;
        font-size: 15px;
    }
}

/* Формы авторизации внутри модалки */
.auth-modal .auth-message_err,
.auth-modal .reg-message_err,
.auth-modal .recovery-message_err {
    color: #d00;
    padding: 10px 15px;
    margin-bottom: 15px;
    background: #ffeaea;
    border: 1px solid #fcc;
    border-radius: 4px;
    font-size: 14px;
}

.auth-modal .auth-message_send,
.auth-modal .reg-message_send,
.auth-modal .recovery-message_send {
    color: #080;
    padding: 10px 15px;
    margin-bottom: 15px;
    background: #eaffea;
    border: 1px solid #cfc;
    border-radius: 4px;
    font-size: 14px;
}

.auth-modal .auth-mode-switch {
    position: relative;
    display: flex;
    margin-bottom: 20px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(12, 178, 139, 0.12);
}

.auth-modal .auth-mode-switch__indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc((100% - 8px) / 2);
    height: calc(100% - 8px);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease;
    pointer-events: none;
}

.auth-modal .auth-mode-switch[data-active="email"] .auth-mode-switch__indicator,
.auth-modal .auth-mode-switch[data-active="login"] .auth-mode-switch__indicator {
    transform: translateX(100%);
}

.auth-modal .auth-mode-switch__btn {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #9aa0a6;
    font-size: 14px;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.2s ease;
}

.auth-modal .auth-mode-switch__btn:hover {
    color: #666;
}

.auth-modal .auth-mode-switch__btn.is-active {
    color: #333;
    font-weight: 500;
}

.auth-modal .auth-email-disclaimer {
    margin-bottom: 20px;
    padding: 10px 12px;
    background: rgba(12, 178, 139, 0.08);
    border: 1px solid rgba(12, 178, 139, 0.2);
    border-radius: 4px;
    line-height: 1.4;
    color: #555;
}

.auth-modal .auth-email-disclaimer p {
    margin: 0 0 8px;
    font-size: 13px;
}

.auth-modal .auth-email-disclaimer p:last-child {
    margin-bottom: 0;
}

.auth-modal .disabled-button {
    background: #b2b4b7 !important;
    border: 1px solid #555 !important;
    cursor: default !important;
}

.auth-modal .reg-step,
.auth-modal .recovery-step {
    margin-bottom: 10px;
}

.auth-modal .recovery-success-text {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #080;
    text-align: center;
}

.auth-modal .reg-timer,
.auth-modal .recovery-timer {
    font-size: 13px;
    color: #888;
    margin: 10px 0;
}

.auth-modal .reg-resend,
.auth-modal .recovery-resend {
    margin-bottom: 15px;
    font-size: 13px;
}

.auth-modal .reg-code,
.auth-modal .recovery-code {
    letter-spacing: 8px;
    text-align: center;
    font-size: 20px;
}
