/* ========== 全局重置与变量 ========== */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --success: #10b981;
    --danger: #ef4444;
    --bg-dark: #0f0f23;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-input: rgba(30, 41, 59, 0.8);
    --border-color: rgba(99, 102, 241, 0.2);
    --border-focus: rgba(99, 102, 241, 0.6);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text-primary);
}

/* ========== 动态背景 ========== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -50px) rotate(1deg); }
    66% { transform: translate(-20px, 30px) rotate(-1deg); }
}

/* 浮动粒子 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(99, 102, 241, 0.5);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 15s; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-duration: 20s; animation-delay: 2s; width: 3px; height: 3px; }
.particle:nth-child(3) { left: 35%; animation-duration: 18s; animation-delay: 4s; }
.particle:nth-child(4) { left: 50%; animation-duration: 22s; animation-delay: 1s; width: 4px; height: 4px; }
.particle:nth-child(5) { left: 65%; animation-duration: 16s; animation-delay: 3s; }
.particle:nth-child(6) { left: 75%; animation-duration: 19s; animation-delay: 5s; width: 3px; height: 3px; }
.particle:nth-child(7) { left: 85%; animation-duration: 21s; animation-delay: 2s; }
.particle:nth-child(8) { left: 92%; animation-duration: 17s; animation-delay: 4s; width: 2px; height: 2px; }

@keyframes particleFloat {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* 网格线背景 */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ========== 主容器 ========== */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1100px;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ========== 弹性布局 ========== */
.auth-wrapper {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

/* ========== 内容区域（左右分栏） ========== */
.auth-content {
    display: flex;
    flex: 1;
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

.auth-panel {
    flex: 0 0 50%;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 0.3s;
    overflow-y: auto;
}

/* 左栏（注册） */
#registerPanel {
    order: 0;
}

/* 右栏（登录） */
#loginPanel {
    order: 1;
}

/* ========== 遮罩层 ========== */
.auth-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    z-index: 20;
    background: var(--gradient-2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 20px 20px 0;
    /* 默认覆盖左栏（注册），显示右栏（登录） */
    transform: translateX(0);
}

/* 当遮罩滑动到右侧时，覆盖登录面板 */
.auth-mask.slide-right {
    transform: translateX(100%);
    border-radius: 20px 0 0 20px;
}

.mask-content {
    text-align: center;
    color: white;
    padding: 20px;
    max-width: 80%;
}

.mask-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

.mask-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mask-subtitle {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.mask-slogan {
    font-size: 16px;
    font-weight: 300;
    opacity: 0.9;
    letter-spacing: 2px;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 16px;
    margin-top: 8px;
}

/* ========== 表单消息 ========== */
.auth-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
    animation: fadeSlideIn 0.3s ease;
}

.auth-message.show {
    display: flex;
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.auth-message.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.auth-message i {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 表单元素 ========== */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    transition: color 0.3s;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: rgba(30, 41, 59, 1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper input:focus + i.input-icon,
.input-wrapper input:focus ~ i.input-icon {
    color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 4px;
}

.toggle-password:hover {
    color: var(--text-secondary);
}

/* ========== 按钮 ========== */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--gradient-2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary .btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .spinner {
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 底部链接 ========== */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ========== 密码强度 ========== */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(100, 116, 139, 0.3);
    transition: background 0.3s;
}

.strength-bar.weak { background: #ef4444; }
.strength-bar.medium { background: #f59e0b; }
.strength-bar.strong { background: #10b981; }

.strength-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== 输入验证状态 ========== */
.input-wrapper input.input-error {
    border-color: rgba(239, 68, 68, 0.5);
}

.input-wrapper input.input-success {
    border-color: rgba(16, 185, 129, 0.5);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    display: none;
}

.field-hint.show {
    display: block;
}

.field-hint.error {
    color: #fca5a5;
}

/* ========== 法律信息区 ========== */
.legal-footer {
    text-align: center;
    padding: 20px 10px 10px;
    color: rgba(148, 163, 184, 0.6);
    font-size: 12px;
    letter-spacing: 0.5px;
    line-height: 1.6;
}

.legal-footer .divider {
    margin: 0 6px;
    opacity: 0.4;
}

/* ========== 响应式（移动端） ========== */
@media (max-width: 768px) {
    .auth-container {
        padding: 12px;
        min-height: 100vh;
        justify-content: flex-start;
        padding-top: 20px;
    }

    .auth-wrapper {
        min-height: auto;
        border-radius: 16px;
    }

    .auth-content {
        flex-direction: column;
        min-height: 600px;
    }

    .auth-panel {
        flex: 0 0 100%;
        padding: 24px 20px;
        min-height: 400px;
    }

    #registerPanel {
        order: 1; /* 注册面板在上 */
    }

    #loginPanel {
        order: 2; /* 登录面板在下 */
    }

    /* 遮罩层：覆盖上部（注册面板） */
    .auth-mask {
        width: 100%;
        height: 50%;
        top: 0;
        left: 0;
        border-radius: 0 0 20px 20px;
        transform: translateY(0);
        transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .auth-mask.slide-right {
        transform: translateY(100%);
        border-radius: 20px 20px 0 0;
    }

    .mask-title {
        font-size: 22px;
    }
    .mask-subtitle {
        font-size: 12px;
    }
    .mask-slogan {
        font-size: 14px;
    }
    .mask-logo {
        width: 60px;
        height: 60px;
    }

    .legal-footer {
        font-size: 10px;
        padding: 12px 6px;
    }
    .legal-footer .divider {
        margin: 0 4px;
    }
}