
.chart-controls-top {
  background-color: #202020;
  cursor: grab;
  padding: 4px 10px;
  margin: -8px -8px 1px -8px;  /* 貼齊 container 邊緣 */
  margin-bottom: 8px;
  border-radius: 6px;
  color: white;
  display: flex;
  align-items: center;
  flex: 0 0 auto; /* 高度由內容決定 */
  gap: 5px;
}
.dragging {
  opacity: 0.6;
}
.chart-controls-top select,
.chart-controls-top input,
.chart-controls-top button {
  background-color: #2c2c2c;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 8px;
}
.chart-controls-top button:hover {
  background-color: #3a3a3a;
}
.chart-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background-color: #888;
  opacity: 0.6;
  border-radius: 2px;
}

.chart-container {
  position: relative;
  display: flex;;
}

.chart-body {
  height: calc(100% - 40px); /* 扣掉上方控制區 */
  margin: -8px -4px -8px -4px;
  border: 1px solid rgb(100, 100, 100);
}
.main-chart {
  width: 100%;
  height: 100%;
  min-height: 200px; /* 防止高度為 0 時炸掉 */
}

/* Monitor panel tiles */
.monitor-tile {
  display: inline-flex;
  flex-direction: column;
  width: 220px;
  height: 400px;
  margin: 8px;
  border: 1px solid #444;
  border-radius: 10px;
  background: #1a1a1a;
  color: #eee;
  font-weight: 600;
  user-select: none;
  padding: 12px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.monitor-tile:hover {
  border-color: #666;
}

.monitor-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.monitor-tile-name {
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  line-height: 1.2;
}

.monitor-tile-code {
  font-size: 12px;
  color: #aaa;
  margin-top: 2px;
}

.monitor-tile-market {
  font-size: 10px;
  color: #888;
  background: #333;
  padding: 3px 6px;
  border-radius: 4px;
}

.monitor-tile-price {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  margin: 6px 0;
  line-height: 1.2;
}

.monitor-tile-price.up {
  color: #ef5350;
}

.monitor-tile-price.down {
  color: #26a69a;
}

.monitor-tile-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin: 4px 0;
}

.monitor-tile-change-abs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.monitor-tile-change-abs.up {
  color: #ef5350;
}

.monitor-tile-change-abs.down {
  color: #26a69a;
}

.monitor-tile-change-percent {
  font-weight: bold;
}

.monitor-tile-change-percent.up {
  color: #ef5350;
}

.monitor-tile-change-percent.down {
  color: #26a69a;
}

.monitor-tile-volume {
  font-size: 12px;
  color: #888;
  text-align: center;
  margin: 4px 0;
}

.monitor-tile-last-trade {
  font-size: 12px;
  color: #4fc3f7;
  text-align: center;
  margin: 2px 0;
  font-weight: bold;
}

.monitor-tile-aggression {
  margin-top: 6px;
  padding: 4px;
  background: rgba(79, 195, 247, 0.1);
  border-radius: 5px;
  border: 1px solid rgba(79, 195, 247, 0.3);
}

.aggression-label {
  font-size: 10px;
  color: #4fc3f7;
  text-align: center;
  font-weight: bold;
  margin-bottom: 3px;
}

.aggression-speed, .aggression-avg, .aggression-direction {
  font-size: 10px;
  text-align: center;
  margin: 2px 0;
}

.aggression-speed {
  color: #ffeb3b;
}

.aggression-avg {
  color: #4fc3f7;
}

.aggression-direction {
  color: #fff;
}

.monitor-tile-orderbook {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
}

.monitor-tile-bids, .monitor-tile-asks {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.monitor-tile-bids {
  text-align: left;
}

.monitor-tile-asks {
  text-align: right;
}

.monitor-tile-bid, .monitor-tile-ask {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
  border-radius: 3px;
}

.monitor-tile-bid {
  background: rgba(38, 166, 154, 0.1);
  color: #26a69a;
}

.monitor-tile-ask {
  background: rgba(239, 83, 80, 0.1);
  color: #ef5350;
}

.monitor-tile-orderbook-label {
  font-size: 10px;
  color: #666;
  text-align: center;
  margin: 3px 0;
  font-weight: bold;
}

/* 訊號區域樣式 */
.monitor-signal-feed {
  background: #1a1a1a;
  border-radius: 4px;
  border: 1px solid #333;
}

.signal-item {
  margin: 4px 0;
  padding: 6px;
  border-radius: 4px;
  border-left: 3px solid;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
}

.signal-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.signal-large {
  border-left-color: #ffeb3b;
}

.signal-huge {
  border-left-color: #ff5722;
}

.signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.signal-time {
  font-size: 10px;
  color: #888;
  font-family: monospace;
}

.signal-type {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
}

.signal-large .signal-type {
  background: rgba(255, 235, 59, 0.2);
  color: #ffeb3b;
}

.signal-huge .signal-type {
  background: rgba(255, 87, 34, 0.2);
  color: #ff5722;
}

.signal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 11px;
}

.signal-symbol {
  font-weight: bold;
  color: #fff;
}

.signal-price {
  font-weight: bold;
  color: #4fc3f7;
  text-align: right;
}

.signal-size {
  color: #ffeb3b;
  font-weight: bold;
}

.signal-direction {
  text-align: right;
  font-weight: bold;
}

/* 訊號閃爍動畫 */
@keyframes signalFlash {
  0% {
    background: rgba(255, 87, 34, 0.3);
    transform: scale(1.02);
  }
  50% {
    background: rgba(255, 87, 34, 0.1);
    transform: scale(1.01);
  }
  100% {
    background: rgba(255, 255, 255, 0.02);
    transform: scale(1);
  }
}