/* 芯晶采智能资讯助理 - 公共样式 */
:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --primary-light: #e6f4ff;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1677ff;
  --bg: #f0f2f5;
  --sidebar-bg: #001529;
  --sidebar-width: 240px;
  --header-height: 56px;
  --text-primary: #262626;
  --text-secondary: #595959;
  --text-muted: #8c8c8c;
  --border: #d9d9d9;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
}

/* ===== 导航入口页 ===== */
.portal-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a2240 0%, #1677ff 60%, #36a3ff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.portal-logo {
  text-align: center;
  margin-bottom: 48px;
}

.portal-logo .brand {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}

.portal-logo .tagline {
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  margin-top: 8px;
}

.portal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1000px;
  width: 100%;
}

.portal-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.portal-card:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.portal-card .icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.portal-card .title {
  font-size: 16px;
  font-weight: 600;
}

.portal-card .desc {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.portal-card .badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* ===== 管理后台布局 ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .name {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.sidebar-logo .sub {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-group-title {
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  padding: 8px 16px 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  border-radius: 6px;
  margin: 2px 8px;
  font-size: 13px;
  transition: all 0.2s;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
}

.header-btn:hover { background: var(--bg); }

.header-btn .dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.page-body {
  padding: 24px;
  flex: 1;
}

/* ===== 统计卡片 ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #e6f4ff; }
.stat-icon.green { background: #f6ffed; }
.stat-icon.orange { background: #fff7e6; }
.stat-icon.red { background: #fff1f0; }
.stat-icon.purple { background: #f9f0ff; }

.stat-info .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-info .label {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.stat-info .trend {
  font-size: 12px;
  margin-top: 4px;
}

.trend-up { color: var(--danger); }
.trend-down { color: var(--success); }

/* ===== 卡片容器 ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #389e0d; border-color: #389e0d; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d48806; border-color: #d48806; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #cf1322; border-color: #cf1322; }

.btn-default { background: #fff; color: var(--text-primary); border-color: var(--border); }
.btn-default:hover { color: var(--primary); border-color: var(--primary); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 15px; }

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f7f7f7;
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

/* ===== 标签/状态 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-blue { background: #e6f4ff; color: #0958d9; }
.tag-green { background: #f6ffed; color: #389e0d; }
.tag-orange { background: #fff7e6; color: #d48806; }
.tag-red { background: #fff1f0; color: #cf1322; }
.tag-purple { background: #f9f0ff; color: #531dab; }
.tag-gray { background: #f5f5f5; color: #8c8c8c; }

/* ===== 表单元素 ===== */
.form-group {
  margin-bottom: 20px;
}

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

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.1);
}

.form-control::placeholder { color: #bfbfbf; }

select.form-control { cursor: pointer; }

textarea.form-control { min-height: 100px; resize: vertical; }

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input-wrap input {
  padding-left: 32px;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
}

.page-info { color: var(--text-muted); font-size: 13px; }

.page-btns {
  display: flex;
  gap: 6px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== 时间线 ===== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: #f0f0f0;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
  background: #fff;
}

.timeline-dot.blue { border-color: var(--primary); }
.timeline-dot.green { border-color: var(--success); }
.timeline-dot.orange { border-color: var(--warning); }
.timeline-dot.red { border-color: var(--danger); }

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  background: #fafafa;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ===== 预警条目 ===== */
.alert-item {
  border-left: 3px solid;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: var(--card-shadow);
}

.alert-item.high { border-color: var(--danger); background: #fff1f0; }
.alert-item.medium { border-color: var(--warning); background: #fff7e6; }
.alert-item.low { border-color: var(--info); background: var(--primary-light); }

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.alert-title {
  font-weight: 600;
  font-size: 14px;
}

.alert-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== 上传区域 ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

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

.upload-zone .icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone .hint { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

/* ===== 文章卡片（客户端） ===== */
.article-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.article-img {
  height: 160px;
  background: linear-gradient(135deg, #0a2240, #1677ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.article-body { padding: 16px; }

.article-tags { margin-bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.article-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.show .modal { transform: scale(1); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
}

.modal-close:hover { background: #f5f5f5; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== 步骤条 ===== */
.steps {
  display: flex;
  align-items: flex-start;
  margin-bottom: 32px;
}

.step-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: #f0f0f0;
}

.step-item.done:not(:last-child)::after,
.step-item.active:not(:last-child)::after {
  background: var(--primary);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #d9d9d9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: all 0.2s;
}

.step-item.done .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.step-item.active .step-circle {
  border-color: var(--primary);
  color: var(--primary);
}

.step-label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.step-item.active .step-label,
.step-item.done .step-label {
  color: var(--primary);
  font-weight: 500;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .portal-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 工具 ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary-color { color: var(--primary); }

/* 图表容器 */
.chart-container {
  position: relative;
  height: 260px;
}

/* 进度条 */
.progress {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* 切换开关 */
.switch {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #d9d9d9;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.switch.on { background: var(--primary); }

.switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch.on::after { left: 21px; }

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

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .text { font-size: 14px; }

/* 加载动画 */
.loading-dot {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dot span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotBounce 1.2s infinite;
}

.loading-dot span:nth-child(2) { animation-delay: 0.2s; }
.loading-dot span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* 通知气泡 */
.notify-bubble {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notify-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  font-size: 13px;
  pointer-events: all;
  animation: slideIn 0.3s ease;
}

.notify-item.success { border-color: var(--success); }
.notify-item.warning { border-color: var(--warning); }
.notify-item.error { border-color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
