/* ================================================================
   Algo Trading — Design System v2
   Modern trading platform: clean dark, minimal borders, sharp type
   ================================================================ */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  --bg:             #09090b;
  --surface-0:      #0c0c0f;
  --surface-1:      #131316;
  --surface-2:      #1a1a1f;
  --surface-3:      #222228;
  --border:         #27272a;
  --border-strong:  #3f3f46;
  --text:           #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted:     #71717a;
  --primary:        #3b82f6;
  --primary-hover:  #2563eb;
  --profit:         #22c55e;
  --profit-dim:     rgba(34,197,94,0.12);
  --loss:           #ef4444;
  --loss-dim:       rgba(239,68,68,0.12);
  --warn:           #eab308;
  --warn-dim:       rgba(234,179,8,0.10);
}

/* ── Base ──────────────────────────────────────────────────────── */
html, body {
  background: var(--bg);
  color: var(--text);
}
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ── Layout: Sidebar + Content ─────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
}
.app-main {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
}

/* ── Sidebar Nav Items ─────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  margin: 1px 8px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
}
.nav-item:hover {
  color: var(--text-secondary);
  background: var(--surface-2);
}
.nav-item.tab-active {
  color: var(--text) !important;
  background: var(--surface-2);
}
.nav-item.tab-active::after { display: none; } /* kill old underline */
.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px 16px 4px;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
}
/* Legacy compat: JS uses bg-dark-800 */
.bg-dark-800 {
  background: var(--surface-1) !important;
  box-shadow: none;
  border-color: var(--border) !important;
}
.bg-dark-900 {
  background: var(--surface-0) !important;
}
.bg-dark-700 {
  background: var(--surface-2) !important;
}

/* ── Buttons ───────────────────────────────────────────────────── */
button, a.btn {
  transition: all 0.15s ease;
}
/* Primary blue — flat, no gradient */
button.bg-accent-blue, a.bg-accent-blue {
  background: var(--primary) !important;
  box-shadow: none;
}
button.bg-accent-blue:hover, a.bg-accent-blue:hover {
  background: var(--primary-hover) !important;
  filter: none;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}
/* Green */
button.bg-accent-green, a.bg-accent-green {
  background: var(--profit) !important;
  box-shadow: none;
}
button.bg-accent-green:hover, a.bg-accent-green:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.25);
}
/* Red */
button.bg-accent-red, a.bg-accent-red {
  background: var(--loss) !important;
  box-shadow: none;
}
button.bg-accent-red:hover, a.bg-accent-red:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(239,68,68,0.25);
}
/* Purple */
button.bg-accent-purple, a.bg-accent-purple {
  background: #8b5cf6 !important;
  box-shadow: none;
}
button.bg-accent-purple:hover, a.bg-accent-purple:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.25);
}
/* Secondary */
button.bg-dark-700 {
  transition: background 0.15s, border-color 0.15s;
  box-shadow: none;
}
button.bg-dark-700:hover {
  background: var(--surface-3) !important;
  box-shadow: none;
}

/* ── Inputs ────────────────────────────────────────────────────── */
input, select, textarea {
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
input.focus\:border-accent-green:focus {
  border-color: var(--profit) !important;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}
input.focus\:border-accent-red:focus {
  border-color: var(--loss) !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.15);
}

/* ── Loader ────────────────────────────────────────────────────── */
.loader {
  border: 2px solid var(--border);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  width: 20px; height: 20px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ────────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.flash-green { animation: flashG 0.5s ease-out; }
.flash-red   { animation: flashR 0.5s ease-out; }
@keyframes flashG { 0% { background: var(--profit-dim); } 100% { background: transparent; } }
@keyframes flashR { 0% { background: var(--loss-dim); } 100% { background: transparent; } }

/* ── Bot Cards ─────────────────────────────────────────────────── */
.bot-card {
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s;
}
.bot-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong) !important;
}
.bot-card-live {
  border-color: rgba(34,197,94,0.5) !important;
  box-shadow: 0 0 12px -4px rgba(34,197,94,0.3);
  animation: liveGlow 3s ease-in-out infinite;
}
@keyframes liveGlow {
  0%,100% { box-shadow: 0 0 8px -4px rgba(34,197,94,0.2); }
  50%     { box-shadow: 0 0 16px -2px rgba(34,197,94,0.35); }
}
.bot-card-halted { border-color: rgba(239,68,68,0.4) !important; }
.bot-card-stuck  { border-color: rgba(234,179,8,0.4) !important; }

/* ── Pulse Dots ────────────────────────────────────────────────── */
.pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--profit);
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: pDot 1.8s infinite;
}
.pulse-dot.red    { background: var(--loss); animation: pDotR 1.8s infinite; }
.pulse-dot.yellow { background: var(--warn); animation: pDotY 1.8s infinite; }
.pulse-dot.gray   { background: #52525b; animation: none; box-shadow: none; }
@keyframes pDot {
  0%   { box-shadow: 0 0 0 0   rgba(34,197,94,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0   rgba(34,197,94,0); }
}
@keyframes pDotR {
  0%   { box-shadow: 0 0 0 0   rgba(239,68,68,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0   rgba(239,68,68,0); }
}
@keyframes pDotY {
  0%   { box-shadow: 0 0 0 0   rgba(234,179,8,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(234,179,8,0); }
  100% { box-shadow: 0 0 0 0   rgba(234,179,8,0); }
}

/* ── Skeleton ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: skel 1.5s infinite;
  border-radius: 8px;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Scrollbars ────────────────────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar { width: 5px; height: 5px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
body::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Misc ──────────────────────────────────────────────────────── */
input[type="range"] { accent-color: var(--primary); }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
tbody tr { transition: background-color 0.1s; }
::selection { background: rgba(59,130,246,0.3); color: #fff; }

/* Remove old header/nav divider lines — sidebar handles this now */
header::after, nav::after { display: none; }
