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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-color);
}

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

a:hover {
  color: var(--primary-color-light);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ============================================
 * 工具类
 * ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.ml-8 { margin-left: 8px; }
.mr-8 { margin-right: 8px; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

.font-bold { font-weight: 600; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }

.color-primary { color: var(--primary-color); }
.color-success { color: var(--success-color); }
.color-warning { color: var(--warning-color); }
.color-danger { color: var(--danger-color); }
.color-info { color: var(--info-color); }

/* ============================================
 * 页面容器
 * ============================================ */
.page-container {
  padding: 20px;
  background: var(--bg-color);
  min-height: calc(100vh - var(--header-height));
}

.page-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

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

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

.page-card-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
}

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

/* 功能说明卡片 */
.help-card {
  background: linear-gradient(135deg, #ecf5ff 0%, #d9ecff 100%);
  border: 1px solid #b3d8ff;
  border-radius: var(--border-radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.help-card .help-icon {
  color: var(--primary-color);
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.help-card .help-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color-dark);
  margin-bottom: 4px;
}

.help-card .help-content {
  font-size: 13px;
  color: var(--text-regular);
  line-height: 1.6;
}

/* ============================================
 * 统计卡片
 * ============================================ */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.2;
}

.stat-card .stat-trend {
  font-size: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.stat-card .stat-bg-icon {
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 80px;
  opacity: 0.06;
  color: var(--primary-color);
}

/* ============================================
 * 表格工具栏
 * ============================================ */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color-lighter);
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================
 * Element Plus 覆写
 * ============================================ */
.el-button--primary {
  background: var(--primary-gradient);
  border-color: transparent;
}

.el-button--primary:hover {
  background: linear-gradient(135deg, #66b1ff 0%, #409EFF 100%);
}

.el-menu {
  border-right: none !important;
}

.el-sub-menu__title:hover,
.el-menu-item:hover {
  background: rgba(64, 158, 255, 0.08) !important;
}

.el-menu-item.is-active {
  background: var(--primary-color) !important;
  color: #fff !important;
  border-radius: 6px;
  margin: 2px 8px;
}

.el-menu-item {
  margin: 2px 8px;
  border-radius: 6px;
  height: 44px !important;
  line-height: 44px !important;
}

.el-sub-menu__title {
  height: 44px !important;
  line-height: 44px !important;
}

.el-table {
  border-radius: var(--border-radius-sm);
}

.el-table th {
  background: #fafafa !important;
  color: var(--text-regular) !important;
  font-weight: 600 !important;
}

.el-card {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: var(--shadow-sm);
}

.el-dialog {
  border-radius: var(--border-radius);
}

.el-tabs__item.is-active {
  color: var(--primary-color);
}

.el-tabs__active-bar {
  background-color: var(--primary-color);
}

/* ============================================
 * 登录页
 * ============================================ */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #409EFF 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  top: -200px;
  left: -200px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  bottom: -100px;
  right: -100px;
}

.login-container {
  width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 40px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  background: var(--primary-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
}

.login-logo .logo-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-logo .logo-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-form .el-input__wrapper {
  height: 44px;
}

.login-btn {
  height: 44px;
  font-size: 16px;
  font-weight: 500;
  width: 100%;
}

.login-footer {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================
 * 主布局
 * ============================================ */
.app-layout {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.layout-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
  transition: width 0.3s;
  flex-shrink: 0;
}

.layout-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color-light);
  background: #fff;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.layout-sidebar.collapsed .logo-text {
  display: none;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  background: var(--sidebar-bg);
}

.layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layout-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}

.layout-header .collapse-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-regular);
  font-size: 18px;
  transition: background 0.2s;
}

.layout-header .collapse-btn:hover {
  background: var(--border-color-lighter);
  color: var(--primary-color);
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-regular);
}

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-regular);
  font-size: 18px;
  transition: background 0.2s;
  position: relative;
}

.header-icon-btn:hover {
  background: var(--border-color-lighter);
  color: var(--primary-color);
}

.header-icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger-color);
  color: #fff;
  font-size: 11px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-info:hover {
  background: var(--border-color-lighter);
}

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

.user-name {
  font-size: 14px;
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout-content {
  flex: 1;
  overflow: auto;
  background: var(--bg-color);
}

/* ============================================
 * 详情信息行
 * ============================================ */
.detail-row {
  display: flex;
  margin-bottom: 12px;
  align-items: flex-start;
}

.detail-label {
  width: 100px;
  color: var(--text-secondary);
  font-size: 14px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 16px;
}

.detail-value {
  color: var(--text-primary);
  font-size: 14px;
  flex: 1;
  word-break: break-all;
}

/* ============================================
 * 图表容器
 * ============================================ */
.chart-container {
  width: 100%;
  height: 320px;
}

.chart-container.small {
  height: 240px;
}

.chart-container.large {
  height: 400px;
}
