* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    min-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 100%;
    overflow-x: hidden;
    background: var(--auth-page-background, linear-gradient(195.99deg, #52A0FF 11.14%, #0068E8 91.56%));
}

.login-page {
    position: relative;
    width: 100%;
    min-width: 100%;
    min-height: 100vh;
    background: var(--auth-page-background, linear-gradient(195.99deg, #52A0FF 11.14%, #0068E8 91.56%));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    margin: 0;
}

/* Логотип */
.brand-header {
    position: absolute;
    top: 49px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 250px;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Контейнер формы — как на регистрации */
.login-form-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 100px auto 40px;
    padding: 0 20px;
    z-index: 10;
}

@media (min-width: 1400px) {
    .login-form-container {
        max-width: 560px;
    }
}

/* Карточка формы — единый стиль с регистрацией */
.login-form-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 40px 36px 36px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.login-card-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.25;
    color: #111827;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.login-card-subtitle {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #6B7280;
    margin: 0 0 28px 0;
    line-height: 1.4;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form[hidden] {
    display: none !important;
}

.forgot-step-indicator {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #0068E8;
    letter-spacing: 0.02em;
    margin: 0 0 10px 0;
}

.login-text-btn {
    width: 100%;
    margin-top: 0;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.login-text-btn:hover {
    color: #0068E8;
    text-decoration: underline;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form .form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.login-form-alert {
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: #991B1B;
    background: #FEF2F2;
    border: 1px solid #FECACA;
}

.login-form-alert[hidden] {
    display: none !important;
}

.login-form-success {
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: #065F46;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
}

.login-form-success[hidden] {
    display: none !important;
}

.login-secondary-btn {
    width: 100%;
    margin-top: 4px;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    color: #374151;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.login-secondary-btn:hover {
    background: #F9FAFB;
    border-color: #9CA3AF;
}

.login-field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.login-field-head .form-label {
    margin: 0;
}

.login-forgot-link {
    font-size: 13px;
    font-weight: 600;
    color: #0068E8;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 4px;
    margin: -6px -4px;
    -webkit-tap-highlight-color: rgba(82, 160, 255, 0.25);
}

.login-forgot-link:hover {
    text-decoration: underline;
    color: #0050b8;
}

.password-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 10px;
    border: 1px solid #D1D5DB;
    background: #F9FAFB;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.password-input-wrap:focus-within {
    border-color: #52A0FF;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(82, 160, 255, 0.15);
}

.password-input-wrap__input {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}

.password-input-wrap__input:focus {
    box-shadow: none !important;
}

.password-input-wrap:has(.password-input-wrap__input.error) {
    border-color: #EF4444;
    background: #FEF2F2;
}

.password-toggle-btn {
    flex-shrink: 0;
    padding: 0 14px;
    border: none;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #0068E8;
    cursor: pointer;
    align-self: stretch;
    border-left: 1px solid #E5E7EB;
    touch-action: manipulation;
}

.password-toggle-btn:hover {
    background: #f0f7ff;
}

.password-toggle-btn:focus-visible {
    outline: 2px solid #52A0FF;
    outline-offset: -2px;
    z-index: 1;
}

.login-form .form-input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    font-size: 15px;
    color: #111827;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.login-form .form-input::placeholder {
    color: #9CA3AF;
}

.login-form .form-input:focus {
    border-color: #52A0FF;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(82, 160, 255, 0.15);
}

.login-form .form-input:focus-visible {
    outline: none;
}

/* Кнопка входа — как на регистрации */
.login-button {
    width: 100%;
    height: 50px;
    background: #52A0FF;
    border: none;
    border-radius: 12px;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    margin-top: 8px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}

.login-button:hover {
    background: #3A8FE8;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(82, 160, 255, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-button:disabled:hover {
    background: #52A0FF;
    transform: none;
    box-shadow: none;
}

/* Ссылка на регистрацию */
.registration-link-container {
    margin-top: 20px;
    text-align: center;
    width: 100%;
}

.registration-link-text {
    font-size: 15px;
    color: #6B7280;
    margin: 0;
}

.registration-link {
    color: #52A0FF;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(82, 160, 255, 0.25);
}

.registration-link:hover {
    color: #3A8FE8;
    text-decoration: underline;
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .login-page {
        padding: 15px;
    }

    .login-card-title {
        font-size: 26px;
    }

    .brand-title {
        font-size: 20px;
    }

    .brand-subtitle {
        font-size: 12px;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    html {
        scroll-padding-bottom: 7rem;
    }

    .login-page {
        padding: 16px;
        padding-top: max(56px, calc(env(safe-area-inset-top, 0px) + 44px));
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .brand-header {
        top: max(12px, env(safe-area-inset-top, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        position: absolute;
        z-index: 10;
    }

    .logo-img {
        width: 160px;
        height: auto;
        max-width: min(160px, calc(100vw - 100px));
    }

    .login-form-container {
        max-width: 100%;
        width: 100%;
        margin-top: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .login-form-card {
        padding: 28px 24px 28px;
        border-radius: 16px;
    }

    .login-card-title {
        font-size: 24px;
    }

    .login-form {
        gap: 20px;
        width: 100%;
    }

    .login-form .form-group {
        gap: 10px;
        width: 100%;
    }

    .login-form .form-label {
        font-size: 16px;
        font-weight: 500;
    }

    .login-form .form-input {
        padding: 14px 16px;
        font-size: 16px;
        height: 52px;
        border-radius: 10px;
        border-color: #94a3b8;
    }

    .password-toggle-btn {
        min-width: 52px;
        padding: 0 16px;
        font-size: 14px;
        -webkit-tap-highlight-color: rgba(82, 160, 255, 0.25);
    }

    .login-field-head {
        align-items: center;
    }

    .login-form .password-input-wrap {
        border-color: #94a3b8;
    }

    .login-button {
        height: 52px;
        font-size: 16px;
        margin-top: 8px;
    }

    .registration-link-container {
        margin-top: 20px;
        padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
    }
}

/* Адаптивность для маленьких мобильных устройств */
@media (max-width: 480px) {
    .login-page {
        padding: 14px;
        padding-top: max(52px, calc(env(safe-area-inset-top, 0px) + 40px));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .brand-header {
        top: max(10px, env(safe-area-inset-top, 0px));
        right: max(10px, env(safe-area-inset-right, 0px));
        position: absolute;
    }

    .logo-img {
        width: 136px;
        max-width: calc(100vw - 88px);
    }

    .login-form-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .login-form-card {
        padding: 24px 20px 24px;
    }

    .login-card-title {
        font-size: 22px;
    }

    .login-form {
        gap: 20px;
    }

    .login-form .form-group {
        gap: 8px;
    }

    .login-form .form-label {
        font-size: 15px;
        font-weight: 500;
    }

    .login-form .form-input {
        padding: 14px 16px;
        font-size: 16px;
        height: 50px;
        border-color: #94a3b8;
    }

    .login-form .password-input-wrap {
        border-color: #94a3b8;
    }

    .login-button {
        height: 52px;
        font-size: 16px;
    }
}

/* Адаптивность для очень маленьких экранов */
@media (max-width: 360px) {
    .login-card-title {
        font-size: 20px;
    }

    .brand-title {
        font-size: 14px;
    }

    .brand-subtitle {
        font-size: 9px;
    }
}

/* Портретная ориентация для планшетов */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .login-form-container {
        max-width: 520px;
    }
}

/* Ландшафтная ориентация для мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .login-page {
        min-height: 100vh;
        min-height: 100dvh;
        padding-top: max(48px, env(safe-area-inset-top, 0px));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .brand-header {
        top: max(8px, env(safe-area-inset-top, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        position: absolute;
    }

    .logo-img {
        width: 120px;
        height: auto;
    }

    .login-form-container {
        flex: 0 1 auto;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .login-card-title {
        font-size: 22px;
    }

    .login-form {
        gap: 16px;
    }

    .login-form .form-input {
        height: 48px;
        padding: 12px 14px;
    }

    .login-button {
        height: 50px;
    }
}

