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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 60% 40%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    animation: particleFloat 25s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleFloat {
    0%, 100% { 
        transform: translate(0, 0) scale(1); 
        opacity: 0.6; 
    }
    25% {
        transform: translate(30px, -40px) scale(1.1);
        opacity: 0.8;
    }
    50% { 
        transform: translate(-20px, -80px) scale(0.9); 
        opacity: 0.7; 
    }
    75% {
        transform: translate(40px, -50px) scale(1.05);
        opacity: 0.85;
    }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 24px;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 28px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

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

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.logo-icon {
    font-size: 72px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 16px rgba(0, 122, 255, 0.4));
    animation: pulse 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 16px rgba(0, 122, 255, 0.4));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 8px 24px rgba(0, 122, 255, 0.6));
    }
}

.logo h1 {
    color: rgba(255, 255, 255, 0.95);
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.login-form {
    margin-top: 36px;
    position: relative;
    z-index: 1;
}

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

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus {
    outline: none;
    border-color: rgba(0, 122, 255, 0.6);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
    margin-top: 8px;
    letter-spacing: 0.2px;
}

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

.btn-primary:hover::before {
    width: 400px;
    height: 400px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.5);
}

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

.btn-primary.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.error-message {
    background: rgba(255, 59, 48, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid rgba(255, 59, 48, 0.4);
    animation: shake 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-12px); }
    75% { transform: translateX(12px); }
}

/* Success message */
.success-message {
    background: rgba(52, 199, 89, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid rgba(52, 199, 89, 0.4);
    font-weight: 500;
}

/* Telegram Auth */
.telegram-auth {
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.telegram-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.telegram-divider::before,
.telegram-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.telegram-divider span {
    padding: 0 16px;
}

.btn-telegram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 136, 204, 0.4);
    position: relative;
    overflow: hidden;
}

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

.btn-telegram:hover::before {
    width: 400px;
    height: 400px;
}

.btn-telegram:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 136, 204, 0.5);
}

.btn-telegram:active {
    transform: translateY(-1px);
}

.telegram-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.telegram-hint {
    margin-top: 12px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 480px) {
    .login-box {
        padding: 36px 24px;
        border-radius: 24px;
    }
    
    .logo-icon {
        font-size: 56px;
    }
    
    .logo h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .form-group input {
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .btn-primary {
        padding: 14px;
        font-size: 16px;
    }
    
    .btn-telegram {
        padding: 12px;
        font-size: 15px;
    }
    
    .telegram-hint {
        font-size: 12px;
    }
}
