/* --- Глобальные стили и переменные --- */
:root {
    --primary-glow: #ca9ee6;
    --secondary-glow: #8839ef;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(-45deg, #0f2027, #24273a, #6e738d);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-primary);
    overflow: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Контейнер и анимация появления --- */
.login-form {
    max-width: 600px;
    background: var(--bg-glass);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
    padding: 45px 50px;
}

.form-content > * {
    animation: fadeIn 0.8s ease-out both;
}
/* Задержка для красивого последовательного появления */
.form-content h2 { animation-delay: 0.1s; }
.form-content .subtitle { animation-delay: 0.2s; }
.form-content .input-group:nth-of-type(1) { animation-delay: 0.3s; }
.form-content .input-group:nth-of-type(2) { animation-delay: 0.4s; }
.form-content .options { animation-delay: 0.5s; }
.form-content .btn-login { animation-delay: 0.6s; }
.form-content .separator { animation-delay: 0.7s; }
.form-content .social-login { animation-delay: 0.8s; }
.form-content .signup-link { animation-delay: 0.9s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Типографика --- */
h2 {
    font-weight: 600;
    font-size: 2.3rem;
    margin-bottom: 8px;
}

.subtitle {
    margin-bottom: 35px;
    color: var(--text-secondary);
    font-weight: 300;
}

/* --- Поля ввода --- */
.input-group {
    position: relative;
    margin-bottom: 25px;
}

.input-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: color 0.3s;
}

.input-group input {
    width: 100%;
    padding: 16px 50px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input::placeholder { color: var(--text-secondary); }

.input-group input:focus {
    border-color: var(--primary-glow);
    box-shadow: 0 0 15px -5px var(--primary-glow);
    background: rgba(0, 0, 0, 0.3);
}

.input-group input:focus ~ i { color: var(--primary-glow); }

.toggle-password {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
}

input[type="password"]::-ms-reveal {
    display: none;
}

/* --- Кастомный чекбокс --- */
.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
}

.remember-me input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.custom-checkbox::after {
    content: '\f00c'; /* Font Awesome check icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s ease-out;
}

.remember-me input:checked + .custom-checkbox {
    background: var(--secondary-glow);
    border-color: var(--primary-glow);
}

.remember-me input:checked + .custom-checkbox::after {
    transform: translate(-50%, -50%) scale(1);
}

.remember-me:hover .custom-checkbox {
    border-color: var(--primary-glow);
}

/* --- Ссылки --- */
.forgot-password, .signup-link a {
    color: var(--primary-glow);
    text-decoration: none;
    font-weight: 500;
    position: relative;
}

.forgot-password::after, .signup-link a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    background: var(--primary-glow);
    bottom: -2px;
    left: 0;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease-out;
}

.forgot-password:hover::after, .signup-link a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}


/* --- Кнопка Входа и анимация загрузки --- */
.btn-login {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, var(--secondary-glow), var(--primary-glow));
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    box-shadow: 0 0 20px -5px var(--primary-glow);
    transform: translateY(-3px);
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-login.loading::before {
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Разделитель и соц. иконки --- */
.separator {
    display: flex;
    align-items: center;
    margin: 35px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 300;
}
.separator::before, .separator::after {
    content: ''; flex: 1; border-bottom: 1px solid var(--border-color);
}
.separator span { padding: 0 1em; }

.social-login { display: flex; justify-content: center; gap: 20px; margin-bottom: 25px; }

.social-icon {
    width: 48px; height: 48px;
    display: flex; justify-content: center; align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.social-icon:hover {
    background: var(--primary-glow);
    border-color: var(--primary-glow);
    transform: translateY(-5px) scale(1.1);
}

.signup-link { font-weight: 300; color: var(--text-secondary); }

/* --- Адаптивность --- */
@media (max-width: 480px) {
    .login-form { width: 100%; padding: 35px 30px; }
    h2 { font-size: 2rem; }
}