/* チャートパターン分析ページ */

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

/* ツールバー */
.chart-toolbar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-right: 4px;
}

.toolbar-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.toolbar-btn.active {
  color: #fff;
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.trade-toggle.active[data-show="on"] {
  background: rgba(255, 235, 59, 0.2);
  border-color: rgba(255, 235, 59, 0.5);
  color: #ffeb3b;
}

.trade-toggle.active[data-show="loss"] {
  background: rgba(88, 166, 255, 0.2);
  border-color: rgba(88, 166, 255, 0.5);
  color: var(--accent-blue);
}

.trade-toggle.active[data-show="markers"] {
  background: rgba(41, 98, 255, 0.2);
  border-color: rgba(41, 98, 255, 0.5);
  color: var(--accent-blue);
}

.color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-win { background: #ffeb3b; }
.dot-loss { background: var(--accent-blue); }

.toolbar-info {
  margin-left: auto;
  gap: 16px;
}

.toolbar-info .info-item {
  font-size: 0.8rem;
  white-space: nowrap;
}

.toolbar-info .info-label {
  color: var(--text-muted);
  margin-right: 4px;
}

.toolbar-info .info-item span:not(.info-label) {
  color: var(--text-primary);
  font-weight: 500;
}

/* チャート */
#chart-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

#chart-container {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 400px;
  position: relative;
  background: var(--bg-primary);
}

#trade-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

#zoom-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#chart-container.selecting {
  cursor: crosshair;
}

#chart-container.selecting #zoom-overlay {
  pointer-events: auto;
}

/* 統計カード */
.chart-stats {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.win-bg {
  background: rgba(255, 235, 59, 0.15);
  color: #ffeb3b;
}

.loss-bg {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
}

.neutral-bg {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
}

.stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* 凡例 */
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.legend-color {
  width: 32px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.legend-item strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.legend-item p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* モバイル */
@media (max-width: 768px) {
  .chart-toolbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .toolbar-info {
    display: none;
  }

  #chart-container {
    height: calc(100vh - 180px);
    min-height: 300px;
  }

  .chart-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
