/* ===== SPC CHART STYLES ===== */

.chart-container {
  position: relative;
  width: 100%;
  min-height: 300px;
}

.chart-container canvas {
  width: 100% !important;
}

/* Dual chart layout (X-bar + R, X-mR, X-bar + s) */
.chart-pair {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-pair .chart-container {
  min-height: 240px;
}

/* Chart legend */
.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-line {
  width: 24px;
  height: 2px;
  border-radius: 1px;
}

.chart-legend-line.dashed {
  background: repeating-linear-gradient(
    90deg,
    currentColor 0px,
    currentColor 6px,
    transparent 6px,
    transparent 10px
  );
  height: 2px;
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Drag and drop zone */
.drag-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drag-drop-zone:hover,
.drag-drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drag-drop-zone svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

.drag-drop-zone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.drag-drop-zone .browse-link {
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}

/* Data preview table wrapper */
.data-preview-wrapper {
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Example data buttons */
.example-datasets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Out-of-control indicator */
.ooc-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
}

.ooc-dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* Statistics summary grid */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.stat-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-item .stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.stat-item .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-item.danger .stat-value {
  color: var(--danger);
}

.stat-item.success .stat-value {
  color: var(--success);
}

.stat-item.warning .stat-value {
  color: var(--warning);
}

/* Capability gauge colors */
.cap-excellent { color: var(--success); }
.cap-good { color: var(--info); }
.cap-marginal { color: var(--warning); }
.cap-poor { color: var(--danger); }

/* Spec limit inputs row */
.spec-limits-row {
  display: flex;
  gap: 12px;
  align-items: end;
}

.spec-limits-row .form-group {
  flex: 1;
}

@media (max-width: 600px) {
  .chart-container {
    min-height: 220px;
  }

  .chart-pair .chart-container {
    min-height: 180px;
  }

  .stats-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}
