/* Стили для страниц авторизации и регистрации */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body, 'DM Sans', 'Montserrat', 'Segoe UI', sans-serif);
    background:
        radial-gradient(ellipse 80% 60% at 30% 20%, rgba(168, 85, 247, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 75% 80%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        linear-gradient(160deg, #0b0d1a 0%, #12102a 45%, #1a1035 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: rgba(255, 255, 255, 0.97);
    border-radius: var(--radius-lg, 24px);
    box-shadow: 0 16px 48px rgba(15, 10, 40, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-aurora, linear-gradient(90deg, #6366f1, #a855f7, #ec4899));
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #333;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.auth-header p {
    color: #666;
    font-size: 1rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-input {
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:invalid {
    border-color: #e53e3e;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.auth-links {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

.auth-links p {
    color: #666;
    margin-bottom: 10px;
}

.auth-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.error-message {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #c53030;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #e53e3e;
    margin-bottom: 20px;
    font-weight: 500;
}

.success-message {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #276749;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #38a169;
    margin-bottom: 20px;
    font-weight: 500;
}

.home-link {
    display: inline-flex;
    align-items: center;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    margin-top: 15px;
    transition: color 0.3s ease;
}

.home-link:hover {
    color: #764ba2;
}

.home-link::before {
    content: '←';
    margin-right: 8px;
    font-weight: bold;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-container {
    animation: fadeIn 0.6s ease-out;
}

/* Адаптивность */
@media (max-width: 480px) {
    .auth-container {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .auth-header h1 {
        font-size: 1.7rem;
    }
}

/* Дополнительные стили для улучшения UX */
.form-input:disabled {
    background-color: #f7f7f7;
    cursor: not-allowed;
    opacity: 0.7;
}

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

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

.password-match {
    font-size: 0.85rem;
    margin-top: 5px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.password-match.success {
    color: #276749;
    background-color: #c6f6d5;
    border: 1px solid #9ae6b4;
}

.password-match.error {
    color: #c53030;
    background-color: #fed7d7;
    border: 1px solid #feb2b2;
}

.form-hint {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 4px;
    font-style: italic;
}

/* Стили для неактивной кнопки */
.submit-btn:disabled {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Анимация появления подсказок */
.password-match, .form-hint {
    animation: fadeIn 0.3s ease-out;
}

/* Дополнительные стили для улучшения UX */
.form-input:valid {
    border-color: #48bb78;
}

.form-input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #e53e3e;
}

/* Индикатор силы пароля */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.password-strength.weak {
    background: linear-gradient(90deg, #e53e3e, #fc8181);
    width: 33%;
}

.password-strength.medium {
    background: linear-gradient(90deg, #d69e2e, #ecc94b);
    width: 66%;
}

.password-strength.strong {
    background: linear-gradient(90deg, #38a169, #68d391);
    width: 100%;
}

/* Остальные стили формы */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #2d3748;
}

.auth-header p {
    color: #718096;
    font-size: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #4299e1;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background: #3182ce;
}

.submit-btn.loading {
    background: #a0aec0;
    cursor: not-allowed;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-link {
    color: #4299e1;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.home-link {
    display: block;
    margin-top: 10px;
    color: #718096;
    text-decoration: none;
}

.home-link:hover {
    color: #4a5568;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Добавьте эти стили в конец файла */

.instructions {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #4F46E5;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.password-requirements {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #4F46E5;
}

.password-requirements ul {
    margin: 5px 0;
    padding-left: 20px;
}

.password-strength {
    margin-top: 5px;
    font-size: 12px;
}

.strength-weak { color: #e53e3e; }
.strength-medium { color: #d69e2e; }
.strength-strong { color: #38a169; }

.back-to-login {
    text-align: center;
    margin-top: 20px;
}

/* TWA / WebView shell: avoid background image stretched on tall screens */
body.mobile-app-shell {
    align-items: flex-start;
    padding-top: max(20px, env(safe-area-inset-top, 0px));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    background-size: cover;
    background-position: center top;
    background-attachment: scroll;
}

body.mobile-app-shell .auth-container {
    margin-top: auto;
    margin-bottom: auto;
}