/* Enhanced Login Page Styles */

/* Основные переменные */
:root {
    --login-primary: #1e40af;
    --login-secondary: #764ba2;
    --login-accent: #f093fb;
    --login-gold: #fbbf24;
    --login-success: #10b981;
    --login-danger: #ef4444;
    --login-warning: #f59e0b;
    --login-info: #06b6d4;
    --login-light: #f8fafc;
    --login-dark: #1e293b;
    --login-gray: #64748b;
    --login-border: #e2e8f0;
    --login-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --login-radius: 24px;
    --login-radius-sm: 12px;
    --login-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Контейнер страницы входа */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    animation: none;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Анимированные пузыри */
.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.06) 0%, transparent 20%);
    animation: none;
    pointer-events: none;
}

/* Дополнительный слой с частицами */
.login-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="particles" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="30" cy="25" r="0.3" fill="rgba(255,255,255,0.08)"/><circle cx="45" cy="15" r="0.4" fill="rgba(255,255,255,0.06)"/><circle cx="20" cy="40" r="0.2" fill="rgba(255,255,255,0.05)"/><circle cx="35" cy="35" r="0.6" fill="rgba(255,255,255,0.04)"/></pattern></defs><rect width="100" height="100" fill="url(%23particles)"/></svg>');
    opacity: 0.4;
    animation: none;
    pointer-events: none;
}

/* Анимация градиента */
@keyframes gradientShift {
    0% { background-position: 0% 50%, 0% 0%, 0% 0%, 0% 50%; }
    25% { background-position: 100% 50%, 50% 50%, 25% 25%, 25% 75%; }
    50% { background-position: 50% 100%, 100% 100%, 50% 50%, 50% 50%; }
    75% { background-position: 0% 0%, 50% 0%, 75% 75%, 75% 25%; }
    100% { background-position: 0% 50%, 0% 0%, 0% 0%, 0% 50%; }
}

/* Анимация плавающих пузырей */
@keyframes floatingBubbles {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    33% { 
        transform: translateY(-30px) rotate(120deg);
        opacity: 0.9;
    }
    66% { 
        transform: translateY(-15px) rotate(240deg);
        opacity: 0.5;
    }
}

/* Анимация пузырей */
@keyframes bubbleFloat {
    0% { 
        transform: translateY(0px) scale(1);
        opacity: 0.6;
    }
    25% { 
        transform: translateY(-20px) scale(1.1);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-40px) scale(0.9);
        opacity: 0.4;
    }
    75% { 
        transform: translateY(-20px) scale(1.05);
        opacity: 0.7;
    }
    100% { 
        transform: translateY(0px) scale(1);
        opacity: 0.6;
    }
}

/* Анимация дрейфа частиц */
@keyframes particleDrift {
    0% { 
        transform: translateX(0px) translateY(0px);
        opacity: 0.4;
    }
    25% { 
        transform: translateX(10px) translateY(-10px);
        opacity: 0.6;
    }
    50% { 
        transform: translateX(-5px) translateY(-20px);
        opacity: 0.3;
    }
    75% { 
        transform: translateX(15px) translateY(-5px);
        opacity: 0.5;
    }
    100% { 
        transform: translateX(0px) translateY(0px);
        opacity: 0.4;
    }
}

/* Анимация пульсации цветов */
@keyframes colorPulse {
    0%, 100% { 
        filter: hue-rotate(0deg) saturate(1);
    }
    25% { 
        filter: hue-rotate(90deg) saturate(1.2);
    }
    50% { 
        filter: hue-rotate(180deg) saturate(0.8);
    }
    75% { 
        filter: hue-rotate(270deg) saturate(1.1);
    }
}

/* Карточка входа */
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--login-radius);
    box-shadow: 
        0 30px 60px -12px rgba(0, 0, 0, 0.3),
        0 15px 35px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(220, 38, 38, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    border: 1px solid rgba(220, 38, 38, 0.2);
    position: relative;
    z-index: 1;
    animation: slideInUp 0.8s ease-out;
    transition: all 0.3s ease;
}

/* Эффект свечения карточки */
.login-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(220, 38, 38, 0.4), 
        rgba(185, 28, 28, 0.4), 
        rgba(59, 130, 246, 0.4), 
        rgba(29, 78, 216, 0.4), 
        rgba(30, 64, 175, 0.4));
    border-radius: var(--login-radius);
    z-index: -1;
    animation: none;
    opacity: 0.6;
}

/* Анимация свечения карточки */
@keyframes cardGlow {
    0%, 100% { 
        opacity: 0.6;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Анимация появления */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Заголовок карточки */
.login-header {
    text-align: center;
    padding: 3rem 2rem 2rem 2rem;
    background: 
        linear-gradient(135deg, #dc2626 0%, #1e40af 100%);
    color: white;
    position: relative;
    overflow: hidden;
    border-radius: var(--login-radius) var(--login-radius) 0 0;
}

/* Анимированный фон заголовка */
.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    animation: none;
    pointer-events: none;
}

/* Дополнительный слой для заголовка */
.login-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, 
            rgba(255, 255, 255, 0.1) 0%, 
            transparent 25%, 
            rgba(255, 255, 255, 0.05) 50%, 
            transparent 75%, 
            rgba(255, 255, 255, 0.1) 100%);
    animation: none;
    pointer-events: none;
}

/* Анимация мерцания */
@keyframes shimmer {
    0%, 100% { 
        transform: translateX(-100%);
        opacity: 0;
    }
    50% { 
        transform: translateX(100%);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Логотип */
.login-header .logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Контейнер текста логотипа */
.logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* Основной текст логотипа */
.logo-main {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

/* Подзаголовок логотипа */
.logo-sub {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: -0.25rem;
}

.login-header .logo i {
    font-size: 3rem;
    color: #fbbf24;
    text-shadow: 
        0 0 20px rgba(220, 38, 38, 0.8),
        0 0 40px rgba(59, 130, 246, 0.4),
        0 0 60px rgba(220, 38, 38, 0.2);
    animation: none;
    filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
}

/* Анимация свечения логотипа */
@keyframes logoGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.5)) hue-rotate(0deg);
    }
    50% { 
        filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.8)) hue-rotate(180deg);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Заголовок */
.login-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    position: relative;
    z-index: 2;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.2);
    animation: textGlow 4s ease-in-out infinite;
}

/* Подзаголовок */
.login-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    animation: textFade 6s ease-in-out infinite;
}

/* Анимация свечения текста */
@keyframes textGlow {
    0%, 100% { 
        text-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(255, 255, 255, 0.2);
    }
    50% { 
        text-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(255, 255, 255, 0.4),
            0 0 40px rgba(255, 255, 255, 0.2);
    }
}

/* Анимация мерцания подзаголовка */
@keyframes textFade {
    0%, 100% { 
        opacity: 0.9;
    }
    50% { 
        opacity: 1;
    }
}

/* Эффект печатания */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--login-gold);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--login-gold); }
}

/* Форма входа */
.login-form {
    padding: 2.5rem;
}

/* Группы полей */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.form-group:nth-child(1) { animation-delay: 0.2s; }
.form-group:nth-child(2) { animation-delay: 0.4s; }
.form-group:nth-child(3) { animation-delay: 0.6s; }

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

/* Метки полей */
.form-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--login-dark);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    transition: var(--login-transition);
}

.form-label i {
    color: #dc2626;
    font-size: 1.1rem;
    transition: var(--login-transition);
}

/* Поля ввода */
.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--login-radius-sm);
    font-size: 1rem;
    transition: var(--login-transition);
    background: 
        linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    font-family: inherit;
    position: relative;
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.5);
}

.form-control:focus {
    outline: none;
    border-color: #dc2626;
    background: 
        linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 
        0 0 0 3px rgba(220, 38, 38, 0.15),
        0 0 25px rgba(220, 38, 38, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.form-control:hover {
    border-color: rgba(220, 38, 38, 0.5);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.05),
        0 0 15px rgba(220, 38, 38, 0.15);
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Состояния полей */
.form-group.focused .form-label {
    color: #dc2626;
    transform: translateY(-2px);
}

.form-group.focused .form-label i {
    color: #dc2626;
    transform: scale(1.1);
}

.form-group.has-value .form-label {
    color: var(--login-success);
}

.form-group.has-value .form-label i {
    color: var(--login-success);
}

/* Кнопка входа */
.btn-primary {
    background: 
        linear-gradient(135deg, 
            #dc2626 0%, 
            #b91c1c 50%, 
            #1e40af 100%);
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--login-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    color: white;
    transition: var(--login-transition);
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.8s forwards;
    box-shadow: 
        0 6px 20px rgba(220, 38, 38, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 30px rgba(220, 38, 38, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.15),
        0 0 30px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    filter: brightness(1.1);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Кнопка успеха */
.btn-success {
    background: linear-gradient(135deg, var(--login-success) 0%, #059669 100%);
}

.btn-success:hover {
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

/* Уведомления */
.alert {
    border-radius: var(--login-radius-sm);
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

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

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: var(--login-danger);
    border-left: 4px solid var(--login-danger);
}

/* Подвал */
.login-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--login-light) 0%, #f1f5f9 100%);
    border-top: 1px solid var(--login-border);
}

.login-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--login-gray);
    font-weight: 500;
}

/* Анимация тряски */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Адаптивность */
@media (max-width: 480px) {
    .login-container {
        padding: 1rem;
    }
    
    .login-card {
        max-width: 100%;
        border-radius: 16px;
    }
    
    .login-form {
        padding: 2rem 1.5rem;
    }
    
    .login-header {
        padding: 2rem 1.5rem 1.5rem 1.5rem;
    }
    
    .login-header .logo {
        font-size: 2rem;
    }
    
    .login-header .logo i {
        font-size: 2.5rem;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
}

/* Дополнительные эффекты */
.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.3);
}

/* Индикатор загрузки */
.loading {
    position: relative;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Улучшенная типографика */
.login-header h1,
.login-header p {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Плавные переходы для всех элементов */
* {
    transition: var(--login-transition);
}

/* Улучшенная доступность */
.form-control:focus,
.btn-primary:focus {
    outline: 2px solid var(--login-primary);
    outline-offset: 2px;
}

/* Темная тема (если поддерживается) */
@media (prefers-color-scheme: dark) {
    .login-card {
        background: rgba(30, 41, 59, 0.95);
        color: white;
    }
    
    .form-control {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .form-control:focus {
        background: #4b5563;
        border-color: #dc2626;
    }
    
    .form-label {
        color: #e5e7eb;
    }
}
