/* Atlas Chart — Panel styling, loading/error states */

.chart-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.chart-panel-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 8px;
  font-weight: 400;
}

.chart-panel-actions {
  display: flex;
  gap: 6px;
}

.chart-panel-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 12px;
  transition: all var(--transition-fast);
}

.chart-panel-btn:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-color: var(--color-text-muted);
}

.chart-panel-body {
  position: relative;
  height: 320px;
}

/* Loading state */
.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 2;
}

.chart-loading .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: chart-spin 0.7s linear infinite;
}

.chart-loading-text {
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
}

@keyframes chart-spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.chart-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 2;
}

.chart-error-icon {
  width: 32px;
  height: 32px;
  color: var(--color-error);
  margin-bottom: 8px;
}

.chart-error-text {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 240px;
}

.chart-error .btn-retry {
  margin-top: 12px;
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
  color: var(--color-text-secondary);
}

.chart-error .btn-retry:hover {
  background: var(--color-bg-secondary);
}

/* Empty state */
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Legend (custom, below chart) */
.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

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

.chart-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.chart-legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

/* Chart expand modal (injected by AtlasChart.initChartModal) */
.chart-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, background 0.2s ease, visibility 0.2s;
}
.chart-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.6);
}
.chart-modal-overlay.hidden { display: none; }
.chart-modal-overlay .chart-modal {
  position: relative;
  inset: auto;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.2s ease;
}
.chart-modal-overlay.visible .chart-modal {
  transform: translateY(0) scale(1);
}
.chart-modal-overlay .chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.chart-modal-overlay .chart-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.chart-modal-overlay .chart-modal-body {
  padding: 20px;
  height: 500px;
  position: relative;
}
