/* ====================================================
   CryptoBotiq – Dashboard CSS
   ==================================================== */

.dash-body {
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar.hidden { transform: translateX(-100%); }

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sb-logo-img { width: 32px; border-radius: 8px; }
.sb-logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  overflow-y: auto;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}
.sb-link:hover, .sb-link.active {
  background: rgba(0,212,255,0.08);
  color: var(--blue);
}
.sb-link.active {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.15);
}
.sb-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sb-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sb-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--red);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.sb-logout:hover { background: rgba(239,68,68,0.08); }

/* ---- MAIN ---- */
.dash-main {
  margin-left: 240px;
  flex: 1;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- TOPBAR ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(7,13,26,0.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
}
.dash-page-title { font-size: 1.1rem; font-weight: 800; line-height: 1; }
.dash-page-sub { font-size: 0.78rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-exchange {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(240,185,11,0.08);
  border: 1px solid rgba(240,185,11,0.2);
  padding: 6px 14px;
  border-radius: 50px;
}
.ex-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.bybit-dot { background: #f0b90b; box-shadow: 0 0 6px #f0b90b; }
.ex-name { font-size: 0.78rem; font-weight: 700; color: #f0b90b; }

.topbar-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.bal-label { font-size: 0.67rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.bal-val { font-size: 0.95rem; font-weight: 700; font-family: var(--mono); color: var(--text); }

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
}

/* ---- STATS ROW ---- */
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 28px 0;
}
.dash-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.3s;
}
.dash-stat-card:hover {
  border-color: rgba(0,212,255,0.2);
  transform: translateY(-2px);
}
.dsc-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.dsc-icon.blue   { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.15); }
.dsc-icon.green  { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.15); }
.dsc-icon.purple { background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.15); }
.dsc-icon.teal   { background: rgba(6,214,160,0.1); border: 1px solid rgba(6,214,160,0.15); }

.dsc-content { display: flex; flex-direction: column; gap: 2px; }
.dsc-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.3px; }
.dsc-val { font-size: 1.25rem; font-weight: 800; font-family: var(--mono); color: var(--text); }
.dsc-val.green { color: var(--green); }
.dsc-change { font-size: 0.75rem; font-weight: 600; }
.dsc-change.green  { color: var(--green); }
.dsc-change.muted  { color: var(--text-dim); }

.dash-sync-status {
  font-size: 0.68rem;
  margin-left: 8px;
  color: var(--text-dim);
  font-weight: 500;
}

button.is-busy,
.btn-primary.is-busy,
.btn-ghost.is-busy {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

/* ---- DASH SECTION ---- */
.dash-section { padding: 24px 28px; }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dash-section-title { font-size: 1.05rem; font-weight: 700; }

/* ---- BOTS GRID ---- */
.bots-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.bot-dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s;
}
.bot-dash-card:hover { border-color: rgba(0,212,255,0.2); }

.bdc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.bdc-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.bdc-icon.teal   { background: rgba(20,184,166,0.12); border: 1px solid rgba(20,184,166,0.2); }
.bdc-icon.blue   { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.15); }
.bdc-icon.orange { background: rgba(249,115,22,0.1); border: 1px solid rgba(249,115,22,0.15); }
.bdc-icon.purple { background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.15); }

.bdc-info { flex: 1; }
.bdc-name { font-size: 0.88rem; font-weight: 700; margin-bottom: 2px; }
.bdc-pair { font-size: 0.72rem; color: var(--text-dim); font-family: var(--mono); }

.bdc-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
}
.bdc-status.running {
  background: rgba(34,197,94,0.1);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.2);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

.bdc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.bdc-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bdcs-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; font-weight: 600; }
.bdcs-val { font-size: 0.88rem; font-weight: 700; font-family: var(--mono); }
.bdcs-val.green  { color: var(--green); }
.bdcs-val.muted  { color: var(--text-dim); }

.bdc-actions { display: flex; gap: 8px; }
.bdc-actions .btn-ghost { flex: 1; justify-content: center; font-size: 0.8rem; padding: 8px 12px; }

.bot-card-clickable { cursor: pointer; }
.bot-card-clickable:hover { border-color: rgba(0,212,255,0.35); transform: translateY(-1px); }
.bdc-deals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.75rem;
}
.deal-pnl-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--mono);
}
.bdc-hint { font-size: 0.68rem; margin: 10px 0 0; text-align: center; }
.bots-page-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ADD BOT CARD */
.add-bot-card {
  border-style: dashed;
  border-color: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  cursor: pointer;
  transition: all 0.3s;
}
.add-bot-card:hover {
  border-color: rgba(0,212,255,0.3);
  background: rgba(0,212,255,0.04);
}
.add-bot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.add-bot-plus {
  width: 48px; height: 48px;
  border: 2px dashed var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: var(--text-dim);
  transition: all 0.3s;
}
.add-bot-card:hover .add-bot-plus { border-color: var(--blue); color: var(--blue); }
.add-bot-label { font-size: 0.88rem; font-weight: 700; color: var(--text-muted); }
.add-bot-sub { font-size: 0.75rem; color: var(--text-dim); }

/* ---- TRADE TABLE ---- */
.trade-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.trade-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
}
.trade-table th {
  background: rgba(0,212,255,0.04);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.trade-table td {
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}
.trade-table tbody tr:last-child td { border-bottom: none; }
.trade-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.mono { font-family: var(--mono); }
.green { color: var(--green); font-weight: 700; }
.red   { color: var(--red);   font-weight: 700; }

.side-long, .side-short, .result-win, .result-loss {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}
.side-long   { background: rgba(34,197,94,0.1);  color: var(--green); }
.side-short  { background: rgba(239,68,68,0.1);  color: var(--red); }
.result-win  { background: rgba(34,197,94,0.1);  color: var(--green); }
.result-loss { background: rgba(239,68,68,0.1);  color: var(--red); }

/* ---- EQUITY CHART ---- */
.equity-chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px 16px;
  margin-bottom: 24px;
}
.equity-chart-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.equity-chart-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.equity-chart-kpis {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.equity-chart-kpis .btn-ghost {
  margin-left: auto;
  white-space: nowrap;
}
.eck-item { display: flex; flex-direction: column; gap: 2px; }
.eck-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.eck-val { font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.equity-chart-wrap {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
  overflow: hidden;
}
.equity-period-tabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 10px;
}
.eq-tab {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.eq-tab:hover { color: var(--text); border-color: rgba(0,212,255,0.35); }
.eq-tab.active {
  background: rgba(0,212,255,0.12);
  border-color: rgba(0,212,255,0.45);
  color: #00D4FF;
}
.equity-chart-wrap canvas { display: block; width: 100%; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .dash-stats-row { grid-template-columns: repeat(2, 1fr); }
  .bots-dash-grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dash-main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .dash-stats-row { grid-template-columns: 1fr 1fr; padding: 16px; gap: 10px; }
  .bots-dash-grid  { grid-template-columns: 1fr; }
  .dash-section { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .topbar-exchange { display: none; }
}
