/* Nexus Trading — combined styles (login flow + main app) */

:root {
  --bg-base: #070B14;
  --bg-card: #0B101C;
  --bg-card-hover: #131A2B;
  --border: rgba(20, 184, 166, 0.07);
  --border-strong: rgba(20, 184, 166, 0.18);
  --accent: #0ea5b7;
  --accent-bright: #2dd4bf;
  --accent-glow: rgba(14, 165, 183, 0.4);
  --green: #22c55e;
  --green-soft: #4ade80;
  --green-glow: rgba(34, 197, 94, 0.45);
  --red: #f87171;
  --red-soft: #fca5a5;
  --red-glow: rgba(248, 113, 113, 0.4);
  --amber: #fbbf24;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

body {
  background: var(--bg-base);
  min-height: 100vh;
}

/* ─── Login / pending centered layouts ─────────────────── */
.full-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.brand h1 { margin: 0; font-size: 28px; font-weight: 700; }
.logo-block {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn.tg-btn {
  background: #229ED9;
  border: 1px solid #229ED9;
  color: white;
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
  justify-content: center;
}
.btn.tg-btn:hover { background: #1f8fc4; }
.btn.tg-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.status-box {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  text-align: left;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}
.status-box.pending { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.06); }
.status-box.waiting { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.06); }
.status-box.error   { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.06); }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2);
  flex-shrink: 0;
}
.status-dot.red {
  background: var(--red); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2);
}
.status-title { font-weight: 600; font-size: 14px; }
.status-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hint { color: var(--text-secondary); font-size: 12px; margin-top: 16px; }
.hint .warn { color: var(--amber); font-weight: 600; }
.hint code {
  background: rgba(255, 255, 255, 0.06); padding: 1px 6px; border-radius: 4px; font-size: 11px;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.sidebar {
  background: rgba(8, 11, 20, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}
.nav-item:hover { background: rgba(20,184,166,0.08); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(20,184,166,0.18), rgba(20,184,166,0.04));
  color: white;
  box-shadow: 0 4px 16px rgba(20,184,166,0.15);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 24px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─── Cards ───────────────────────────────────────────── */
.card {
  background: #0F1623;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  transition: border-color 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}
.card:hover { border-color: rgba(255, 255, 255, 0.07); }
.card.card-dirty {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 0 0 1px rgba(245, 158, 11, 0.15);
}
.stat-card { position: relative; overflow: hidden; }

/* ─── Toggles, pills, badges (same as prototype) ───────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(100, 116, 139, 0.3);
  border-radius: 12px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; background: white;
  border-radius: 50%; top: 3px; left: 3px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 16px var(--accent-glow);
}
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: rgba(20,184,166,0.12);
  border: 1px solid rgba(20,184,166,0.25);
  color: #c7d2fe; transition: all 0.2s;
}
.pill.excluded {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}
.pill.clickable { cursor: pointer; }
.pill.clickable:hover { transform: scale(1.05); }

.badge-long, .badge-short {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.badge-long {
  background: rgba(34,197,94,0.14);
  color: var(--green-soft);
  border: 1px solid rgba(34,197,94,0.28);
}
.badge-short {
  background: rgba(248,113,113,0.14);
  color: var(--red-soft);
  border: 1px solid rgba(248,113,113,0.28);
}
.status-pill {
  display: inline-flex; align-items: center;
  padding: 4px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.status-tp { color: var(--green); }
.status-sl { color: var(--red); }
.status-expired { color: #f59e0b; }
.status-trail { color: #06b6d4; }

.pnl-positive {
  color: var(--green-soft);
  text-shadow: 0 0 14px rgba(34,197,94,0.25);
}
.pnl-negative { color: var(--red-soft); }

/* ─── Inputs & buttons ─────────────────────────────────── */
.input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
  outline: none;
  width: 100%;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.2);
  background: rgba(15, 23, 42, 0.9);
}
.input::placeholder { color: var(--text-tertiary); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none; font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: white;
  box-shadow: 0 4px 16px rgba(20,184,166,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(20,184,166,0.5);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* ─── Misc utilities ───────────────────────────────────── */
.counter-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.page-enter { animation: pageEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.trade-row { transition: all 0.2s ease; cursor: default; }
.trade-row:hover { background: rgba(20,184,166,0.05) !important; }

.spinner {
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 18px; height: 18px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0); }
::-webkit-scrollbar-thumb { background: rgba(20,184,166,0.2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,184,166,0.35); }

.glow-text {
  background: linear-gradient(135deg, #f1f5f9, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pulse-dot {
  position: relative; width: 8px; height: 8px;
  border-radius: 50%; background: var(--green);
}
.pulse-dot::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; background: var(--green);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.5); opacity: 0; }
}

.filter-segments {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.filter-segments button {
  padding: 8px 14px;
  border: none; background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 600;
  border-radius: 7px;
  cursor: pointer; transition: all 0.2s ease;
  font-family: inherit;
}
.filter-segments button:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.filter-segments button.active {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: white;
  box-shadow: 0 4px 14px rgba(20,184,166,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
}

.delta-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.delta-pill.up { background: rgba(34,197,94,0.14); color: var(--green-soft); }
.delta-pill.down { background: rgba(248,113,113,0.14); color: var(--red-soft); }

.mix-bar {
  position: relative; width: 100%; height: 6px;
  background: rgba(20,184,166,0.08);
  border-radius: 3px; overflow: hidden;
  margin-top: 6px;
}
.mix-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-wrap { position: relative; width: 100%; height: 280px; }
.chart-wrap-sm { position: relative; width: 100%; height: 160px; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ─── Mobile tweaks ─────────────────────────────────── */
@media (max-width: 767px) {
  .login-card {
    padding: 24px 20px;
    border-radius: 12px;
  }
  .brand h1 { font-size: 22px; }
  .filter-segments { width: 100%; flex-wrap: wrap; }
  .filter-segments button { flex: 1 0 auto; padding: 8px 10px; font-size: 12px; }
  .chart-wrap { height: 220px; }
  .chart-wrap-sm { height: 140px; }
  .status-box { padding: 12px; gap: 10px; }
  .status-title { font-size: 13px; }
  .status-sub { font-size: 11px; }
  /* Bigger touch targets for nav */
  .nav-item { padding: 14px 16px; }
  /* Stat card numbers a touch smaller */
  .card .text-3xl { font-size: 1.5rem; }
}

.section-title { display: inline-block; position: relative; }
.section-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 30px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright), transparent);
  border-radius: 2px;
}
