/* ==========================================================================
   AWS Lightsail Console - metrics.css
   Pure HTML/CSS Metrics Engine (Zero Chart.js Dependency)
   Spark-bars, Progress Bars, KPI Cards & Metric Time-Series Tables
   ========================================================================== */

/* ==========================================================================
   Metrics Grid & Container
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ==========================================================================
   KPI Summary Metric Card
   ========================================================================== */
.metric-kpi-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.metric-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-kpi-icon {
  font-size: 14px;
}

.metric-kpi-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

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

.metric-trend {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.metric-trend.trend-up {
  background-color: var(--danger-subtle);
  color: var(--danger);
}

.metric-trend.trend-down {
  background-color: var(--success-subtle);
  color: var(--success);
}

.metric-trend.trend-neutral {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.metric-kpi-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.metric-kpi-stat-item strong {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Pure CSS Spark-bars (Mini Historical Bar Chart)
   ========================================================================== */
.metric-spark-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 64px;
  padding: 4px 0 0 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.spark-bar {
  flex: 1;
  min-width: 4px;
  height: var(--val, 5%);
  background-color: var(--primary);
  border-radius: 2px 2px 0 0;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.spark-bar:hover {
  filter: brightness(1.25);
}

/* Tooltip on hover using pure CSS pseudo-element */
.spark-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.spark-bar:hover::after {
  opacity: 1;
}

.spark-bar.spark-warn {
  background-color: var(--warning);
}

.spark-bar.spark-danger {
  background-color: var(--danger);
}

.spark-bar.spark-success {
  background-color: var(--accent);
}

.spark-timeline {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Multi-Stage Gradient Progress Bars
   ========================================================================== */
.metric-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.progress-label {
  color: var(--text-secondary);
}

.progress-pct-text {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-fill.fill-accent {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.progress-fill.fill-warn {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.progress-fill.fill-danger {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

/* ==========================================================================
   Dual Throughput Bars (Network In / Network Out)
   ========================================================================== */
.throughput-dual-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}

.throughput-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.throughput-title {
  width: 60px;
  color: var(--text-muted);
  font-weight: 500;
}

.throughput-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.throughput-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.throughput-bar.bar-in {
  background: var(--accent);
}

.throughput-bar.bar-out {
  background: var(--primary);
}

.throughput-val {
  width: 75px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ==========================================================================
   Metric Time-Series Table
   ========================================================================== */
.metric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.metric-table thead th {
  background-color: var(--bg-elevated);
  padding: 8px 12px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.metric-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.metric-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.cell-inline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-bar-track {
  width: 60px;
  height: 5px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.inline-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--radius-full);
}
