/* History page — analytics dashboard.
 * Reuses --bg-card / --accent-* tokens from the main style.css. */

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
  margin-right: 4px;
}
.range-btn, .tf-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-secondary, #9ca3af);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.range-btn:hover, .tf-btn:hover { color: #fff; border-color: rgba(255,255,255,0.25); }
.range-btn.active, .tf-btn.active {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.40);
  color: var(--accent-green, #10b981);
}

/* Stat cards */
.history-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 24px 32px;
}
@media (max-width: 1300px) { .history-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .history-stats { grid-template-columns: repeat(2, 1fr); } }
.hstat {
  background: var(--bg-card, rgba(20,20,30,0.6));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 16px 20px;
}
.hstat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hstat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hstat-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
}
.hstat-buy   { border-color: rgba(16,185,129,0.25); }
.hstat-buy   .hstat-value { color: #10b981; }
.hstat-sell  { border-color: rgba(239,68,68,0.25); }
.hstat-sell  .hstat-value { color: #ef4444; }
.hstat-wait  { border-color: rgba(245,158,11,0.25); }
.hstat-wait  .hstat-value { color: #f59e0b; }
.hstat-bullish .hstat-value { color: #34d399; }
.hstat-conf    .hstat-value { color: #60a5fa; }

/* Charts */
.history-charts {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 0 32px 24px;
}
@media (max-width: 1300px) { .history-charts { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--bg-card, rgba(20,20,30,0.6));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 20px;
}
.chart-card h3 {
  margin: 0 0 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #9ca3af);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.chart-wrap {
  position: relative;
  height: 280px;
}

/* Detail table */
.history-table-wrap {
  padding: 0 32px 32px;
}
.history-table-wrap h3 {
  margin: 0 0 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #9ca3af);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card, rgba(20,20,30,0.6));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  overflow: hidden;
}
.history-table thead {
  background: rgba(255,255,255,0.04);
}
.history-table th {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.history-table td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover { background: rgba(255,255,255,0.02); }
.history-table .num-mua  { color: #10b981; font-weight: 600; }
.history-table .num-ban  { color: #ef4444; font-weight: 600; }
.history-table .num-cho  { color: #f59e0b; }
.history-table .num-avoid { color: #6b7280; }
.history-table .num-bull { color: #34d399; font-weight: 600; }
.history-table .num-conf { color: #60a5fa; font-weight: 600; }
.history-table .tf-cell  { color: var(--text-secondary, #9ca3af); font-size: 12px; }

.history-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary, #9ca3af);
  font-size: 13px;
}

.history-table-hint {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: var(--text-secondary, #9ca3af);
  font-style: italic;
}

/* Expandable rows */
.history-row { cursor: pointer; transition: background 0.15s; }
.history-row .expand-cell { width: 32px; text-align: center; }
.history-row .chevron {
  display: inline-block;
  font-size: 10px;
  color: var(--text-secondary, #9ca3af);
  transition: transform 0.2s ease;
}
.history-row.expanded .chevron { transform: rotate(90deg); color: var(--accent-green, #10b981); }
.history-row.expanded            { background: rgba(16,185,129,0.04); }

.history-detail-row td.history-detail-cell {
  background: rgba(0,0,0,0.20);
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.history-detail-loading {
  padding: 12px 0;
  color: var(--text-secondary, #9ca3af);
  font-size: 13px;
}

/* Per-action sections inside the expanded row */
.detail-section { margin-bottom: 14px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.detail-count {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-left: 4px;
}
.symbol-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.symbol-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
}
.symbol-chip strong { font-weight: 700; letter-spacing: 0.3px; }
.symbol-chip .conf {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.10);
}
.symbol-chip:hover { transform: translateY(-1px); filter: brightness(1.15); }

.bucket-mua   { color: #10b981; background: rgba(16,185,129,0.10);  border-color: rgba(16,185,129,0.30); }
.bucket-ban   { color: #ef4444; background: rgba(239,68,68,0.10);   border-color: rgba(239,68,68,0.30); }
.bucket-cho   { color: #fbbf24; background: rgba(245,158,11,0.10);  border-color: rgba(245,158,11,0.30); }
.bucket-avoid { color: #d1d5db; background: rgba(107,114,128,0.10); border-color: rgba(107,114,128,0.30); }
