/* ==========================================================================
   CHART SYSTEM — MIND ID ENTERPRISE DASHBOARD
   ========================================================================== */

/* ── CHART CARD ────────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--surface-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-smooth),
              box-shadow var(--dur-fast) var(--ease-smooth);
}
.chart-card:hover { border-color: var(--surface-border-md); }

/* Hero chart variant */
.chart-card.hero {
  border-color: rgba(201,151,58,0.18);
  background: linear-gradient(180deg, rgba(201,151,58,0.04) 0%, var(--surface-elevated) 40%);
}
.chart-card.hero:hover { box-shadow: var(--glow-gold); border-color: rgba(201,151,58,0.3); }

.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: var(--space-4) var(--space-5) var(--space-3);
  flex-shrink: 0;
  gap: var(--space-3);
}
.chart-card-title-block { flex: 1; min-width: 0; }
.chart-card-title {
  font-size: var(--text-md); font-weight: var(--fw-semibold);
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-card-sub {
  font-size: var(--text-xs); color: var(--text-muted);
  margin-top: 1px; display: flex; align-items: center; gap: var(--space-2);
}

.chart-card-actions {
  display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0;
}

/* Chart area */
.chart-area {
  flex: 1; padding: 0 var(--space-4) var(--space-4);
  min-height: 0;
}
.chart-canvas {
  width: 100%; display: block;
}

/* Chart heights */
.chart-h-200  { height: 200px; }
.chart-h-240  { height: 240px; }
.chart-h-280  { height: 280px; }
.chart-h-320  { height: 320px; }
.chart-h-360  { height: 360px; }
.chart-h-400  { height: 400px; }
.chart-h-440  { height: 440px; }
.chart-h-500  { height: 500px; }

/* ECharts override */
.chart-instance { width: 100% !important; }

/* ── CHART SKELETON ─────────────────────────────────────────────────────────── */
.chart-skeleton-wrap { padding: var(--space-4); }
.chart-skeleton-bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 120px;
}
.chart-skeleton-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--surface-elevated) 25%, var(--surface-raised) 50%, var(--surface-elevated) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
}

/* ── CHART PERIOD TOGGLE ────────────────────────────────────────────────────── */
.chart-period-tabs {
  display: flex; gap: 2px;
  background: var(--surface-canvas);
  border-radius: var(--radius-md);
  padding: 2px;
}
.chart-period-tab {
  padding: 3px 10px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 11px; font-weight: var(--fw-medium);
  color: var(--text-muted); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
  white-space: nowrap;
}
.chart-period-tab.active {
  background: var(--surface-raised);
  color: var(--text-primary);
}
.chart-period-tab:hover:not(.active) { color: var(--text-secondary); }

/* ── LEGEND ─────────────────────────────────────────────────────────────────── */
.chart-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-4);
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-smooth);
}
.legend-item:hover { color: var(--text-primary); }
.legend-item.hidden { opacity: 0.4; text-decoration: line-through; }
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.legend-line {
  width: 16px; height: 2px; border-radius: 100px; flex-shrink: 0;
}

/* ── STAT ROW (inline under chart) ─────────────────────────────────────────── */
.chart-stats {
  display: flex; align-items: center; gap: var(--space-5);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--surface-border);
  background: var(--surface-raised);
}
.chart-stat-item { text-align: center; flex: 1; }
.chart-stat-value { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text-primary); }
.chart-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── MINI SPARKLINE ─────────────────────────────────────────────────────────── */
.sparkline-wrap {
  display: flex; align-items: flex-end; gap: 2px; height: 32px;
}
.sparkline-bar {
  flex: 1; border-radius: 1px;
  background: var(--surface-border-lg);
  min-height: 4px;
  transition: background var(--dur-fast);
}
.sparkline-bar:hover { background: var(--brand-gold); }

/* ── GAUGE NUMBER ────────────────────────────────────────────────────────────── */
.gauge-center-text { text-anchor: middle; }

/* ── HEAT CELL ───────────────────────────────────────────────────────────────── */
.heat-cell {
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--dur-fast);
}
.heat-cell:hover { opacity: 0.85; }
