/* ── Layout ─────────────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --bs-body-bg: #0f1117;
  --card-bg: #161b27;
  --sidebar-bg: #0d1120;
  --border-color: rgba(255,255,255,0.07);
}

body {
  display: flex;
  min-height: 100vh;
  background-color: var(--bs-body-bg);
  color: #e0e6f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: #8899b0;
  border-radius: 0;
  font-size: 0.9rem;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.3rem;
  text-align: center;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(13,110,253,0.15);
  border-left: 3px solid #0d6efd;
  padding-left: calc(1.25rem - 3px);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-container {
  padding: 1.5rem;
  flex: 1;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-size: 0.875rem;
  font-weight: 600;
  color: #c8d8ea;
  padding: 0.85rem 1.25rem;
}

/* ── Summary cards ──────────────────────────────────────────────────────────── */
.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  height: 100%;
}

.summary-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6c7f95;
  margin-bottom: 0.35rem;
}

.summary-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #e8f0fe;
  line-height: 1.2;
}

.summary-card .sub {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table {
  color: #c8d8ea;
  font-size: 0.875rem;
}

.table th {
  color: #6c7f95;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-color: var(--border-color) !important;
  padding: 0.75rem 1rem;
}

.table td {
  border-color: var(--border-color) !important;
  padding: 0.65rem 1rem;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(255,255,255,0.03) !important;
}

/* ── Portfolio cards ────────────────────────────────────────────────────────── */
.portfolio-card {
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.portfolio-card:hover {
  transform: translateY(-2px);
  border-color: rgba(13,110,253,0.4) !important;
}

/* ── Badge variants ─────────────────────────────────────────────────────────── */
.badge-type {
  font-size: 0.7rem;
  padding: .25em .55em;
  border-radius: 4px;
}

/* ── Positive / negative colors ─────────────────────────────────────────────── */
.text-gain { color: #29d68e !important; }
.text-loss { color: #f05252 !important; }

/* ── Ticker search results ──────────────────────────────────────────────────── */
#tx-search-results .list-group-item {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: #c8d8ea;
  cursor: pointer;
  font-size: 0.875rem;
}

#tx-search-results .list-group-item:hover {
  background: rgba(13,110,253,0.15);
  color: #fff;
}

/* ── Benchmark list ─────────────────────────────────────────────────────────── */
#benchmarks-list .list-group-item {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: #c8d8ea;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bench-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #6c7f95;
}

/* ── Charts ─────────────────────────────────────────────────────────────────── */
canvas {
  max-width: 100%;
}

/* ── Sidebar overlay (mobile) ───────────────────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
#sidebar-overlay.show {
  display: block;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
