/* ============================================
   SECTION C: Historical Record / Timeline
   SECTION D: Projection Slider
   ============================================ */

/* Chart Container */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
}

.chart-container__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chart-container__title {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
}

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

/* Chart Legend */
.chart-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.chart-legend__color {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.chart-legend__color--solid {
  background: var(--red-debt);
}

.chart-legend__color--dashed {
  background: var(--red-debt);
  opacity: 0.5;
  background-image: repeating-linear-gradient(
    90deg,
    var(--red-debt) 0 4px,
    transparent 4px 8px
  );
  background-color: transparent;
  width: 20px;
}

/* Text Summary (Accessibility) */
.chart-summary {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  line-height: 1.6;
}

/* Metric Tabs */
.metric-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  padding: 3px;
  overflow-x: auto;
}

.metric-tabs__btn {
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.metric-tabs__btn:hover {
  color: var(--text-secondary);
}

.metric-tabs__btn.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Growth Rate Comparison */
.growth-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.growth-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.growth-bar__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.growth-bar__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.growth-bar__row:last-child {
  margin-bottom: 0;
}

.growth-comparison__intro {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.growth-comparison__intro strong {
  color: var(--text-secondary);
}

.growth-bar__type {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  width: 110px;
  flex-shrink: 0;
}

.growth-bar__track {
  flex: 1;
  height: 24px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.growth-bar__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
  position: relative;
}

.growth-bar__fill--actual {
  background: linear-gradient(90deg, var(--red-debt), #f87171);
}

.growth-bar__fill--projected {
  background: linear-gradient(90deg, var(--blue-accent), #60a5fa);
}

.growth-bar__fill--negative {
  background: linear-gradient(90deg, var(--green-revenue), #4ade80);
}

.growth-bar__value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ============================================
   SECTION D: Projection Slider
   ============================================ */

.projections {
  background: var(--bg-secondary);
}

.projection-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.projection-control {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.projection-control__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: block;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.toggle-switch__track {
  width: 44px;
  height: 24px;
  background: var(--border-accent);
  border-radius: 12px;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition-fast);
}

.toggle-switch input {
  display: none;
}

.toggle-switch input:checked + .toggle-switch__track {
  background: var(--red-debt);
}

.toggle-switch input:checked + .toggle-switch__track::after {
  transform: translateX(20px);
}

/* Range Slider */
.range-slider {
  width: 100%;
  margin-top: 0.5rem;
}

.range-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue-accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue-accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
}

.range-slider__value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.5rem;
  display: block;
}

.range-slider__bounds {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Projection Output Cards */
.projection-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.projection-output {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

.projection-output__label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.projection-output__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.projection-output__value--danger {
  color: var(--red-debt);
}

@media (max-width: 768px) {
  .projection-controls {
    grid-template-columns: 1fr;
  }

  .chart-canvas-wrapper {
    height: 280px;
  }
}

@media (max-width: 480px) {
  .chart-container {
    padding: 1rem;
  }

  .projection-outputs {
    grid-template-columns: 1fr 1fr;
  }
}
