/* ==========================================================================
   CHARTS.CSS - Styles des graphiques et visualisations GrainBoard
   ========================================================================== */

/* --------------------------------------------------------------------------
   Chart Container
   -------------------------------------------------------------------------- */
.chart-container {
  margin: 20px 0;
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  height: 480px;
  min-height: 400px;
  position: relative;
}
.chart-container > canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.chart-container--compact {
  min-height: 300px;
}

.chart-container--large {
  min-height: 500px;
}

/* --------------------------------------------------------------------------
   Chart Title & Header
   -------------------------------------------------------------------------- */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: #e6eef8;
  margin: 0;
}

.chart-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin: 4px 0 0 0;
}

.chart-actions {
  display: flex;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   No Data State
   -------------------------------------------------------------------------- */
.no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--muted);
  font-size: 16px;
}

.no-data-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-data-text {
  text-align: center;
}

/* --------------------------------------------------------------------------
   Chart Loading State
   -------------------------------------------------------------------------- */
.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--muted);
}

.chart-loading::after {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 16px auto;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --------------------------------------------------------------------------
   Legend Styling
   -------------------------------------------------------------------------- */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #94a3b8;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Correlation Heatmap
   -------------------------------------------------------------------------- */
.correlation-legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.correlation-gradient {
  width: 300px;
  height: 20px;
  background: linear-gradient(to right, #3b82f6, #ffffff, #ef4444);
  border-radius: 4px;
}

.correlation-labels {
  display: flex;
  justify-content: space-between;
  width: 300px;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Candlestick Chart Specific
   -------------------------------------------------------------------------- */
.candlestick-info {
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.candlestick-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.candlestick-info-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.candlestick-info-value {
  font-size: 14px;
  font-weight: 600;
  color: #e6eef8;
}

/* --------------------------------------------------------------------------
   Chart Zoom Controls
   -------------------------------------------------------------------------- */
.chart-zoom-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.zoom-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e6eef8;
}

.zoom-btn.active {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.4);
}

/* --------------------------------------------------------------------------
   Chart Tooltip (custom)
   -------------------------------------------------------------------------- */
.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 32, 0.95);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chart-tooltip-title {
  font-weight: 600;
  color: #e6eef8;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
}

.chart-tooltip-label {
  color: #94a3b8;
}

.chart-tooltip-value {
  font-weight: 600;
  color: #e6eef8;
}

/* --------------------------------------------------------------------------
   Export Buttons (PNG/CSV)
   -------------------------------------------------------------------------- */
.export-btns {
  display: flex;
  gap: 8px;
}

.export-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.export-btn:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.3);
  color: #60a5fa;
}

.export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
