/* Chart Header — legend, topbar (ticker, price, intervals, controls), info bar, OHLC overlay, toolbar positioning, timezone */

.chart-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.chart-legend-line {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.chart-legend-prefix {
  color: #eef2f7;
  font-weight: 700;
}

.chart-legend-time {
  color: #dbe3ee;
}

.chart-legend-token {
  color: #b8c1cd;
  white-space: nowrap;
}

.chart-legend-token strong {
  font-size: inherit;
  line-height: inherit;
  color: #eef2f7;
  font-weight: 600;
}

.chart-legend-token.emphasis strong {
  color: #ffffff;
}

.chart-legend-token.subtle strong {
  color: #d8e0ea;
}

.chart-wrap {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(320px, 1fr);
}

.chart-topbar {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  min-height: 36px;  /* RWD: was fixed height — allow wrap on narrow viewports */
  overflow: hidden;
}

.chart-topbar-pair {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  height: 100%;
  flex: 0 0 auto;
}

.chart-topbar-price {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  letter-spacing: -0.3px;
}

.chart-topbar-change {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
}

.chart-topbar-intervals {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.chart-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-height: 18px;
}

.chart-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

.chart-info-label {
  color: var(--text);
  font-weight: 500;
}

/* Batch 2: Engine-rendered chart-info-bar text classes */
.chart-info-pair      { color: var(--text);   font-size: 11px; font-weight: 500; line-height: 20px; }
.chart-info-ohlc      { color: var(--muted);  font-size: 11px; font-family: var(--mono); line-height: 20px; }
.chart-info-countdown { color: var(--red);    font-size: 11px; line-height: 20px; }
.chart-info-clock     { color: var(--text);   font-size: 11px; font-weight: 600; line-height: 20px; }
.chart-info-tz        { color: var(--muted);  font-size: 10px; line-height: 20px; }

.chart-ohlc-overlay {
  position: absolute;
  top: 6px;
  left: calc(var(--chart-dock-width) + 8px);
  z-index: 10;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.chart-ohlc-overlay-content {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-ohlc-overlay-content strong {
  font-weight: 600;
  font-size: inherit;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  min-height: 0;
  height: 0;
  border: none;
  position: relative;
  overflow: hidden;
  z-index: 12;
}

.chart-toolbar-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: visible;
  z-index: 13;
}

.chart-timezone-shell {
  position: relative;
  flex: 0 0 auto;
  z-index: 14;
}

.chart-timezone-btn {
  min-width: 80px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #eef2f7;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.chart-timezone-btn span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.chart-timezone-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  max-height: 320px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(19, 23, 32, 0.98);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  padding: 8px;
  z-index: 20;
  display: none;
}

.chart-timezone-menu.visible {
  display: block;
}

/* ─── Responsive (UI_STANDARD v2.0 Part 7) ─────────────────────────────
   Chart topbar: desktop fits all items in one row at 36px.
   < 1100px: hide secondary read-only labels (額度 / UTC timezone btn text);
              intervals row already overflow-x scrolls so it survives narrow.
   < 800px:  allow wrap to 2 rows (min-height auto); let item density relax. */

@media (max-width: 1099px) {
  /* Hide the amount/credit chip and timezone button text on narrow viewports.
     Essentials (pair / intervals / settings / interval-mode / R/R / 指標)
     remain. Users can still open the chart settings panel for these. */
  .chart-topbar .chart-credit-amount,
  .chart-topbar-right .chart-timezone-btn span:last-child {
    display: none;
  }
}

@media (max-width: 799px) {
  .chart-topbar {
    flex-wrap: wrap;
    min-height: 36px;
    height: auto;
  }
  .chart-topbar-right { margin-left: 0; }
}
