.auth-modal {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
}

.auth-modal.active {
    bottom: 0;
    opacity: 1;
    visibility: visible;
}

.auth-modal-content {
    background: #E30613;
    width: 90%;
    max-width: 450px;
    padding: 0 0 30px 0;
    border-radius: 24px;
    position: relative;
    transform: translateY(100%);
    transition: transform 1s ease, height 1s ease;
    box-sizing: border-box;
    overflow: visible;
    margin-top: 0;
}

.auth-modal-content.success {
    transform: translateY(70%) !important;
}

.auth-modal.active .auth-modal-content {
    transform: translateY(65%);
}

.auth-form {
    display: none;
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 0;
    box-sizing: border-box;
}

.auth-tab span {
    font-weight: 400;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    opacity: 1;
}

.form-group {
    width: 80%;
    box-sizing: border-box;
    margin: 0 auto;
    position: relative;
    transition: all 1.5s ease;
    opacity: 1;
    transform: translateY(0);
    height: auto;
    max-height: 100px;
    overflow: visible;
}

/* Добавляем z-index для каждого form-group */
.form-group:nth-child(1) { z-index: 5; }
.form-group:nth-child(2) { z-index: 4; }
.form-group:nth-child(3) { z-index: 3; }
.form-group:nth-child(4) { z-index: 2; }
.form-group:nth-child(5) { z-index: 1; }

.form-group.register-only {
    opacity: 0;
    transform: translateY(100px);
    max-height: 0;
    margin: 0 auto;
    transition: all 1.5s ease;
}

.auth-form[data-form="register"] .form-group.register-only {
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
}

.auth-form:not([data-form="register"]) .form-group.register-only {
    opacity: 0;
    transform: translateY(100px);
    max-height: 0;
    margin: 0 auto;
    pointer-events: none;
}

@keyframes slideIn {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100px);
        opacity: 0;
    }
}

.form-group label {
    display: block;
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    padding-left: 5px;
    opacity: 0.5;
    height: 10px;
    font-weight: 300;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #fff;
    border-radius: 10px;
    background: #fff;
    color: #000;
    font-size: 18px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    outline: none;
}

.form-group:has(.error-message.show) input {
    border: 3px solid #FDE170;
}

.form-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    font-size: 1.3em;
    width: 80%;
    box-sizing: border-box;
    margin: 10px auto;
}

.form-checkbox input[type="checkbox"] {
    width: 30px;
    height: 30px;
    border: 3px solid #fff;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.form-checkbox input[type="checkbox"]:checked {
    background: #fff;
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: #E30613;
    font-size: 24px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.form-checkbox label {
    font-weight: 200;
    display: flex;
    align-items: center;
    line-height: 1;
}

.rules-link {
    color: #FFE26B;
    font-size: 1em;
    margin-left: 4px;
    font-weight: 200;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Circe Rounded', Arial, sans-serif;
    background: none;
    border: none;
    padding: 0;
    transition: opacity 0.3s ease;
}

.rules-link:hover {
    opacity: 0.8;
}

.auth-submit {
    width: 80%;
    box-sizing: border-box;
    background: linear-gradient(to right, #FFE680, #FAB041, #FFE680);
    border: none;
    border-radius: 18px;
    padding: 15px 30px;
    color: #442F1E;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.auth-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.auth-submit::after {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.auth-submit:hover::before {
    left: 0;
}

.auth-submit:hover::after {
    right: 0;
}

.auth-submit span {
    position: relative;
    z-index: 2;
}

@media screen and (max-width: 768px) {
    .auth-modal.active .auth-modal-content {
        transform: translateY(90%);
    }
    .auth-modal-content {
        width: 95%;
        padding: 0 0 20px 0;
    }

    .auth-tab {
        font-size: 20px;
        padding: 12px 24px;
    }

    .form-group input {
        font-size: 16px;
        padding: 6px;
    }

    .auth-submit {
        font-size: 20px;
        padding: 12px 24px;
    }

    .form-checkbox {
        font-size: 14px;
        margin: 0 auto;
    }

    .rules-link {
        font-size: 14px;
    }

    .form-group {
        width: 90%;
    }

    .form-checkbox {
        width: 90%;
    }

    .auth-submit {
        width: 90%;
    }

    .auth-tab[data-tab="login"] {
        padding: 20px 0 20px 30px !important;
    }

    .auth-tab[data-tab="register"] {
        padding-right: 30px !important;
    }
}

.auth-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: #B10000;
    border-radius: 23px 23px 0 0;
    transition: background-color 1s ease;
}

.auth-tabs.switching {
    background: #E30613;
    animation: switchBackgroundSmoothest 2.5s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes switchBackgroundSmoothest {
    0% {
        background: #E30613;
    }
    20% {
        background: #DB0612;
    }
    40% {
        background: #C80510;
    }
    60% {
        background: #B8040C;
    }
    75% {
        background: #B40005;
    }
    85% {
        background: #B20003;
    }
    92% {
        background: #B10002;
    }
    97% {
        background: #B10001;
    }
    100% {
        background: #B10000;
    }
}

.auth-tab {
    background: #B10000;
    border: none;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    padding: 15px 30px;
    cursor: pointer;
    transition: all 1s ease;
    border-radius: 23px 23px 0 0;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.auth-tab[data-tab="login"] {
    width: 35%;
    margin-right: 0;
    text-align: start;
    padding: 20px 0 20px 47px;
}

.auth-tab[data-tab="register"] {
    width: 65%;
    margin-left: 0;
    text-align: end;
    padding-right: 60px;
}

.auth-tab.active {
    background: #E30613;
    z-index: 2;
}

.auth-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #E30613;
    transition: all 1s ease;
    z-index: 1;
}

.auth-tab::after {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #E30613;
    transition: all 1s ease;
    z-index: 1;
}

.auth-tab span {
    position: relative;
    z-index: 2;
}

.auth-tab.active::before {
    left: 0;
}

.auth-tab.active::after {
    right: 0;
}

.auth-tab:not(.active)::before {
    left: -100%;
}

.auth-tab:not(.active)::after {
    right: -100%;
}

.form-checkbox.login-only {
    display: none;
}

.auth-form[data-form="login"] .form-checkbox.login-only {
    display: flex;
}

.auth-form[data-form="login"] .form-checkbox.register-only {
    display: none;
}

.error-message {
    position: absolute;
    background: #FDE170;
    color: #442F1E;
    padding: 8px 11px;
    font-size: 14px;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    white-space: normal;
    display: none;
    box-sizing: border-box;
    z-index: 1000;
    -webkit-box-shadow: 0px 3px 9px 0px rgba(34, 60, 80, 0.18);
    -moz-box-shadow: 0px 3px 9px 0px rgba(34, 60, 80, 0.18);
    box-shadow: 0px 3px 9px 0px rgba(34, 60, 80, 0.18);
}

.error-message::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #FDE170;
}

.error-message.show {
    display: block;
}

.auth-modal-content.success {
    background: #CC0102;
    width: 70%;
    max-width: 400px;
    transform: translateY(-50%);
}

.success-content {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 0 20px;
    text-align: center;
}

.success-content.active {
    display: flex;
}

.success-sticker {
    position: absolute;
    top: -100px;
    width: 200px;
    height: auto;
    margin-bottom: 30px;
}

.success-title {
    color: #FFE26B;
    font-size: 36px;
    margin-bottom: 20px;
    font-weight: 600;
}

.success-description {
    color: #fff;
    font-size: 24px;
    margin-bottom: 30px;
    line-height: 1.4;
}

.success-button {
    background: linear-gradient(to right, #FFE680, #FAB041, #FFE680);
    border: none;
    width: 80%;
    border-radius: 16px;
    padding: 15px 30px;
    color: #442F1E;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.success-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.success-button::after {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.success-button:hover::before {
    left: 0;
}

.success-button:hover::after {
    right: 0;
}

.success-button span {
    position: relative;
    z-index: 2;
}

@media screen and (max-width: 768px) {
    .auth-modal-content.success {
        width: 90%;
        margin-top: 100px;
    }

    .success-sticker {
        width: 150px;
        top: -70px;
    }

    .success-title {
        font-size: 30px;
    }

    .success-description {
        font-size: 18px;
    }

    .success-button {
        font-size: 20px;
        padding: 12px 24px;
    }
}


.auth-modal-content.successAuth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #00000000;
}

.success-blocks {
    display: flex;
    flex-direction: row;
    gap: 5%;
    width: 100%;
    justify-content: center;
}

.user-info-block {
    background: #FFFFFF;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 25px;
    width: 60%;
}

.user-name {
    color: #CC0102;
    text-align: left;
    margin: 0;
    text-transform: uppercase;
    font-size: 4vh;
    font-weight: 900;
}

.user-email, .user-phone {
    color: #1D1D1B;
    text-align: left;
    margin-bottom: 10px;
    font-size: 2.6vh;
    font-weight: 600;
}

.user-phone {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-phone span {
    margin-bottom: 10px;
}

.user-phone img {
    cursor: pointer;
    margin-top: 10px;
}

.phone-icon {
    width: 32px;
    height: 24px;
}

.winner-block {
    position: relative;
    background: #CC0102;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #FFFFFF;
    border-radius: 25px;
    height: 31vh;
    min-width: 60%;
}

.winner-block h3 {
    text-align: left;
    margin: 0;
    text-transform: uppercase;
    font-size: 4vh;
    font-weight: 900;
}

.winner-message {
    display: flex;
    align-items: end;
    justify-content: space-between;
}

.winner-message p {
    font-size: 3.5vh;
    text-align: left;
    width: 75%;
    margin: 0;
}

.certificate-icon {
    width: 22%;
    height: auto;
}

@media (max-width: 768px) {
    .success-content {
        padding: 55px 20px 0 20px;
    }

    .auth-modal-content.success {
        transform: translateY(20%) !important;
    }

    .success-blocks {
        flex-direction: column;
        gap: 5%;
        width: 100%;
        top: 90%;
        position: absolute;
        gap: 10px;
    }

    .user-info-block {
        width: 91%;
        padding: 15px;
        gap: 70px;
    }

    .user-name {
        font-size: 2.8vh;
    }

    .user-email, .user-phone {
        font-size: 2vh;
    }

    .winner-block {
        width: 91%;
        padding: 15px;
        height: auto;
    }
    
    .winner-block h3 {
        width: 54%;
        font-size: 2.8vh;
    }
    
    .winner-message {
        flex-direction: column-reverse;
        gap: 30px;
    }

    .winner-message p {
        width: 100%;
        font-size: 2.7vh;
    }

    .certificate-icon {
        width: 30%;
        height: auto;
    }
}

.header.profile-active {
    z-index: 1000;
}

.auth-modal {
    z-index: 999;
}

.auth-modal-close {
    position: absolute;
    right: -60px;
    top: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000;
}

.auth-modal-close img {
    width: 40px;
    height: 40px;
}

.profile-modal-close {
    position: absolute;
    right: -12%;
    top: 5%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000;
}

.profile-modal-close img {
    width: 40px;
    height: 40px;
}

.profile-modal-close-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .auth-modal-close {
        right: -3%;
        top: -5%;
    }
}

@media screen and (max-width: 600px) {
    .auth-modal {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .auth-modal.active .auth-modal-content {
        transform: translateY(30%);
        margin-bottom: 120px;
    }
}

.profile-modal {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
}

.profile-modal.active {
    bottom: 0;
    opacity: 1;
    visibility: visible;
}

.profile-modal .auth-modal-content {
    transform: translateY(65%);
}

@media screen and (max-width: 768px) {
    .profile-modal .auth-modal-content {
        transform: translateY(90%);
    }
}

@media screen and (max-width: 600px) {
    .profile-modal .auth-modal-content {
        transform: translateY(30%);
        margin-bottom: 120px;
    }
}

.restore-password {
    display: block;
    /* margin: 10px auto; */
    text-align: center;
    width: 100%;
    color: #FFE26B;
    font-size: 1.3em;
    margin-left: 4px;
    font-weight: 200;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Circe Rounded', Arial, sans-serif;
    background: none;
    border: none;
    padding: 0;
    transition: opacity 0.3s ease;
}

.auth-form[data-form="register"] .restore-password.login-only {
    display: none;
}

.restore-modal-close {
    position: absolute;
    right: -10%;
    top: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000;
}

.restore-modal-close img {
    width: 40px;
    height: 40px;
}

.restore-password:hover {
    opacity: 0.8;
}

#restore-password-form.auth-form.active {
    gap: 30px;
}

.restore-modal .auth-modal-content {
    background: #E30613;
    width: 90%;
    max-width: 450px;
    padding: 30px 0;
    border-radius: 24px;
    position: relative;
    transform: translateY(300px);
    transition: transform 1s ease;
}

.restore-title {
    width: 80%;
    color: #fff;
    font-size: 2em;
    text-align: center;
    margin: 0px auto 30px auto;
    font-weight: 600;
}

.restore-success {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.restore-success.active {
    display: flex;
}

.restore-success p {
    width: 80%;
    color: #fff;
    font-size: 1.4em;
    margin-bottom: 30px;
    line-height: 1.4;
}

@media screen and (max-width: 768px) {
    .restore-modal .auth-modal-content {
        transform: translateY(90%);
    }
}

@media screen and (max-width: 600px) {
    .restore-modal .auth-modal-content {
        transform: translateY(45%);
        margin-bottom: 120px;
    }

    .restore-modal-close {
        position: absolute;
        right: -3%;
        top: -5%;
        transform: translateY(-50%);
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1000;
    }
    
    .restore-modal-close img {
        width: 40px;
        height: 40px;
    }
}