/* ============================================
   DataEase风格可视化大屏样式
   科技蓝主题 + 发光边框 + 动态效果
   ============================================ */

:root {
  /* 主色调 - DataEase科技蓝 */
  --primary: #1890ff;
  --primary-light: #40a9ff;
  --primary-dark: #096dd9;
  --primary-glow: rgba(24, 144, 255, 0.6);

  /* 辅助色 */
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #13c2c2;
  --purple: #722ed1;

  /* 背景 */
  --bg-main: #0f172a;
  --bg-card: rgba(24, 144, 255, 0.06);
  --bg-card-hover: rgba(24, 144, 255, 0.12);
  --bg-glow: rgba(24, 144, 255, 0.15);

  /* 边框 */
  --border-primary: rgba(24, 144, 255, 0.3);
  --border-glow: rgba(24, 144, 255, 0.5);
  --border-light: rgba(24, 144, 255, 0.15);

  /* 文字 */
  --text-title: #e6f7ff;
  --text-value: #ffffff;
  --text-label: #69c0ff;
  --text-muted: #91d5ff;
  --text-dim: rgba(145, 213, 255, 0.6);

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  --gradient-card: linear-gradient(180deg, rgba(24, 144, 255, 0.1) 0%, rgba(24, 144, 255, 0.02) 100%);
  --gradient-border: linear-gradient(90deg, transparent, var(--primary), transparent);

  /* 阴影 */
  --shadow-glow: 0 0 20px rgba(24, 144, 255, 0.3);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-main);
  font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-value);
}

/* 背景网格装饰 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(24, 144, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 144, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* 背景光晕 */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: var(--primary);
  top: -200px;
  left: -100px;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: var(--info);
  bottom: -150px;
  right: -100px;
}

/* ============================================
   顶部标题栏
   ============================================ */
.header-bar {
  position: relative;
  height: 70px;
  background: var(--gradient-card);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 100;
}

.header-bar::before,
.header-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 30%;
  height: 2px;
  background: var(--gradient-border);
}

.header-bar::before { left: 0; }
.header-bar::after { right: 0; }

.header-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-title .icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
}

.header-title h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--primary-glow);
}

.header-info {
  display: flex;
  align-items: center;
  gap: 30px;
}

.header-time {
  text-align: right;
}

.header-time .time {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-value);
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

.header-time .date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(82, 196, 26, 0.1);
  border: 1px solid rgba(82, 196, 26, 0.3);
  border-radius: 20px;
}

.header-status .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.header-status span {
  font-size: 13px;
  color: var(--success);
  font-weight: 500;
}

/* ============================================
   主容器布局 - 左中右三栏
   ============================================ */
.dashboard-container {
  position: relative;
  width: 100%;
  height: calc(100% - 70px);
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 15px;
  padding: 15px;
  z-index: 1;
}

/* ============================================
   卡片通用样式
   ============================================ */
.de-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.de-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

/* 卡片装饰角 */
.de-card::before,
.de-card::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid var(--primary);
  z-index: 10;
}

.de-card::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-radius: 8px 0 0 0;
}

.de-card::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 8px 0;
}

/* 卡片标题栏 */
.de-card-header {
  height: 40px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(24, 144, 255, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-light);
}

.de-card-header .icon {
  color: var(--primary-light);
  font-size: 16px;
}

.de-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-title);
  letter-spacing: 1px;
}

.de-card-header .badge {
  margin-left: auto;
  padding: 2px 8px;
  background: rgba(24, 144, 255, 0.2);
  color: var(--text-label);
  font-size: 10px;
  border-radius: 10px;
  animation: blink 3s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 卡片内容区 */
.de-card-body {
  padding: 15px;
  height: calc(100% - 40px);
  overflow: hidden;
}

/* ============================================
   KPI指标卡片
   ============================================ */
.kpi-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kpi-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 15px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.kpi-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
}

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

.kpi-label {
  font-size: 13px;
  color: var(--text-label);
  font-weight: 500;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  background: rgba(24, 144, 255, 0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 16px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-value);
  font-family: 'Courier New', monospace;
}

.kpi-unit {
  font-size: 14px;
  color: var(--text-muted);
}

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

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

.kpi-mini-chart {
  height: 30px;
  margin-top: 10px;
  opacity: 0.6;
}

/* ============================================
   排行榜样式
   ============================================ */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(24, 144, 255, 0.05);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.rank-item:hover {
  background: rgba(24, 144, 255, 0.1);
}

.rank-item .rank-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.rank-item.top-1 .rank-num {
  background: linear-gradient(135deg, #faad14, #d48806);
  color: #fff;
}

.rank-item.top-2 .rank-num {
  background: linear-gradient(135deg, #8c8c8c, #595959);
  color: #fff;
}

.rank-item.top-3 .rank-num {
  background: linear-gradient(135deg, #d48806, #b35f00);
  color: #fff;
}

.rank-item:not(.top-1):not(.top-2):not(.top-3) .rank-num {
  background: rgba(145, 213, 255, 0.2);
  color: var(--text-muted);
}

.rank-item .rank-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-value);
}

.rank-item .rank-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-light);
  font-family: 'Courier New', monospace;
}

.rank-item .rank-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.5s ease;
}

/* ============================================
   实时交易滚动
   ============================================ */
.trade-scroll-container {
  height: 100%;
  overflow: hidden;
  position: relative;
}

.trade-scroll-container::before,
.trade-scroll-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 30px;
  z-index: 5;
  pointer-events: none;
}

.trade-scroll-container::before {
  top: 0;
  background: linear-gradient(180deg, var(--bg-main), transparent);
}

.trade-scroll-container::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--bg-main), transparent);
}

.trade-scroll-list {
  animation: scrollUp 20s linear infinite;
}

@keyframes scrollUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.trade-scroll-list:hover {
  animation-play-state: paused;
}

.trade-item-scroll {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.trade-item-scroll .time {
  color: var(--text-dim);
  min-width: 55px;
}

.trade-item-scroll .merchant {
  flex: 1;
  color: var(--text-value);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-item-scroll .amount {
  color: var(--success);
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

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

/* ============================================
   大屏中间区域布局
   ============================================ */
.center-column {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.center-top {
  flex: 1.2;
}

.center-middle {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.center-bottom {
  flex: 0.8;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* ============================================
   数字滚动动画
   ============================================ */
.counting {
  display: inline-block;
}

/* ============================================
   热力图热点波纹
   ============================================ */
.hotspot {
  position: absolute;
  border-radius: 50%;
  animation: hotspotRipple 2s infinite;
}

@keyframes hotspotRipple {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ============================================
   数据刷新动画
   ============================================ */
.data-refresh {
  animation: dataFlash 0.5s ease;
}

@keyframes dataFlash {
  0% { opacity: 0.3; }
  50% { opacity: 1; filter: brightness(1.5); }
  100% { opacity: 1; }
}

/* ============================================
   商户端特有样式
   ============================================ */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(24, 144, 255, 0.5);
}

.heatmap-cell.level-0 { background: rgba(24, 144, 255, 0.1); }
.heatmap-cell.level-1 { background: rgba(24, 144, 255, 0.2); }
.heatmap-cell.level-2 { background: rgba(24, 144, 255, 0.35); }
.heatmap-cell.level-3 { background: rgba(24, 144, 255, 0.55); }
.heatmap-cell.level-4 { background: rgba(24, 144, 255, 0.75); }
.heatmap-cell.level-5 { background: rgba(24, 144, 255, 0.95); }

/* 进度条环形 */
.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
}

/* 预警列表 */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
}

.alert-item.warning {
  background: rgba(250, 173, 20, 0.1);
  border-left: 3px solid var(--warning);
}

.alert-item.danger {
  background: rgba(255, 77, 79, 0.1);
  border-left: 3px solid var(--danger);
}

.alert-item .alert-icon {
  font-size: 16px;
}

.alert-item .alert-content {
  flex: 1;
}

.alert-item .alert-content .name {
  color: var(--text-value);
  font-weight: 500;
}

.alert-item .alert-content .desc {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 1600px) {
  .dashboard-container {
    grid-template-columns: 250px 1fr 250px;
  }

  .kpi-value {
    font-size: 24px;
  }
}

@media (max-width: 1366px) {
  .dashboard-container {
    grid-template-columns: 220px 1fr 220px;
  }

  .header-title h1 {
    font-size: 20px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .center-bottom {
    grid-template-columns: 1fr 1fr;
  }
}
