/* ===== 全局重置与基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; color: #333; font-size: 14px; line-height: 1.6; }
a { color: #4f6ef7; text-decoration: none; }
a:hover { color: #3a56d4; }

/* ===== 登录页 ===== */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 48px 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-box h1 { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 8px; color: #1a1a2e; }
.login-box p.sub { text-align: center; color: #999; margin-bottom: 32px; font-size: 14px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; font-weight: 500; }
.login-box input[type="text"],
.login-box input[type="password"] { width: 100%; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 10px; font-size: 14px; transition: border-color 0.2s; outline: none; background: #fafafa; }
.login-box input:focus { border-color: #4f6ef7; background: #fff; }
.login-box .btn-login { width: 100%; padding: 13px; background: #4f6ef7; color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-box .btn-login:hover { background: #3a56d4; }
.login-box .msg { text-align: center; color: #e74c3c; font-size: 13px; margin-top: 12px; display: none; }

/* ===== 整体布局 ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar { width: 240px; background: #fff; border-right: 1px solid #eef0f5; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-logo { padding: 24px 20px; font-size: 18px; font-weight: 700; color: #1a1a2e; border-bottom: 1px solid #eef0f5; letter-spacing: 1px; }
.sidebar-logo span { color: #4f6ef7; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; padding: 12px 24px; color: #666; font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: #f5f7fa; color: #4f6ef7; }
.sidebar-nav a.active { background: #f0f3ff; color: #4f6ef7; border-left-color: #4f6ef7; font-weight: 600; }
.sidebar-nav a svg { width: 18px; height: 18px; margin-right: 12px; flex-shrink: 0; }
.sidebar-nav .nav-group { padding: 8px 24px 4px; font-size: 11px; color: #aaa; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.sidebar-bottom { padding: 16px 20px; border-top: 1px solid #eef0f5; }
.sidebar-bottom a { display: flex; align-items: center; color: #999; font-size: 13px; }
.sidebar-bottom a:hover { color: #e74c3c; }
.sidebar-bottom a svg { width: 16px; height: 16px; margin-right: 8px; }

/* ===== 主内容区 ===== */
.main-content { flex: 1; margin-left: 240px; }
.topbar { background: #fff; border-bottom: 1px solid #eef0f5; padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 50; }
.topbar h2 { font-size: 18px; font-weight: 600; color: #1a1a2e; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; color: #666; font-size: 13px; }
.topbar .user-avatar { width: 32px; height: 32px; background: #4f6ef7; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.content-body { padding: 24px 32px; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 12px; border: 1px solid #eef0f5; margin-bottom: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid #eef0f5; display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 15px; font-weight: 600; color: #1a1a2e; }
.card-body { padding: 24px; }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; border: 1px solid #eef0f5; padding: 24px; }
.stat-card .stat-label { font-size: 13px; color: #999; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1a1a2e; }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-card .stat-icon.blue { background: #eef2ff; color: #4f6ef7; }
.stat-card .stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-card .stat-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.stat-card .stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-card .stat-icon svg { width: 22px; height: 22px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { background: #f8f9fc; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #eef0f5; white-space: nowrap; }
table td { padding: 14px 16px; border-bottom: 1px solid #f0f0f5; font-size: 14px; color: #444; }
table tr:hover { background: #fafbfd; }
table tr:last-child td { border-bottom: none; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s; background: #fff; }
.form-input:focus { border-color: #4f6ef7; box-shadow: 0 0 0 3px rgba(79,110,247,0.1); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 100px; font-family: inherit; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: #4f6ef7; color: #fff; }
.btn-primary:hover { background: #3a56d4; color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-outline { background: #fff; color: #666; border: 1px solid #e0e0e0; }
.btn-outline:hover { border-color: #4f6ef7; color: #4f6ef7; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===== 标签 ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #eef2ff; color: #4f6ef7; }
.badge-green { background: #ecfdf5; color: #10b981; }
.badge-red { background: #fef2f2; color: #ef4444; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* ===== 上传区域 ===== */
.upload-area { border: 2px dashed #e0e0e0; border-radius: 12px; padding: 48px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fafbfd; }
.upload-area:hover { border-color: #4f6ef7; background: #f0f3ff; }
.upload-area.dragover { border-color: #4f6ef7; background: #f0f3ff; }
.upload-area svg { width: 48px; height: 48px; color: #ccc; margin-bottom: 16px; }
.upload-area p { color: #999; font-size: 14px; }
.upload-area p strong { color: #4f6ef7; }

/* ===== 查询区域 ===== */
.query-form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.query-form .full-width { grid-column: 1 / -1; }
.query-keywords { width: 100%; min-height: 120px; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; font-family: inherit; outline: none; resize: vertical; }
.query-keywords:focus { border-color: #4f6ef7; box-shadow: 0 0 0 3px rgba(79,110,247,0.1); }

/* ===== 查询结果统计 ===== */
.result-stats { display: flex; gap: 24px; margin-bottom: 20px; padding: 16px 20px; background: #f8f9fc; border-radius: 10px; }
.result-stats .stat-item { display: flex; align-items: center; gap: 8px; }
.result-stats .stat-item .num { font-size: 20px; font-weight: 700; }
.result-stats .stat-item .label { font-size: 13px; color: #888; }

/* ===== 弹窗 ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 480px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #eef0f5; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border: none; background: #f3f4f6; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #999; font-size: 18px; transition: all 0.2s; }
.modal-close:hover { background: #e5e7eb; color: #333; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #eef0f5; display: flex; justify-content: flex-end; gap: 12px; }

/* ===== 提示消息 ===== */
.toast { position: fixed; top: 24px; right: 24px; z-index: 2000; }
.toast-item { background: #fff; border-radius: 10px; padding: 14px 20px; margin-bottom: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); display: flex; align-items: center; gap: 10px; font-size: 14px; animation: slideIn 0.3s ease; min-width: 280px; }
.toast-item.success { border-left: 4px solid #10b981; }
.toast-item.error { border-left: 4px solid #ef4444; }
.toast-item.info { border-left: 4px solid #4f6ef7; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 加载动画 ===== */
.loading { display: inline-block; width: 18px; height: 18px; border: 2px solid #e0e0e0; border-top-color: #4f6ef7; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 20px; color: #999; }
.empty-state svg { width: 64px; height: 64px; color: #ddd; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 8px; font-size: 13px; border: 1px solid #e0e0e0; color: #666; text-decoration: none; }
.pagination a:hover { border-color: #4f6ef7; color: #4f6ef7; }
.pagination span.active { background: #4f6ef7; color: #fff; border-color: #4f6ef7; }
.pagination span.disabled { color: #ccc; cursor: not-allowed; }

/* ===== 复选框美化 ===== */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: 18px; height: 18px; accent-color: #4f6ef7; cursor: pointer; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .query-form { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .content-body { padding: 16px; }
}
