/* ===== 登录页面整体布局 ===== */
.login-page {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
}

/* ===== 背景 ===== */
.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 25%, #24243e 50%, #1a1a3e 75%, #0f0c29 100%);
    background-size: 400% 400%;
    animation: bgShift 20s ease infinite;
}

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

/* 背景几何装饰 */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: shapeFloat 15s ease-in-out infinite;
}

.bg-shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #4A90D9 0%, transparent 70%);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.bg-shape-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #764ba2 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

.bg-shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #f093fb 0%, transparent 70%);
    top: 50%;
    left: 60%;
    animation-delay: -10s;
}

.bg-shape-4 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #4facfe 0%, transparent 70%);
    top: 30%;
    left: 10%;
    animation-delay: -7s;
}

@keyframes shapeFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(10px, -10px) scale(1.02); }
}

/* 粒子装饰 */
.bg-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    color: rgba(255, 255, 255, 0.15);
    animation: particleFloat 8s ease-in-out infinite;
    font-size: 16px;
    user-select: none;
}

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

/* ===== 登录容器 ===== */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    animation: cardAppear 0.8s ease forwards;
}

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

/* ===== 登录卡片 (Glassmorphism) ===== */
.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 -1px 0 0 rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

/* 卡片顶部光条 */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4A90D9, #764ba2, transparent);
    opacity: 0.6;
}

/* ===== 头部 Logo & 标题 ===== */
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    animation: logoGlow 3s ease-in-out infinite;
}

.login-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 12px rgba(74, 144, 217, 0.4));
}

@keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(74, 144, 217, 0.3)); }
    50% { filter: drop-shadow(0 0 16px rgba(74, 144, 217, 0.6)); }
}

.login-title {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    font-weight: 700;
}

.title-gradient {
    background: linear-gradient(135deg, #4A90D9 0%, #a78bfa 50%, #4facfe 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s ease infinite;
}

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

.login-subtitle {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9em;
    margin: 0;
    letter-spacing: 1px;
}

/* ===== 表单样式 ===== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 输入框组 */
.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.input-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.input-group:hover .input-icon {
    background: rgba(74, 144, 217, 0.15);
    color: rgba(74, 144, 217, 0.7);
}

.input-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

.input-wrapper.focused .input-label {
    color: #4A90D9 !important;
    transform: translateY(-1px);
}

.input-wrapper.focused .input-icon {
    background: rgba(74, 144, 217, 0.2);
    color: #4A90D9;
}

.input-label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.95em;
    color: #ffffff;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.input-field:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.input-field:focus {
    border-color: #4A90D9;
    background: rgba(74, 144, 217, 0.1);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

/* 密码输入框 + 眼睛按钮 */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .input-field {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 1;
}

.toggle-password:hover {
    color: rgba(255, 255, 255, 0.6);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.eye-closed {
    display: none;
}

/* ===== 验证码区域 ===== */
.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-field-captcha {
    flex: 1;
}

.captcha-box {
    flex-shrink: 0;
    min-width: 140px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    user-select: none;
    padding: 0 12px;
}

.captcha-box:hover {
    border-color: rgba(74, 144, 217, 0.4);
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    transform: scale(1.02);
}

.captcha-box:active {
    transform: scale(0.98);
}

.captcha-box.refreshing {
    animation: captchaRefresh 0.3s ease;
}

@keyframes captchaRefresh {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

/* 验证码内部装饰线 */
.captcha-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: captchaShine 3s ease-in-out infinite;
}

@keyframes captchaShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

.captcha-question {
    font-size: 0.95em;
    font-weight: 700;
    font-family: 'Consolas', 'Courier New', monospace;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 8px rgba(74, 144, 217, 0.3);
}

.captcha-hint {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    margin-top: 6px;
}

/* ===== 错误提示 ===== */
.input-error {
    display: block;
    margin-top: 6px;
    color: #ff6b6b;
    font-size: 0.8em;
    font-weight: 500;
    animation: errorShake 0.4s ease;
}

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

/* ===== 底部区域 ===== */
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    margin-top: 4px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85em;
    user-select: none;
    transition: color 0.2s;
}

.remember-label:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* 自定义复选框 */
.remember-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.remember-label input[type="checkbox"]:checked + .checkmark {
    background: #4A90D9;
    border-color: #4A90D9;
}

.remember-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-left: 0;
    border-top: 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.register-link {
    color: rgba(74, 144, 217, 0.7);
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s;
}

.register-link:hover {
    color: #4A90D9;
    text-decoration: underline;
}

/* ===== 登录/注册按钮 ===== */
.btn-login {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    letter-spacing: 6px;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    box-shadow:
        0 4px 24px rgba(102, 126, 234, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 -2px 4px rgba(0, 0, 0, 0.1) inset;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 36px rgba(102, 126, 234, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 -2px 4px rgba(0, 0, 0, 0.1) inset;
    animation-play-state: paused;
}

.btn-login:active {
    transform: translateY(-1px);
    box-shadow:
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 -2px 4px rgba(0, 0, 0, 0.1) inset;
}

.btn-login:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    animation-play-state: paused;
}

/* 按钮文字 */
.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-text::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") no-repeat center / contain;
    opacity: 0.8;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.btn-login:hover .btn-text::after {
    transform: translateX(4px);
    opacity: 1;
}

/* 按钮顶部光条 */
.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transition: left 0.6s ease;
}

.btn-login:hover::before {
    left: 150%;
}

/* 按钮底部发光边框 */
.btn-login::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.3s ease;
}

.btn-login:hover::after {
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

/* ===== 加载动画 ===== */

.btn-loading {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* ===== 底部装饰线 ===== */
.login-deco {
    margin-top: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* ===== Flash 消息在暗色背景下的适配 ===== */
.login-page ~ .toast-error {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.95) 0%, rgba(231, 76, 60, 0.95) 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
}

.login-page ~ .toast-success {
    background: linear-gradient(135deg, rgba(30, 132, 73, 0.95) 0%, rgba(39, 174, 96, 0.95) 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px;
        border-radius: 20px;
    }

    .login-logo {
        width: 56px;
        height: 56px;
    }

    .login-title {
        font-size: 1.5em;
    }

    .login-subtitle {
        font-size: 0.82em;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-icon {
        width: 100%;
        height: 36px;
        border-radius: 8px 8px 0 0;
        margin-top: 0;
    }

    .captcha-row {
        flex-direction: column;
    }

    .captcha-box {
        width: 100%;
        min-width: unset;
        height: 48px;
    }

    .form-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .bg-shape {
        filter: blur(60px);
        opacity: 0.2;
    }

    .bg-shape-1 {
        width: 300px;
        height: 300px;
    }

    .bg-shape-2 {
        width: 250px;
        height: 250px;
    }
}

/* ===== 确保旧版 auth-card 样式不影响登录页 ===== */
.login-page .auth-container,
.login-page .auth-card {
    display: none !important;
}
