/* ── Canvas 多視窗畫布樣式 ─────────────────────────────── */

.canvas-page {
  background: #0a0e14;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Toolbar ──────────────────────────────────────────── */
.canvas-toolbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 1000;
}

.canvas-toolbar__title {
  font-weight: 700;
  font-size: 14px;
  margin-right: 8px;
  white-space: nowrap;
}

.canvas-toolbar__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.btn-add-win {
  background: var(--bg-card);
  color: var(--text-prime);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-add-win:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-clear {
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.btn-clear:hover { color: var(--red); border-color: var(--red); }

.canvas-toolbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Canvas Area ──────────────────────────────────────── */
.canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(88,166,255,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(63,185,80,0.03) 0%, transparent 50%),
    #0a0e14;
}

/* ── Window ───────────────────────────────────────────── */
.canvas-win {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 200px;
  min-height: 120px;
  transition: box-shadow .2s;
}

.canvas-win:hover,
.canvas-win--active {
  box-shadow: 0 12px 40px rgba(0,0,0,.7), 0 0 0 1px rgba(88,166,255,.2);
}

/* Header / drag handle */
.canvas-win__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}

.canvas-win__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.canvas-win__controls {
  display: flex;
  gap: 4px;
}

.canvas-win__btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  line-height: 1;
}
.canvas-win__btn:hover { background: var(--bg-hover); color: var(--text-prime); }
.canvas-win__btn--close:hover { background: rgba(248,81,73,.2); color: var(--red); }

/* Body */
.canvas-win__body {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Minimized */
.canvas-win--minimized .canvas-win__body {
  display: none;
}
.canvas-win--minimized {
  min-height: unset !important;
  height: auto !important;
}

/* Resize handle */
.canvas-win__resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, var(--border) 50%);
  border-radius: 0 0 var(--radius) 0;
}

/* ── Window Content Types ─────────────────────────────── */
.win-chart-container {
  width: 100%;
  height: 100%;
}

.win-table-wrap {
  overflow: auto;
  height: 100%;
}

.win-table-wrap table {
  font-size: 12px;
}

.win-table-wrap thead th {
  font-size: 10px;
  padding: 7px 10px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.win-table-wrap td { padding: 7px 10px; }

.win-controls {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.win-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

.win-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.win-stat__label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.win-stat__value {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  margin-top: 2px;
}

/* ── Toolbar window type badges ─────────────────────────*/
.win-type-chart    { border-top: 2px solid #58a6ff; }
.win-type-portfolio{ border-top: 2px solid #3fb950; }
.win-type-signals  { border-top: 2px solid #f39c12; }
.win-type-news     { border-top: 2px solid #bc8cff; }
.win-type-trades   { border-top: 2px solid #8b949e; }

/* ── Floating action button (add window shortcut) ───── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(88,166,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
  z-index: 500;
}
.fab:hover { transform: scale(1.1); }
