/* ========================================
   ГЛОБАЛЬНЫЕ СТИЛИ И ПЕРЕМЕННЫЕ
   ======================================== */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #a78bfa;
    --dark-bg: #0f0f23;
    --card-bg: rgba(15, 15, 35, 0.85);
    --input-bg: rgba(30, 30, 60, 0.6);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(ellipse at bottom, #1a0f3e 0%, #0f0f23 50%, #000000 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

/* ========================================
   КОСМИЧЕСКИЙ ФОН И ЗВЕЗДЫ
   ======================================== */

.stars,
.stars2,
.stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Мерцающие маленькие звезды */
.stars {
    background: transparent;
}

.stars::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent),
        radial-gradient(2px 2px at 15% 90%, white, transparent);
    background-size: 200px 200px, 300px 300px, 250px 250px, 280px 280px, 220px 220px, 320px 320px, 180px 180px;
    background-position: 0 0, 40px 60px, 130px 270px, 70px 100px, 160px 20px, 90px 150px, 200px 80px;
    animation: twinkle 5s ease-in-out infinite;
}

/* Средние цветные звезды */
.stars2::before,
.stars2::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle, rgba(138, 92, 246, 0.8) 1px, transparent 2px),
        radial-gradient(circle, rgba(99, 102, 241, 0.7) 1px, transparent 2px),
        radial-gradient(circle, rgba(167, 139, 250, 0.6) 1px, transparent 2px);
    background-size: 300px 300px, 250px 250px, 350px 350px;
    background-position: 0 0, 150px 150px, 80px 200px;
    animation: twinkle 4s ease-in-out infinite reverse;
}

.stars2::after {
    animation-delay: 2s;
}

/* Большие яркие звезды */
.stars3::before,
.stars3::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle, rgba(255, 255, 255, 0.9) 1px, transparent 3px),
        radial-gradient(circle, rgba(138, 92, 246, 0.9) 1px, transparent 3px),
        radial-gradient(circle, rgba(99, 102, 241, 0.8) 1px, transparent 3px);
    background-size: 400px 400px, 350px 350px, 450px 450px;
    background-position: 0 0, 100px 100px, 250px 50px;
    animation: twinkle 6s ease-in-out infinite;
}

.stars3::after {
    animation-delay: 3s;
}

/* Анимация мерцания */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Летающие космические объекты */
.stars::after {
    content: '✦';
    position: absolute;
    font-size: 20px;
    color: rgba(167, 139, 250, 0.6);
    animation: float-object-1 20s linear infinite;
}

@keyframes float-object-1 {
    0% {
        transform: translate(-100px, -100px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translate(calc(100vw + 100px), calc(100vh + 100px)) rotate(360deg);
        opacity: 0;
    }
}

/* ========================================
   КОНТЕЙНЕР И КАРТОЧКИ
   ======================================== */

.container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(138, 92, 246, 0.2);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(138, 92, 246, 0.1);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(138, 92, 246, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

.register-card {
    max-width: 550px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ========================================
   ЛОГОТИП
   ======================================== */

.logo-section {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.logo-icon {
    font-size: 60px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(138, 92, 246, 0.5));
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 5px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 300;
}

/* ========================================
   ФОРМЫ
   ======================================== */

.form-title {
    font-size: 24px;
    margin-bottom: 25px;
    text-align: center;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"] {
    width: 100%;
    padding: 12px 45px 12px 15px;
    background: var(--input-bg);
    border: 1px solid rgba(138, 92, 246, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: rgba(30, 30, 60, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 38px;
    font-size: 18px;
    opacity: 0.5;
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 38px;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
    user-select: none;
}

.toggle-password:hover {
    opacity: 1;
}

.field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* ========================================
   КАПЧА
   ======================================== */

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

.captcha-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.captcha-img {
    flex: 1;
    height: 50px;
    border-radius: 8px;
    border: 1px solid rgba(138, 92, 246, 0.2);
    background: var(--input-bg);
}

.refresh-captcha {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(138, 92, 246, 0.2);
    background: var(--input-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-captcha:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    transform: rotate(90deg);
}

/* ========================================
   ТИП АККАУНТА
   ======================================== */

.account-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.account-type-btn {
    padding: 15px;
    background: var(--input-bg);
    border: 2px solid rgba(138, 92, 246, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.account-type-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.account-type-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(138, 92, 246, 0.2));
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.type-icon {
    font-size: 24px;
}

.type-text {
    font-size: 14px;
    font-weight: 500;
}

/* ========================================
   ЧЕКБОКС
   ======================================== */

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

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border: 2px solid rgba(138, 92, 246, 0.4);
    border-radius: 4px;
    background: var(--input-bg);
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.checkbox-text a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    word-break: break-word;
}

.checkbox-text a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ========================================
   ИНДИКАТОР СИЛЫ ПАРОЛЯ
   ======================================== */

.password-strength {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}

.password-strength::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: var(--error-color);
    transition: var(--transition);
}

.password-strength.weak::after {
    width: 33%;
    background: var(--error-color);
}

.password-strength.medium::after {
    width: 66%;
    background: #f59e0b;
}

.password-strength.strong::after {
    width: 100%;
    background: var(--success-color);
}

/* ========================================
   КНОПКИ
   ======================================== */

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

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

.btn-text,
.btn-icon {
    position: relative;
    z-index: 1;
}

/* ========================================
   СООБЩЕНИЯ ОБ ОШИБКАХ
   ======================================== */

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    animation: shake 0.5s;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ========================================
   ФУТЕР ФОРМЫ
   ======================================== */

.form-footer {
    text-align: center;
    margin-top: 25px;
    position: relative;
    z-index: 1;
}

.form-footer p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.link-primary {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.link-primary:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.link-secondary {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.link-secondary:hover {
    color: var(--primary-color);
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */

@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px;
    }
    
    .register-card {
        padding: 25px 15px;
    }
    
    .logo-icon {
        font-size: 50px;
    }
    
    .logo-text {
        font-size: 28px;
    }
    
    .form-title {
        font-size: 20px;
    }
    
    .account-type-selector {
        grid-template-columns: 1fr;
    }
    
    .checkbox-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .auth-card {
        padding: 25px 15px;
    }
    
    .register-card {
        padding: 20px 12px;
    }
    
    .logo-icon {
        font-size: 40px;
    }
    
    .logo-text {
        font-size: 24px;
    }
    
    .checkbox-text {
        font-size: 11px;
        line-height: 1.4;
    }
    
    .checkbox-custom {
        width: 18px;
        height: 18px;
    }
}

/* ========================================
   АНИМАЦИЯ ЗАГРУЗКИ
   ======================================== */

.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

