/* timing-chart.css — Lightweight Charts overlay on /stock/{symbol}.

   ONE FILE, ONE FEATURE, like tv-presets.css. Removing this link and
   timing-chart.js reverts Plus/Pro to the TradingView embed (the Free
   fallback) without touching app.js.

   The overlay host must not invent a width the table cannot afford:
   same inline-size containment idea as .detail. Height matches the
   TV widget on desktop and the existing .chart-wrap phone rule so a
   timing chart never fills the whole mobile viewport.
*/

.q-chip-timing {
  color: var(--gold, #d4b95a);
  border-color: var(--gold-dim, #8a7433);
  background: rgba(212, 185, 90, 0.08);
  margin-left: 0.55rem;
  vertical-align: middle;
}

.panel h3 .q-chip-timing {
  letter-spacing: 0.08em;
  text-transform: none;
  font-weight: 500;
}

.timing-chart-host {
  width: 100%;
  min-width: 0;
  min-height: 420px;
  height: 420px;
  background: #0a0a09;
  border: 1px solid var(--border, #2a2924);
  border-radius: 2px;
}

/* Classic view stacks volume and a MACD band under the candles.
   The extra height is the pane; Key levels only stays at 420.
   Price only keeps volume on the main pane, so it grows a little
   for those bars and stays shorter than the MACD pane. */
.timing-chart-host.is-classic {
  min-height: 560px;
  height: 560px;
}

.timing-chart-host.is-price {
  min-height: 460px;
  height: 460px;
}

.timing-chart {
  width: 100%;
  height: 100%;
  min-height: 240px;
}

.timing-chart-host.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.timing-chart-host .timing-chart-fallback {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--muted, #8a8678);
  padding: 1rem;
}

@media (max-width: 640px) {
  .timing-chart-host {
    min-height: 240px;
    height: 240px;
  }
  .timing-chart-host.is-classic {
    min-height: 400px;
    height: 400px;
  }
  .timing-chart-host.is-price {
    min-height: 300px;
    height: 300px;
  }
  /* Three chips wrap onto a second row instead of widening the page. */
  .chart-view-bar {
    width: 100%;
    max-width: 100%;
  }
}

.q-chip-liq {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.q-chip-liq-liquid { color: #7c9c7a; border-color: #7c9c7a; }
.q-chip-liq-thin { color: #d4b95a; border-color: #8a7433; }
.q-chip-liq-illiquid { color: #c45c4a; border-color: #8a3e34; }
.q-chip-liq-unknown { color: #8a8678; border-color: #2a2924; }

.timing-journal-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}
.timing-journal-form input[type="text"] {
  background: #0a0a09;
  border: 1px solid var(--border, #2a2924);
  color: inherit;
  padding: 0.25rem 0.4rem;
  min-width: 12rem;
}
.timing-scanner-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.timing-scanner-list li {
  margin: 0.6rem 0;
}
.timing-alert-copy {
  color: var(--gold, #d4b95a);
}

.overlay-density-toggle,
.overlay-swing-toggle {
  align-items: center;
  gap: 0.4rem;
  margin: 0.55rem 0.9rem 0 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted, #8a8678);
  cursor: pointer;
  user-select: none;
}
.overlay-density-toggle {
  display: inline-flex;
}
.overlay-density-toggle input,
.overlay-swing-toggle input {
  accent-color: var(--gold, #d4b95a);
}

.chart-view-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
  max-width: 100%;
  min-width: 0;
}
.chart-view-chip {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: none;
  background: transparent;
  color: var(--muted, #8a8678);
  border: 1px solid var(--border, #2a2924);
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  max-width: 100%;
}
.chart-view-chip:hover,
.chart-view-chip:focus-visible {
  color: var(--text, #e8e4d8);
  border-color: var(--gold-dim, #8a7433);
}
.chart-view-chip:focus-visible {
  outline: 1px solid var(--gold, #d4b95a);
  outline-offset: 2px;
}
.chart-view-chip.is-active {
  color: var(--gold, #d4b95a);
  border-color: var(--gold-dim, #8a7433);
  background: rgba(212, 185, 90, 0.08);
}
.chart-view-chip:disabled,
.chart-view-chip[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.chart-classic-legend {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted, #8a8678);
}
.detail.is-classic-chart .chart-classic-legend {
  display: flex;
}
.chart-classic-legend li::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
  background: currentColor;
}
.legend-ema20 { color: #e6c35c; }
.legend-ema50 { color: #d4b95a; }
.legend-ema200 { color: #7c9c7a; }
.legend-bb { color: #8aa4c1; }
.legend-macd { color: #d4b95a; }
.legend-vol { color: #8a8678; }

.overlay-swing-toggle {
  display: none;
}
.detail.is-classic-chart .overlay-swing-toggle {
  display: inline-flex;
}
.detail.is-classic-chart .overlay-density-toggle,
.detail.is-price-chart .overlay-density-toggle,
.detail.is-price-chart .overlay-swing-toggle {
  display: none;
}
