/**
 * 认证页面样式
 * ===========================================
 * 登录、注册等认证相关页面的样式定义
 */

/* ============================================
   基础样式重置
   ============================================ */

.auth-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-family: var(--app-font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden; /* 禁止页面垂直滚动 */
}

/* ============================================
   加载覆盖层
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--color-bg-primary-rgb), 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-light);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* 亮色主题下的loading-spinner优化 */
[data-theme="light"] .loading-spinner {
    border: 3px solid rgba(108, 117, 125, 0.3);
    border-top: 3px solid var(--color-primary);
}

/* 暗色主题下的loading-spinner优化 */
[data-theme="dark"] .loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid var(--color-primary);
}

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

/* ============================================
   主容器
   ============================================ */

.auth-container {
    width: 100%;
    max-width: 400px;
    margin: 20px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   背景装饰
   ============================================ */

.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
}

.auth-pattern {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at 25% 25%, 
        rgba(var(--color-primary-rgb), 0.1) 0%, 
        transparent 50%
    ),
    radial-gradient(
        circle at 75% 75%, 
        rgba(var(--color-success-rgb), 0.1) 0%, 
        transparent 50%
    );
    animation: float 20s ease-in-out infinite;
}

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

/* 大屏幕装饰元素 */
.auth-decorations {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

@media (min-width: 1440px) {
    .auth-decorations {
        opacity: 1;
    }
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.08), transparent 70%);
    animation: decoration-float 15s ease-in-out infinite;
}

.decoration-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 15%;
    animation-delay: 0s;
}

.decoration-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 20%;
    background: radial-gradient(circle, rgba(var(--color-success-rgb), 0.06), transparent 70%);
    animation-delay: -5s;
}

.decoration-3 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 70%;
    background: radial-gradient(circle, rgba(var(--color-warning-rgb), 0.04), transparent 70%);
    animation-delay: -10s;
}

@keyframes decoration-float {
    0%, 100% { 
        transform: translateY(0px) translateX(0px) scale(1);
        opacity: 0.3;
    }
    33% { 
        transform: translateY(-30px) translateX(20px) scale(1.1);
        opacity: 0.5;
    }
    66% { 
        transform: translateY(20px) translateX(-15px) scale(0.9);
        opacity: 0.4;
    }
}

/* ============================================
   认证卡片
   ============================================ */

.auth-card {
    background: var(--color-bg-secondary);
    border-radius: 16px;
    padding: 16px 32px; /* 减少垂直内边距 */
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border-light);
    position: relative;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    overflow-y: auto;
    max-height: 90vh; /* 限制卡片最大高度 */
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: 16px 16px 0 0;
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 24px 48px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.08);
}

/* ============================================
   头部样式
   ============================================ */

.auth-header {
    margin-bottom: 16px; /* 减少下边距 */
}

.auth-header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 从左侧开始排列 */
}

.auth-logo {
    margin-bottom: 0;
    margin-right: 16px;
    position: relative;
    top: 8px;
}

.auth-title-group {
    display: flex;
    align-items: center;
}

.auth-logo svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.auth-title {
    font-size: 26px; /* 减小字号 */
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0 10px 0 0; /* 在右侧添加边距 */
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 12px; /* 进一步减小字号以适应布局 */
    color: var(--color-text-secondary);
    margin: 0;
    font-weight: var(--font-weight-normal);
    line-height: 1.4; /* 调整行高 */
}

/* ============================================
   表单样式
   ============================================ */

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

.form-group {
    margin-bottom: 16px; /* 减少下边距 */
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border-light);
    border-radius: 8px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: var(--app-font-family);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-group input::placeholder {
    color: var(--color-text-placeholder);
}

.form-help {
    display: block;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* ============================================
   复选框样式
   ============================================ */

.form-options {
    margin: 16px 0; /* 减少垂直边距 */
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border-light);
    border-radius: 4px;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ============================================
   按钮样式
   ============================================ */

.auth-btn {
    width: 100%;
    padding: 12px 24px; /* 减少垂直内边距 */
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    font-family: var(--app-font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px; /* 减少下边距 */
}

.auth-btn.primary {
    background: var(--color-primary);
    color: white;
}

.auth-btn.primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

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

.auth-btn.demo {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
}

.auth-btn.demo:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-medium);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 按钮加载状态 */
.spinner {
    animation: spin 1s linear infinite;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   分隔线
   ============================================ */

.auth-divider {
    position: relative;
    text-align: center;
    margin: 16px 0; /* 减少垂直边距 */
    color: var(--color-text-secondary);
    font-size: 14px;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-border-light);
    z-index: 1;
}

.auth-divider span {
    background: var(--color-bg-secondary);
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

/* ============================================
   快速登录
   ============================================ */

.quick-login {
    margin-bottom: 16px; /* 减少下边距 */
}

/* ============================================
   页脚链接
   ============================================ */

.auth-footer {
    text-align: center;
    font-size: 14px;
}

.auth-link {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.separator {
    margin: 0 8px;
    color: var(--color-text-secondary);
}

/* ============================================
   错误消息
   ============================================ */

.error-message {
    background: rgba(var(--color-danger-rgb), 0.1);
    color: var(--color-danger);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(var(--color-danger-rgb), 0.2);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message::before {
    content: '';
    font-size: 16px;
}

/* ============================================
   主题切换按钮
   ============================================ */

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border-light);
}

.theme-toggle:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    transform: rotate(180deg);
}

.theme-icon {
    transition: opacity 0.2s ease;
}

[data-theme="light"] .dark-icon,
[data-theme="dark"] .light-icon {
    display: none;
}

/* ============================================
   版权信息
   ============================================ */

.auth-copyright {
    text-align: center;
    padding-top: 16px; /* 减少上内边距 */
    margin-top: 24px; /* 减少上边距 */
    border-top: 1px solid var(--color-border-light);
}

.auth-copyright p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* ============================================
   粒子动画背景
   ============================================ */

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

/* ============================================
   响应式设计
   ============================================ */

/* 大屏幕优化 - 1920x1080 及以上 */
@media (min-width: 1440px) and (min-height: 900px) {
    .auth-body {
        background: 
            linear-gradient(135deg, 
                rgba(var(--color-primary-rgb), 0.05) 0%, 
                rgba(var(--color-success-rgb), 0.03) 50%,
                rgba(var(--color-primary-rgb), 0.02) 100%
            ),
            var(--color-bg-primary);
    }
    
    .auth-container {
        max-width: 480px;
        margin: 40px;
        transform: scale(1.1);
    }
    
    .auth-card {
        padding: 48px 40px;
        border-radius: 20px;
        box-shadow: 
            0 32px 64px rgba(0, 0, 0, 0.12),
            0 8px 24px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .auth-header {
        margin-bottom: 40px;
    }
    
    .auth-logo svg {
        width: 56px;
        height: 56px;
    }
    
    .auth-title {
        font-size: 32px;
        margin-bottom: 12px;
    }
    
    .auth-subtitle {
        font-size: 16px;
    }
    
    .form-group {
        margin-bottom: 24px;
    }
    
    .form-group input {
        padding: 14px 18px;
        font-size: 15px;
        border-radius: 10px;
    }
    
    .auth-btn {
        padding: 16px 28px;
        font-size: 17px;
        border-radius: 10px;
        margin-bottom: 16px;
    }
    
    .theme-toggle {
        top: 30px;
        right: 30px;
        width: 48px;
        height: 48px;
    }
    
    .auth-copyright {
        bottom: 30px;
    }
    
    .auth-copyright p {
        font-size: 14px;
    }
    
    /* 增强背景动画 */
    .auth-pattern {
        background: 
            radial-gradient(
                circle at 20% 30%, 
                rgba(var(--color-primary-rgb), 0.15) 0%, 
                transparent 60%
            ),
            radial-gradient(
                circle at 80% 70%, 
                rgba(var(--color-success-rgb), 0.12) 0%, 
                transparent 60%
            ),
            radial-gradient(
                circle at 50% 50%, 
                rgba(var(--color-warning-rgb), 0.05) 0%, 
                transparent 80%
            );
        animation: float 25s ease-in-out infinite;
    }
}

/* 1920x1080 专项优化 */
@media (min-width: 1900px) and (min-height: 1000px) {
    .auth-container {
        max-width: 520px;
        transform: scale(1.15);
        position: relative;
    }
    
    .auth-card {
        padding: 56px 48px;
        backdrop-filter: blur(20px);
        border: 2px solid rgba(255, 255, 255, 0.1);
        position: relative;
        overflow: visible;
    }
    
    /* 卡片光晕效果 */
    .auth-card::after {
        content: '';
        position: absolute;
        top: -3px;
        left: -3px;
        right: -3px;
        bottom: -3px;
        background: linear-gradient(45deg, 
            rgba(var(--color-primary-rgb), 0.15),
            rgba(var(--color-success-rgb), 0.1),
            rgba(var(--color-primary-rgb), 0.15)
        );
        border-radius: 23px;
        z-index: -1;
        filter: blur(6px);
        opacity: 0.8;
    }
    
    /* 卡片边框动画 */
    .auth-card::before {
        background: linear-gradient(90deg, 
            var(--color-primary), 
            var(--color-success), 
            var(--color-primary)
        );
        background-size: 200% 100%;
        animation: border-flow 3s ease-in-out infinite;
    }
    
    @keyframes border-flow {
        0%, 100% { background-position: 0% 0%; }
        50% { background-position: 100% 0%; }
    }
    
    .auth-logo svg {
        width: 64px;
        height: 64px;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    }
    
    .auth-title {
        font-size: 36px;
        background: linear-gradient(135deg, var(--color-primary), var(--color-success));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* 输入框增强效果 */
    .form-group input {
        background: rgba(var(--color-bg-primary-rgb), 0.8);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }
    
    .form-group input:focus {
        background: rgba(var(--color-bg-primary-rgb), 0.95);
        border-color: var(--color-primary);
        box-shadow: 
            0 0 0 3px rgba(var(--color-primary-rgb), 0.1),
            0 8px 25px rgba(var(--color-primary-rgb), 0.15);
        transform: translateY(-1px);
    }
    
    /* 按钮增强效果 */
    .auth-btn.primary {
        background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
        box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.3);
        transition: all 0.3s ease;
    }
    
    .auth-btn.primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 35px rgba(var(--color-primary-rgb), 0.4);
    }
    
    /* 微妙的卡片动画 */
    .auth-card {
        animation: subtle-float 8s ease-in-out infinite;
    }
    
    @keyframes subtle-float {
        0%, 100% { transform: translateY(0px); }
        50% { transform: translateY(-4px); }
    }
    
    /* 装饰元素在大屏幕上更明显 */
    .decoration-1 {
        width: 300px;
        height: 300px;
    }
    
    .decoration-2 {
        width: 220px;
        height: 220px;
    }
    
    .decoration-3 {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        margin: 10px;
        max-width: none;
        transform: none;
    }
    
    .auth-card {
        padding: 32px 24px;
    }
    
    .auth-title {
        font-size: 24px;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .auth-copyright {
        bottom: 10px;
    }
}



/* ============================================
   动画优化
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .auth-pattern {
        animation: none;
    }
}