/* ========================================
   认证页面样式 - 现代极简设计
   ======================================== */

/* 页面基础 */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    /* 背景图片由内联样式设置，这里只做回退 */
    background: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* 现代感背景层 */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 主渐变 */
.bg-main {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    animation: bgRotate 20s linear infinite;
}

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

/* 网格 */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 70%);
}

/* 光晕 */
.bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.8; }
}

/* 浮动几何图形 */
.bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    opacity: 0.15;
    filter: blur(40px);
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph1 15s ease-in-out infinite;
}

.shape-2 {
    width: 250px;
    height: 250px;
    bottom: 20%;
    right: 15%;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph2 18s ease-in-out infinite;
}

.shape-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border-radius: 40% 60% 60% 40% / 70% 30% 70% 30%;
    animation: morph3 12s ease-in-out infinite;
}

@keyframes morph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: translate(0, 0) rotate(0deg); }
    50% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; transform: translate(20px, -20px) rotate(180deg); }
}

@keyframes morph2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: translate(0, 0) rotate(0deg); }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; transform: translate(-20px, 20px) rotate(-180deg); }
}

@keyframes morph3 {
    0%, 100% { border-radius: 40% 60% 60% 40% / 70% 30% 70% 30%; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    50% { border-radius: 60% 40% 40% 60% / 30% 70% 30% 70%; transform: translate(-50%, -50%) rotate(180deg) scale(1.1); }
}

/* ========================================
   登录卡片容器
   ======================================== */
.auth-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 900px;
    padding: var(--spacing-6) var(--spacing-4);
}

/* 登录卡片 */
.auth-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 
                0 0 0 1px rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
}

/* 卡片顶部装饰条 */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    background-size: 200% 100%;
    animation: cardShine 4s linear infinite;
}

@keyframes cardShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   头部
   ======================================== */
.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo {
    margin-bottom: 20px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.25);
    transition: transform 0.3s ease;
}

.auth-card:hover .logo-icon {
    transform: translateY(-2px);
}

.logo-icon svg {
    width: 32px;
    height: 32px;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    color: #64748b;
    font-size: 14px;
    font-weight: 400;
}

/* ========================================
   表单
   ======================================== */
.auth-form {
    margin-bottom: 24px;
}

/* 左右布局 */
.auth-form-layout {
    display: flex;
    gap: 0;
    align-items: stretch;
    position: relative;
    padding: 0 32px;
}

.auth-form-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 32px;
}

.auth-form-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    min-width: 140px;
    padding-left: 32px;
    position: relative;
}

/* 中间竖线分隔 - 位于右侧区域左边缘，高度50%且居中 */
.auth-form-right::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 50%;
    background: linear-gradient(to bottom, transparent, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4), transparent);
}

/* ========================================
   忘记密码页 - 左右布局
   ======================================== */
.forgot-form-layout {
    display: flex;
    gap: 0;
    align-items: center;
    position: relative;
    padding: 0 32px;
}

.forgot-form-left {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-right: 32px;
    max-width: 430px;
}

.forgot-form-left .input-wrapper {
    width: 100%;
}

.forgot-form-divider {
    width: 1px;
    height: 160px;
    background: linear-gradient(to bottom, transparent, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4), transparent);
    margin: 0 32px;
    flex-shrink: 0;
}

.forgot-form-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 16px;
    min-width: 70px;
    flex: 1;
}

.forgot-form-right .btn-login,
.forgot-form-right .btn-reset {
    width: 100%;
    height: 44px;
}

/* 右侧分隔线和社交登录 */
.auth-form-right .auth-divider {
    margin: 16px 0 12px;
}

.auth-form-right .social-login {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 0;
}

.auth-form-right .social-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.form-group {
    margin-bottom: 0;
}

/* 垂直布局表单组间距 */
.form-vertical .form-group {
    margin-bottom: 32px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    transition: all 0.25s ease;
}

.input-wrapper.focused {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.25s;
}

.input-wrapper.focused .input-icon {
    color: #6366f1;
}

.input-wrapper input {
    flex: 1;
    height: 48px;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #1e293b;
    outline: none;
    font-weight: 500;
}

.input-wrapper input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.toggle-password {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-password:hover {
    color: #6366f1;
    transform: scale(1.1);
}

.toggle-password.active {
    color: #6366f1;
}

/* 选项行 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-wrapper input {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-wrapper:hover .checkbox-custom {
    border-color: #6366f1;
}

.checkbox-wrapper input:checked + .checkbox-custom {
    background: #6366f1;
    border-color: #6366f1;
}

.checkbox-wrapper input:checked + .checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.forgot-link {
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
    color: #8b5cf6;
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.35);
}

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

.btn-login .btn-text {
    transition: opacity 0.3s;
    letter-spacing: 0.3px;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: none;
}

.btn-login.loading .btn-loader {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

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

/* 按钮光泽效果 */
.btn-login::after {
    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-login:hover::after {
    left: 100%;
}

/* 按钮横向排列 */
.auth-button-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.auth-button-row .btn-login {
    flex: 1;
    width: auto;
}

.auth-button-row .btn-reset {
    flex: 1;
    width: auto;
}

/* 重置按钮 */
.btn-reset {
    height: 44px;
    background: transparent;
    color: #6366f1;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reset:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

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

/* 验证码图片 */
.captcha-image {
    height: 44px;
    margin-left: 10px;
    border-radius: 8px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    cursor: pointer;
    transition: all 0.2s;
}

.captcha-image:hover {
    border-color: #6366f1;
    transform: scale(1.02);
}

/* ========================================
   分割线
   ======================================== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(226, 232, 240, 0.8);
}

.auth-divider span {
    padding: 0 16px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
}

/* ========================================
   社交登录
   ======================================== */
.social-login {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.social-btn {
    width: 48px;
    height: 48px;
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #64748b;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

.social-wechat:hover {
    background: #07c160;
    color: white;
    box-shadow: 0 8px 20px rgba(7, 193, 96, 0.25);
}

.social-qq:hover {
    background: #12b7f5;
    color: white;
    box-shadow: 0 8px 20px rgba(18, 183, 245, 0.25);
}

.social-weibo:hover {
    background: #e6162d;
    color: white;
    box-shadow: 0 8px 20px rgba(230, 22, 45, 0.25);
}

/* 右侧横向排列的社交按钮 */
.auth-form-right .social-login {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.auth-form-right .social-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

/* ========================================
   底部
   ======================================== */
.auth-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.auth-footer p {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

.register-link {
    color: #6366f1;
    font-weight: 700;
    text-decoration: none;
}

.register-link:hover {
    color: #8b5cf6;
    text-decoration: underline;
}

/* 版权 */
.auth-copyright {
    text-align: center;
    margin-top: 24px;
    color: #94a3b8;
    font-size: 12px;
}

/* ========================================
   警告框
   ======================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.alert svg {
    flex-shrink: 0;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 480px) {
    .auth-card {
        padding: 36px 24px;
        border-radius: 20px;
    }
    
    .auth-title {
        font-size: 22px;
    }
    
    .logo-icon {
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }
    
    .logo-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .input-wrapper,
    .btn-login,
    .social-btn {
        border-radius: 10px;
    }
    
    .social-login {
        gap: 12px;
    }
    
    .social-btn {
        width: 44px;
        height: 44px;
    }
    
    /* 移动端表单布局 */
    .auth-form-layout {
        flex-direction: column;
        gap: 16px;
        padding: 0;
    }
    
    .auth-form-right::before {
        display: none;
    }
    
    .auth-form-left {
        padding-right: 0;
    }
    
    .auth-form-right {
        padding-left: 0;
    }
    
    .auth-form-right {
        flex-direction: column;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: stretch;
        gap: 12px;
        padding-left: 0;
    }
    
    .btn-reset {
        width: 100%;
        flex: none;
    }
    
    .forgot-link {
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   深色主题适配
   ======================================== */
[data-theme="dark"] .auth-page {
    background: #0f172a;
}

[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .auth-card::before {
    background: linear-gradient(90deg, #8b5cf6, #6366f1, #ec4899);
    background-size: 200% 100%;
}

[data-theme="dark"] .auth-title {
    color: #f1f5f9;
}

[data-theme="dark"] .auth-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] .input-wrapper {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .input-wrapper.focused {
    background: rgba(30, 41, 59, 0.9);
    border-color: #6366f1;
}

[data-theme="dark"] .input-wrapper input {
    color: #f1f5f9;
}

[data-theme="dark"] .input-wrapper input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .input-icon {
    color: #64748b;
}

[data-theme="dark"] .toggle-password {
    color: #64748b;
}

[data-theme="dark"] .toggle-password:hover {
    color: #6366f1;
}

[data-theme="dark"] .checkbox-custom {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .checkbox-label {
    color: #94a3b8;
}

[data-theme="dark"] .forgot-link {
    color: #8b5cf6;
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-divider span {
    color: #64748b;
}

[data-theme="dark"] .social-btn {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

[data-theme="dark"] .btn-login {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
}

[data-theme="dark"] .btn-login:hover {
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.35);
}

[data-theme="dark"] .btn-reset {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(139, 92, 246, 0.3);
    color: #8b5cf6;
}

[data-theme="dark"] .btn-reset:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

[data-theme="dark"] .auth-form-right::before {
    background: linear-gradient(to bottom, transparent, rgba(139, 92, 246, 0.5), rgba(99, 102, 241, 0.5), transparent);
}

[data-theme="dark"] .captcha-image {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .captcha-image:hover {
    border-color: #6366f1;
}

[data-theme="dark"] .auth-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-footer p {
    color: #94a3b8;
}

[data-theme="dark"] .register-link {
    color: #8b5cf6;
}

[data-theme="dark"] .alert-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .alert-success {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="dark"] .auth-copyright {
    color: #64748b;
}

/* 忘记密码链接 */
.forgot-link-mobile {
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
}

.forgot-link-mobile a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.forgot-link-mobile a:hover {
    color: #8b5cf6;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .forgot-link-mobile {
        display: block;
    }
}