/* 现代化量化因子挖掘平台样式 */
:root {
    /* 主色调 */
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #a3bffa;
    
    /* 辅助色调 */
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --error-color: #f56565;
    --info-color: #4299e1;
    
    /* 中性色调 */
    --gray-50: #f9fafb;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
    
    /* 渐变色 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* 字体 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* 通用容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 页面头部 */
.header {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.user-info button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.user-info button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    margin: 0 0 1.5rem 0;
    color: var(--gray-800);
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 1.75rem;
    background: var(--gradient-primary);
    border-radius: var(--radius);
}

/* 表单样式 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 44px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 任务列表样式 */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.task-item {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.task-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.task-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.task-item.hidden {
    opacity: 0.6;
    border-style: dashed;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.task-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.task-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* 状态标签 */
.status {
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status.pending {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(237, 137, 54, 0.2);
}

.status.running {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(66, 153, 225, 0.2);
    animation: pulse 2s infinite;
}

.status.completed {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(72, 187, 120, 0.2);
}

.status.failed {
    background: rgba(245, 101, 101, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(245, 101, 101, 0.2);
}

.status.stopped {
    background: rgba(160, 174, 192, 0.1);
    color: var(--gray-600);
    border: 1px solid rgba(160, 174, 192, 0.2);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 日志区域 */
.log-container {
    background: var(--gray-900);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.log-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-success);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.log-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: white;
}

#task-log {
    background: transparent;
    color: var(--gray-100);
    padding: 0;
    border-radius: 0;
    max-height: 500px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    border: none;
}

#task-log::-webkit-scrollbar {
    width: 8px;
}

#task-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
}

#task-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
}

#task-log::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 登录页面样式 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--gradient-primary);
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 450px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--gray-800);
    font-size: 2rem;
    font-weight: 700;
}

.login-card .form-group {
    margin-bottom: 1.5rem;
}

.login-card input {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.remember-me input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
}

.remember-me label {
    color: var(--gray-600);
    cursor: pointer;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
}

.error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(245, 101, 101, 0.2);
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

/* 个人中心样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-success);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--gray-600);
    font-weight: 500;
}

.result-area {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid var(--gray-200);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.toolbar-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* 资源监控区域 */
.resource-monitor {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(102, 126, 234, 0.2);
    font-size: 0.875rem;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-label {
    color: var(--gray-600);
    font-weight: 500;
}

.resource-value {
    font-weight: 700;
    color: var(--primary-color);
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    min-width: 2.5rem;
    text-align: center;
}

.resource-value.warning {
    color: var(--warning-color);
    background: rgba(237, 137, 54, 0.1);
}

.resource-value.danger {
    color: var(--error-color);
    background: rgba(245, 101, 101, 0.1);
}

/* 任务参数显示 */
.task-params-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.param-tag {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.param-tag strong {
    color: var(--primary-color);
}

/* 切换按钮 */
.toggle-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.toggle-btn:hover {
    background: var(--gray-200);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 可见性按钮 */
.visibility-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.visibility-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 关闭按钮 */
.shutdown-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
}

.shutdown-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.shutdown-btn:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .task-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }
    
    .resource-monitor {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .resource-item {
        justify-content: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .login-card {
        padding: 2rem;
        margin: 1rem;
    }
    
    .shutdown-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .task-item {
        padding: 1rem;
    }
    
    .login-card {
        padding: 1.5rem;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1a202c;
        --gray-100: #2d3748;
        --gray-200: #4a5568;
        --gray-300: #718096;
        --gray-400: #a0aec0;
        --gray-500: #cbd5e0;
        --gray-600: #e2e8f0;
        --gray-700: #edf2f7;
        --gray-800: #f7fafc;
        --gray-900: #f9fafb;
    }
    
    body {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
        color: var(--gray-800);
    }
}