/* ============================================================
   无限工作站 - 统一设计系统
   ============================================================
   设计规范:
   - 主色: #1a73e8 (Google Blue)
   - 暗色: #1e293b (Slate 800)
   - 背景: #f1f5f9 (Slate 100)
   - 卡片: #ffffff
   - 圆角: 12px 大 / 8px 中 / 6px 小
   ============================================================ */

/* === CSS 自定义属性 === */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --secondary: #64748b;
    --success: #0f973d;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0ea5e9;
    
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #1a73e8;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    
    --border-color: #e2e8f0;
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
    
    --sidebar-width: 130px;  /* 主导航宽度减半（原260px） */
    --sidebar-collapsed: 0px;
    --navbar-height: 56px;
    --transition: all 0.2s ease;
}

/* === 全局样式 === */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* === 顶部导航栏 === */
.navbar-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
}

.navbar-top .brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.navbar-top .brand-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 700;
}

.navbar-top .sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    display: none;
}

.navbar-top .sidebar-toggle:hover { background: var(--bg-body); }

.navbar-top .nav-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-top .user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.navbar-top .user-dropdown:hover { background: var(--bg-body); }

.navbar-top .user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.navbar-top .user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.navbar-top .user-badge { font-size: 0.7rem; }

/* === 侧边栏 === */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    z-index: 1020;
    overflow-y: auto;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }

.sidebar .nav-section {
    padding: 8px 10px 2px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin: 2px 4px;
    border-radius: var(--border-radius);
    color: var(--text-sidebar);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.sidebar .nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar .nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.sidebar .nav-item i, .sidebar .nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar .nav-spacer { flex: 1; }

.sidebar .sidebar-footer {
    padding: 8px 10px;
    border-top: 1px solid #334155;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === 主内容区 === */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
    transition: var(--transition);
}

/* === 面包屑 === */
.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breadcrumb-bar a { color: var(--text-secondary); }
.breadcrumb-bar a:hover { color: var(--primary); }
.breadcrumb-bar .separator { color: var(--text-muted); }
.breadcrumb-bar .current { color: var(--text-primary); font-weight: 500; }

/* === 页面标题 === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header .page-actions {
    display: flex;
    gap: 8px;
}

/* === 卡片 === */
.card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    transition: var(--transition);
}

.card-modern:hover { box-shadow: var(--shadow); }

.card-modern .card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-modern .card-header h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-modern .card-body { padding: 20px; }

.card-modern .card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: transparent;
}

/* === Dashboard网格布局（统计卡片5列） === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

/* === 统计卡片（Dashboard用） === */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.stat-card .stat-icon {
    width: 36px; height: 36px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: #e8f0fe; color: var(--primary); }
.stat-card .stat-icon.green { background: #e6f7e6; color: var(--success); }
.stat-card .stat-icon.amber { background: #fef3c7; color: var(--warning); }
.stat-card .stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-card .stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-card .stat-info { flex: 1; min-width: 0; }
.stat-card .stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* === 按钮 === */
.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-modern:active { transform: scale(0.97); }

.btn-modern.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-modern.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-modern.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-modern.secondary:hover { background: var(--bg-body); }

.btn-modern.success {
    background: var(--success);
    color: white;
}
.btn-modern.success:hover { background: #0b7e33; }

.btn-modern.danger {
    background: var(--danger);
    color: white;
}
.btn-modern.danger:hover { background: #b91c1c; }

.btn-modern.warning {
    background: var(--warning);
    color: white;
}
.btn-modern.warning:hover { background: #d97706; }

.btn-modern.info {
    background: var(--info);
    color: white;
}
.btn-modern.info:hover { background: #0284c7; }

.btn-modern.outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-modern.outline:hover { background: var(--bg-body); border-color: var(--text-secondary); }

.btn-modern.sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-modern.lg { padding: 10px 24px; font-size: 1rem; }
.btn-modern.block { width: 100%; justify-content: center; }
.btn-modern:disabled { opacity: 0.6; cursor: not-allowed; }

/* === 表单 === */
.form-modern .form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.form-modern .form-control, .form-modern .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--bg-card);
    width: 100%;
}

.form-modern .form-control:focus, .form-modern .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
    outline: none;
}

.form-modern .form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-modern .form-control:disabled {
    background: var(--bg-body);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* === 表格 === */
.table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-modern th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-body);
    white-space: nowrap;
}

.table-modern td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-modern tbody tr { transition: var(--transition); }
.table-modern tbody tr:hover { background: #f8fafc; }

.table-modern .text-center { text-align: center; }
.table-modern .actions { white-space: nowrap; text-align: right; }

/* === Alert 提示 === */
.alert-modern {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    border: none;
}

.alert-modern.error { background: #fee2e2; color: #991b1b; }
.alert-modern.success { background: #e6f7e6; color: #065f46; }
.alert-modern.warning { background: #fef3c7; color: #92400e; }
.alert-modern.info { background: #e8f0fe; color: #1e40af; }

/* === 标签/Badge === */
.badge-modern {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 4px;
}

.badge-modern.blue { background: #e8f0fe; color: var(--primary); }
.badge-modern.green { background: #e6f7e6; color: var(--success); }
.badge-modern.amber { background: #fef3c7; color: #92400e; }
.badge-modern.red { background: #fee2e2; color: #991b1b; }
.badge-modern.gray { background: #f1f5f9; color: var(--text-secondary); }

/* === 任务项（最近任务列表用）=== */
.task-item {
    border-bottom: 1px solid var(--border-color);
}
.task-item:last-child {
    border-bottom: none;
}

/* 任务状态图标 */
.task-icon-completed { background: #e6f7e6; color: var(--success); }
.task-icon-processing { background: #fef3c7; color: #92400e; }
.task-icon-failed { background: #fee2e2; color: #991b1b; }
.task-icon-pending { background: #e8f0fe; color: var(--primary); }

/* 任务名称 */
.task-name {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h5 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; margin-bottom: 16px; }

/* === 分页 === */
.pagination-modern {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 16px 0;
}

.pagination-modern .page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.pagination-modern .page-item:hover { background: var(--bg-body); }
.pagination-modern .page-item.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-modern .page-item.disabled { opacity: 0.4; cursor: not-allowed; }

/* === 进度条 === */
.progress-modern {
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
}

.progress-modern .progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-modern .progress-bar.striped {
    background-image: linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

/* 任务列表中的微型进度条 */
.progress-wrap {
    flex: 1; height: 6px; background: #e8e8e8;
    border-radius: 3px; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 3px; transition: width 1s;
    background: linear-gradient(90deg, #667eea, #764ba2);
}
.progress-pct-text {
    color: #666; font-weight: 600;
}

/* === Modal 模态框 === */
.modal-modern .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-modern .modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-modern .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-modern .modal-header h5 { margin: 0; font-size: 1rem; font-weight: 600; }

.modal-modern .modal-body { padding: 20px; }

.modal-modern .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === 登录/注册等公共页面布局 === */
.public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.public-page .auth-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.public-page .auth-header {
    padding: 32px 24px 16px;
    text-align: center;
}

.public-page .auth-header .auth-logo {
    width: 56px; height: 56px;
    background: var(--primary);
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.public-page .auth-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.public-page .auth-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.public-page .auth-body { padding: 8px 24px 24px; }

.public-page .auth-footer {
    padding: 16px 24px;
    background: var(--bg-body);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.public-page .auth-footer a { color: var(--primary); font-weight: 500; }

/* === 侧边栏遮罩（移动端） === */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1019;
    display: none;
}

/* === 文件上传区域 === */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-body);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone .upload-icon { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 8px; }
.upload-zone h6 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.upload-zone p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* === Dashboard 网格 === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px;
    margin-bottom: 20px;
}

/* === 响应式 === */
@media (max-width: 768px) {
    .navbar-top .sidebar-toggle { display: block; }
    .navbar-top .brand span { display: none; }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.open { display: block; }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 8px;
    }
    
    .page-header h2 { font-size: 1.2rem; }
    .table-modern { font-size: 0.8rem; }
    .table-modern th, .table-modern td { padding: 8px; }
}

@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .main-content { padding: 12px; }
}

/* === 工具类 === */
.flex-center { display: flex; align-items: center; gap: 8px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* 过渡动画 */
.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 标签页 */
.tabs-modern {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0;
    gap: 0;
}

.tabs-modern .tab-item {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tabs-modern .tab-item:hover { color: var(--text-primary); }
.tabs-modern .tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content-modern { padding: 20px 0; }

/* ===== 网站备案信息栏（全站统一底部） ===== */
/* 深色底条：登录页（深色渐变背景）与认证页（浅色背景）下均清晰可见 */
.beian-footer {
    background: #1e293b;   /* 与侧边栏/登录页背景同色系 */
    padding: 12px 16px;
    text-align: center;
    font-size: 0.8rem;
    color: #cbd5e1;
}
.beian-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.beian-footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid transparent;
}
.beian-footer a img.beian-icon {
    height: 40px;
    width: auto;   /* 宽度按比例自适应，避免强制 40×40 变形 */
    vertical-align: middle;
}
.beian-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.beian-footer a:hover img.beian-icon {
    opacity: 0.85;   /* 悬停时图标微亮，强化可点击感知 */
}
.beian-sep { color: #475569; }
