/**
 * @file 个股图表面板样式
 * @version 1.4.0
 * @date 2026-11-10
 * @description 与自选股列表保持同一深色卡片风格，图表区域高度由脚本按窗格比例动态设置；
 *              周期切换按钮采用轻量文字标签样式，窗格分隔条为透明拖拽区，hover 时显示金色分隔线。
 */

.detail-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-panel[hidden] {
  display: none;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title {
  font-size: 17px;
  font-weight: 600;
}

.detail-sub {
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: 0.4px;
}

.detail-close,
.detail-action {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.detail-close:hover,
.detail-action:hover {
  color: var(--color-text);
  border-color: rgba(240, 185, 11, 0.45);
}

.detail-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.detail-chart {
  width: 100%;
  height: 300px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-panel);
}

/* 光标数值浮层：只读，不拦截鼠标事件 */
.chart-legend {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(11, 16, 32, 0.72);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.5;
}

.chart-legend .legend-main {
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-legend .legend-sub {
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 主图指标较多，允许换行完整展示 MA 与 BOLL 数值 */
.legend-main-pane .legend-sub {
  white-space: normal;
}

.chart-legend .legend-sub:empty {
  display: none;
}

/* 副图图例贴各自窗格底部，top 由内联 bottom 决定 */
.chart-legend.legend-pane {
  top: auto;
}

/* 窗格分隔条：透明拖拽区，hover / 拖动时显示金色分隔线 */
.chart-pane-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 11px;
  margin-top: -5px;
  z-index: 3;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  background: transparent;
}

.chart-pane-handle::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 1px;
  background: transparent;
  transition: background 0.15s ease;
}

.chart-pane-handle:hover::after,
.chart-pane-handle.is-dragging::after {
  background: rgba(240, 185, 11, 0.75);
}

.detail-periods {
  display: flex;
  gap: 6px;
}

.period-tab {
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.period-tab:hover {
  color: var(--color-text);
}

.period-tab.is-active {
  border-color: rgba(240, 185, 11, 0.55);
  background: rgba(240, 185, 11, 0.12);
  color: var(--color-accent);
}

.indicator-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-muted);
  cursor: pointer;
}

.indicator-toggle input {
  margin: 0;
  accent-color: var(--color-accent);
}

.ma-period {
  width: 48px;
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
  text-align: center;
}

.ma-period:focus {
  outline: none;
  border-color: rgba(240, 185, 11, 0.55);
}

.indicator-apply {
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.indicator-apply:hover {
  color: var(--color-text);
  border-color: rgba(240, 185, 11, 0.45);
}

.detail-status {
  min-height: 16px;
  color: var(--color-muted);
  font-size: 12px;
}

.detail-status.is-error {
  color: var(--color-up);
}

.watchlist-table tbody tr {
  cursor: pointer;
}

.watchlist-table tbody tr.is-active {
  background: rgba(240, 185, 11, 0.08);
  box-shadow: inset 2px 0 0 var(--color-accent);
}
