/**
 * 灵音托管引擎自动化工作台 - 数据大屏卡片组件样式 (comp-dashboard-card.css)
 * 阶段三：集群总览数据卡片 - 业务优化版
 * 功能：AG总集群、节点在线率、今日卡激活量、今日异常告警 + 操作按钮栏
 */

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

/* ============================================================
 * 统计卡片容器 - 毛玻璃 + 可点击
 * ============================================================ */
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

/* ============================================================
 * 卡片 Hover 发光效果 + 上浮 + 背景加深
 * ============================================================ */
.stat-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-4px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(59, 130, 246, 0.12),
    inset 0 1px 0 var(--bg-hover);
  background: var(--bg-card);
}

/* 点击反馈 */
.stat-card:active {
  transform: translateY(-1px);
  transition: transform 0.1s ease;
}

/* ============================================================
 * 玻璃拟态升级
 * ============================================================ */
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(0, 217, 255, 0.1);
  border-radius: var(--radius-md);
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 var(--border-color);
  transition: var(--transition);
}
.stat-card:hover {
  border-color: rgba(0, 217, 255, 0.35);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(0, 217, 255, 0.1),
    inset 0 1px 0 var(--border-color);
  transform: translateY(-4px);
  background: var(--bg-card);
}

/* ============================================================
 * 告警卡片特殊样式（今日异常告警有值时）
 * ============================================================ */
.stat-card.alert-active {
  border-color: rgba(239, 68, 68, 0.4);
  animation: alertPulse 2s ease-in-out infinite;
}
.stat-card.alert-active:hover {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(239, 68, 68, 0.15),
    inset 0 1px 0 var(--bg-hover);
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2), 0 0 8px rgba(239, 68, 68, 0.1); }
  50%      { box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2), 0 0 18px rgba(239, 68, 68, 0.2); }
}

/* ============================================================
 * 卡片图标样式
 * ============================================================ */
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

/* ============================================================
 * 卡片标签/标题样式
 * ============================================================ */
.stat-card .stat-label {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 4px;
}

/* ============================================================
 * 卡片数字样式
 * ============================================================ */
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* ============================================================
 * 统计变化指标样式
 * ============================================================ */
.stat-card .stat-change {
  font-size: 12px;
  margin-top: 6px;
}

/* ============================================================
 * 操作按钮栏样式
 * ============================================================ */
.dash-action-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dash-action-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
  background: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.12);
}
.dash-action-btn:active {
  transform: translateY(0);
}
.dash-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.dash-action-btn.accent {
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}
.dash-action-btn.accent:hover {
  border-color: var(--accent-blue);
  color: var(--accent-cyan);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}
.dash-action-btn.danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.08);
}
.dash-action-btn.danger:hover {
  border-color: var(--accent-red);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}
.dash-action-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

/* ============================================================
 * 数字滚动动画
 * ============================================================ */
.num-scroll {
  display: inline-block;
  animation: countUp 0.5s ease-out;
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
 * 实时数据脉冲动画
 * ============================================================ */
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.85; }
}
.live-data {
  animation: livePulse 2s ease-in-out infinite;
}

/* ============================================================
 * 移动端适配 (<= 768px)
 * ============================================================ */
@media (max-width: 768px) {
  .stat-card {
    padding: 14px;
  }
  .stat-card .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 15px;
    margin-bottom: 8px;
  }
  .stat-card .stat-label {
    font-size: 12px;
  }
  .stat-card .stat-value {
    font-size: 20px;
  }

  .stat-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .stat-card:hover {
    transform: none;
  }

  .stat-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .dash-action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .dash-action-btn .btn-text {
    display: none;
  }
}

/* ============================================================
 * 小手机适配 (<= 480px)
 * ============================================================ */
@media (max-width: 480px) {
  .stat-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-card .stat-value {
    font-size: 18px;
  }
  .dash-action-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}
