/* History Page Styles */

.history-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 18px 56px;
}

.history-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ════════════════════════════════════════════════════════ */
/* Conclusion Banner */
/* ════════════════════════════════════════════════════════ */

.conclusion-banner {
  padding: 14px 16px;
  border-radius: 6px;
  border: 1px solid rgba(31, 37, 45, 0.95);
  background: rgba(20, 24, 29, 0.92);
  margin-bottom: 0;
}

.conclusion-banner.success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(20, 24, 29, 0.92);
}

.conclusion-banner.warning {
  border-color: rgba(245, 165, 36, 0.3);
  background: rgba(20, 24, 29, 0.92);
}

.conclusion-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  color: #e8ecef;
}

.conclusion-text.error-text {
  color: #fca5a5;
}

/* ════════════════════════════════════════════════════════ */
/* Section Styling */
/* ════════════════════════════════════════════════════════ */

.history-section {
  background: rgba(20, 24, 29, 0.92);
  border: 1px solid rgba(31, 37, 45, 0.95);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7e8893;
  margin: 0;
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-meta-label {
  font-size: 12px;
  color: #7e8893;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.period-select,
.export-btn,
.clear-btn {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid rgba(31, 37, 45, 0.95);
  background: rgba(16, 19, 23, 0.92);
  color: #e8ecef;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.period-select:hover,
.export-btn:hover,
.clear-btn:hover {
  border-color: rgba(245, 165, 36, 0.35);
  background: rgba(245, 165, 36, 0.08);
}

.clear-btn {
  background: rgba(240, 85, 106, 0.08);
  border-color: rgba(240, 85, 106, 0.2);
}

.clear-btn:hover {
  background: rgba(240, 85, 106, 0.15);
  border-color: rgba(240, 85, 106, 0.4);
}

/* ════════════════════════════════════════════════════════ */
/* Metrics Grid */
/* ════════════════════════════════════════════════════════ */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: rgba(31, 37, 45, 0.95);
  border: 1px solid rgba(31, 37, 45, 0.95);
  border-radius: 6px;
  overflow: hidden;
}

.metric-card {
  background: rgba(20, 24, 29, 0.92);
  border: 0;
  border-radius: 0;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7e8893;
}

.metric-value {
  font-size: 17px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #e8ecef;
  line-height: 1.2;
}

.metric-value.positive {
  color: #2dd47e;
}

.metric-value.negative {
  color: #f0556a;
}

.metric-unit {
  font-size: 12px;
  color: #525c66;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════ */
/* Health Grid */
/* ════════════════════════════════════════════════════════ */

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(31, 37, 45, 0.95);
  border: 1px solid rgba(31, 37, 45, 0.95);
  border-radius: 6px;
  overflow: hidden;
}

.health-card {
  background: rgba(20, 24, 29, 0.92);
  border: 0;
  border-radius: 0;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.health-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7e8893;
}

.health-value {
  font-size: 20px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #10b981;
  line-height: 1.2;
}

.health-unit {
  font-size: 12px;
  color: #525c66;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════ */
/* Equity curve */
/* ════════════════════════════════════════════════════════ */

.history-equity .equity-body {
  padding: 0 0 4px;
}

.history-range-tabs {
  display: flex;
  gap: 2px;
  background: rgba(16, 19, 23, 0.92);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(31, 37, 45, 0.95);
}

.history-range-tab {
  padding: 6px 12px;
  font-size: 12px;
  color: #7e8893;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.history-range-tab.is-active {
  background: rgba(20, 24, 29, 0.92);
  color: #e8ecef;
}

.chart-shell {
  height: 180px;
  background: linear-gradient(180deg, rgba(20, 24, 29, 0.92) 0%, rgba(16, 19, 23, 0.92) 100%);
  border-radius: 4px;
  border: 1px solid rgba(31, 37, 45, 0.95);
  overflow: hidden;
}

.chart-shell svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sample-note {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.sample-insufficient {
  opacity: 0.72;
}

.sample-insufficient .positive,
.sample-insufficient .negative {
  opacity: 0.88;
}

/* ════════════════════════════════════════════════════════ */
/* Trades Table */
/* ════════════════════════════════════════════════════════ */

.trades-table-wrapper {
  overflow-x: auto;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.trades-table thead {
  background: rgba(16, 19, 23, 0.92);
}

.trades-table th {
  padding: 10px 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7e8893;
  border-bottom: 1px solid rgba(31, 37, 45, 0.95);
}

.trades-table tbody tr {
  border-bottom: 1px solid rgba(31, 37, 45, 0.95);
  transition: background-color 0.15s;
}

.trades-table tbody tr.trade-row {
  cursor: pointer;
}

.trades-table tbody tr:hover {
  background: rgba(245, 165, 36, 0.04);
}

.trades-table tbody tr.trade-row.is-expanded {
  background: rgba(245, 165, 36, 0.06);
}

.trades-table tbody tr.trade-row:focus-visible {
  outline: 1px solid rgba(245, 165, 36, 0.45);
  outline-offset: -1px;
}

.trades-table td {
  padding: 10px 8px;
  vertical-align: middle;
}

.td-time { width: 80px; font-size: 11px; color: #94a3b8; }
.td-symbol { width: 70px; font-weight: 700; }
.td-side { width: 60px; }
.td-pnl { width: 90px; text-align: right; font-weight: 700; }
.td-r { width: 70px; text-align: right; }
.td-reason { width: 140px; font-size: 11px; color: #94a3b8; }

.pnl-value {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.pnl-value.positive {
  color: #2dd47e;
}

.pnl-value.negative {
  color: #f0556a;
}

/* ════════════════════════════════════════════════════════ */
/* Trade Detail Row */
/* ════════════════════════════════════════════════════════ */

.trade-detail-row {
  background: rgba(245, 165, 36, 0.04);
}

.trade-detail-content {
  padding: 14px 12px;
  background: rgba(16, 19, 23, 0.92);
  border: 1px solid rgba(31, 37, 45, 0.95);
  border-radius: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7e8893;
}

.detail-value {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  word-break: break-word;
}

.detail-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* ════════════════════════════════════════════════════════ */
/* Symbols Table */
/* ════════════════════════════════════════════════════════ */

.symbols-table-wrapper {
  overflow-x: auto;
}

.symbols-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.symbols-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7e8893;
  border-bottom: 1px solid rgba(31, 37, 45, 0.95);
  background: rgba(16, 19, 23, 0.92);
}

.symbols-table tbody tr {
  border-bottom: 1px solid rgba(31, 37, 45, 0.95);
  transition: background-color 0.15s;
}

.symbols-table tbody tr:hover {
  background: rgba(245, 165, 36, 0.04);
}

.symbols-table td {
  padding: 10px 12px;
}

/* ════════════════════════════════════════════════════════ */
/* Empty State */
/* ════════════════════════════════════════════════════════ */

.no-data {
  text-align: center;
  padding: 20px;
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
}

/* ════════════════════════════════════════════════════════ */
/* Footer */
/* ════════════════════════════════════════════════════════ */

.footer {
  text-align: center;
  padding: 16px;
  color: #64748b;
  font-size: 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  margin-top: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════ */
/* Responsive */
/* ════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .health-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 768px) {
  .history-main {
    padding: 16px 12px 40px;
  }

  .history-section {
    padding: 14px;
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .trades-table {
    font-size: 11px;
  }

  .trades-table th {
    padding: 8px 6px;
  }

  .trades-table td {
    padding: 8px 6px;
  }

  .td-reason {
    display: none;
  }

  .history-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-meta {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .metrics-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .trades-table {
    font-size: 12px;
  }

  .metric-value {
    font-size: 16px;
  }

  .health-value {
    font-size: 18px;
  }
}
