/* Dashboard layout — three-column: watchlist | setups | chart */

/* === LAYOUT === */
.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  grid-template-rows: 1fr;
  height: calc(100vh - 57px);
  margin-top: 57px;
  overflow: hidden;
}

/* === NAV OVERRIDES === */
.dash-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.scanner-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-dim);
  transition: background 0.3s;
}
.status-dot.running { background: var(--yellow); animation: pulse 1s infinite; }
.status-dot.ok { background: var(--accent); }
.status-dot.error { background: var(--red); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.btn-scan {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 14px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.03em;
}
.btn-scan:hover { background: rgba(0, 230, 118, 0.22); border-color: rgba(0, 230, 118, 0.5); }
.btn-scan:disabled { opacity: 0.5; cursor: not-allowed; }

/* === PANELS === */
.watchlist-panel,
.chart-panel {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chart-panel {
  border-right: none;
  border-left: 1px solid var(--border);
}
.setups-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}
.pair-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.chart-timeframe {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
}

/* === WATCHLIST === */
.watchlist-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.watchlist-list::-webkit-scrollbar { width: 4px; }
.watchlist-list::-webkit-scrollbar-track { background: transparent; }
.watchlist-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.pair-row {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pair-row:hover { background: var(--bg-card); }
.pair-row.active {
  background: var(--bg-highlight);
  border-left-color: var(--accent);
}
.pair-row.has-setup { border-left-color: rgba(0, 230, 118, 0.4); }
.pair-row.active.has-setup { border-left-color: var(--accent); }

.pair-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pair-symbol {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pair-price {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.pair-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pair-class {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pair-change {
  font-family: var(--font-mono);
  font-size: 11px;
}
.pair-change.up { color: var(--accent); }
.pair-change.down { color: var(--red); }
.pair-change.flat { color: var(--fg-dim); }

.pair-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 16px;
}
.pair-class-label {
  padding: 8px 16px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
  text-transform: uppercase;
}

/* === STATS BAR === */
.stats-bar {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-elevated);
}
.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-chip-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}
.stat-chip-accent .stat-chip-value { color: var(--accent); }
.stat-chip-label {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.filter-bar::-webkit-scrollbar { height: 0; }
.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  letter-spacing: 0.03em;
}
.filter-btn:hover { border-color: var(--border-bright); color: var(--fg); }
.filter-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(0, 230, 118, 0.4);
}

/* === SETUPS GRID === */
.setups-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-content: start;
}
.setups-grid::-webkit-scrollbar { width: 4px; }
.setups-grid::-webkit-scrollbar-track { background: transparent; }
.setups-grid::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

/* === SETUP CARD === */
.setup-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setup-card:hover { border-color: var(--border-bright); transform: translateY(-1px); }
.setup-card.high-conviction {
  border-color: rgba(0, 230, 118, 0.3);
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-highlight));
}
.setup-card.high-conviction:hover { border-color: rgba(0, 230, 118, 0.55); }

.setup-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.setup-symbol-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.setup-symbol {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.setup-pattern {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.setup-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.badge-long { background: rgba(0, 230, 118, 0.15); color: var(--accent); }
.badge-short { background: rgba(255, 77, 106, 0.15); color: var(--red); }
.badge-neutral { background: rgba(136, 136, 160, 0.15); color: var(--fg-muted); }
.badge-high { background: rgba(0, 230, 118, 0.2); color: var(--accent); border: 1px solid rgba(0,230,118,0.3); }
.badge-medium { background: rgba(255, 215, 64, 0.15); color: var(--yellow); }
.badge-low { background: rgba(136, 136, 160, 0.12); color: var(--fg-dim); }

/* === LEVELS TABLE === */
.setup-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.level-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.level-label {
  font-size: 9px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.level-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.level-entry { color: var(--fg); }
.level-stop { color: var(--red); }
.level-target { color: var(--accent); }
.level-rr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--yellow);
  background: rgba(255, 215, 64, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
  white-space: nowrap;
}

/* === REASONING === */
.setup-reasoning {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.setup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.setup-timeframe {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
}
.setup-age {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
}

/* === CHART PANEL === */
.chart-container {
  flex: 1;
  overflow: hidden;
  background: var(--bg);
}
.chart-info {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 60px;
  max-height: 160px;
  overflow-y: auto;
}
.chart-info-empty {
  font-size: 12px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}
.chart-info-setup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chart-info-reasoning {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.55;
}
.chart-key-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chart-level-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-muted);
}

/* === EMPTY / LOADING STATES === */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 12px;
  text-align: center;
}
.empty-icon {
  font-size: 40px;
  color: var(--fg-dim);
  animation: spin 4s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-muted);
}
.empty-sub {
  font-size: 13px;
  color: var(--fg-dim);
  max-width: 300px;
}

.loading-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}
.dot-anim {
  animation: blink 1.2s steps(3, end) infinite;
  display: inline-block;
  overflow: hidden;
  width: 1.5em;
  vertical-align: bottom;
}
@keyframes blink {
  0% { width: 0; }
  33% { width: 0.5em; }
  66% { width: 1em; }
  100% { width: 1.5em; }
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
  .dash-layout {
    grid-template-columns: 180px 1fr;
    grid-template-rows: auto 1fr;
  }
  .chart-panel { display: none; }
}
@media (max-width: 720px) {
  .dash-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    overflow: visible;
  }
  .watchlist-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: 220px;
  }
  .watchlist-list { overflow-x: auto; overflow-y: hidden; display: flex; padding: 8px; }
  .pair-row { min-width: 120px; border-left: none; border-bottom: 2px solid transparent; }
  .setups-panel { height: auto; overflow: visible; }
  .setups-grid { overflow: visible; height: auto; }
  .stats-bar { flex-wrap: wrap; gap: 8px; }
}
