/* ARMADA8 Dashboard v2 — Styles */
:root {
  --bg: #0b0f19;
  --card: #111827;
  --card-alt: #1a2332;
  --input: #0f172a;
  --border: #1e293b;
  --border-h: #334155;
  --text: #f1f5f9;
  --text-s: #94a3b8;
  --text-d: #64748b;
  --accent: #06b6d4;
  --accent-dim: rgba(6,182,212,0.15);
  --green: #10b981;
  --green-bg: rgba(16,185,129,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.1);
  --r: 12px;
  --rs: 8px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh; font-size: 14px; line-height: 1.5;
}

::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }

.mono { font-family: 'JetBrains Mono', monospace; }
.accent { color: var(--accent) !important; }
.green { color: var(--green) !important; }
.red { color: var(--red) !important; }
.bold { font-weight: 700; }
.r { text-align: right; }
.dim { color: var(--text-d); }

/* ═══ LOGIN ═══ */
#login-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(6,182,212,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(16,185,129,0.05) 0%, transparent 50%);
  overflow: hidden;
}
.login-kraken-bg {
  position: absolute;
  bottom: -80px; left: 50%; transform: translateX(-50%);
  width: min(700px, 90vw); height: auto;
  opacity: 0.12; pointer-events: none; z-index: 0;
}
.login-card {
  width: 100%; max-width: 380px; padding: 44px 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; text-align: center;
  box-shadow: 0 0 60px rgba(6,182,212,0.12);
  position: relative; z-index: 1;
}
.login-icon {
  font-size: 48px; margin-bottom: 12px;
  color: var(--accent); font-family: 'JetBrains Mono', monospace;
}
.login-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px; font-weight: 800; letter-spacing: 4px; margin-bottom: 4px;
}
.login-logo span { color: var(--accent); }
.login-sub { color: var(--text-d); font-size: 13px; margin-bottom: 28px; }
.login-field {
  width: 100%; padding: 12px 16px; margin-bottom: 12px;
  background: var(--input); border: 1px solid var(--border);
  border-radius: var(--rs); color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.login-field:focus { border-color: var(--accent); }
.login-field::placeholder { color: var(--text-d); }
.login-btn {
  width: 100%; padding: 13px; margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), #0891b2);
  color: #000; border: none; border-radius: var(--rs);
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; letter-spacing: 1px; transition: opacity .15s;
}
.login-btn:hover { opacity: .85; }
.login-btn:disabled { opacity: .5; cursor: not-allowed; }
.login-error { color: var(--red); font-size: 12px; margin-top: 10px; min-height: 18px; }

/* ═══ DASHBOARD ═══ */
#dashboard { display: none; position: relative; }
#dashboard.active { display: block; }
#login-screen.hidden { display: none; }
.dashboard-kraken-bg {
  position: fixed;
  top: 30%; left: -15%;
  transform: rotate(-15deg);
  width: 1400px; height: auto;
  opacity: 0.04; pointer-events: none; z-index: 1;
  animation: kraken-drift 60s ease-in-out infinite alternate;
}
@keyframes kraken-drift {
  0%   { transform: rotate(-15deg) translate(0, 0); opacity: 0.04; }
  25%  { transform: rotate(-12deg) translate(30px, -20px); opacity: 0.05; }
  50%  { transform: rotate(-10deg) translate(50px, -10px); opacity: 0.04; }
  75%  { transform: rotate(-13deg) translate(20px, 15px); opacity: 0.05; }
  100% { transform: rotate(-15deg) translate(0, 0); opacity: 0.04; }
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; position: relative; z-index: 2; }

/* ═══ NAV ═══ */
.navbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  background: rgba(11,15,25,.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nav-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 800; letter-spacing: 3px;
}
.nav-logo span { color: var(--accent); }
.nav-price {
  display: flex; align-items: baseline; gap: 6px;
  font-family: 'JetBrains Mono', monospace; margin-left: 12px;
}
.nav-price-val { font-size: 15px; font-weight: 700; }
.nav-price-chg { font-size: 12px; font-weight: 600; }
.nav-spacer { flex: 1; }
.nav-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-d); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-d); }
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.error { background: var(--red); }
.nav-logout {
  padding: 5px 12px; border-radius: 6px;
  background: var(--card-alt); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-s); cursor: pointer;
  font-family: inherit; transition: border-color .2s;
}
.nav-logout:hover { border-color: var(--border-h); }

/* ═══ HERO ═══ */
.hero {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px 20px 16px; margin-bottom: 14px;
}
.hero-main { margin-bottom: 14px; }
.hero-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 34px; font-weight: 800; line-height: 1.1;
}
.hero-cur { color: var(--text-d); font-size: 16px; font-weight: 500; margin-left: 4px; vertical-align: top; }
.hero-profit-row { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.hero-label { font-size: 11px; color: var(--text-d); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.hero-profit { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; }
.hero-pct {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
  padding: 2px 7px; border-radius: 4px;
}
.hero-pct.green { background: var(--green-bg); }
.hero-pct.red { background: var(--red-bg); }
.hero-meta {
  display: flex; gap: 20px; padding-top: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-d); }
.meta-val { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; }

/* ═══ REGIME ═══ */
.regime-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; margin-bottom: 14px;
  border-radius: var(--rs); font-size: 12px; font-weight: 600;
}
.regime-bar.RISK_ON { background: var(--green-bg); border: 1px solid rgba(16,185,129,.2); color: var(--green); }
.regime-bar.CAUTION { background: var(--yellow-bg); border: 1px solid rgba(245,158,11,.2); color: var(--yellow); }
.regime-bar.RISK_OFF { background: var(--red-bg); border: 1px solid rgba(239,68,68,.2); color: var(--red); }
.regime-bar.UNKNOWN { background: rgba(100,116,139,.08); border: 1px solid rgba(100,116,139,.2); color: var(--text-d); }
.regime-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.regime-reasons { opacity: .7; font-weight: 400; }

/* ═══ CARDS ═══ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px;
}
.card-title { font-size: 13px; font-weight: 700; }

/* ═══ STATS ═══ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border-h); }
.stat-label {
  font-size: 11px; font-weight: 600; color: var(--text-d);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px;
}
.stat-value { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; }
.stat-sub { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-s); margin-top: 3px; }

/* ═══ ATH ═══ */
.ath-card { padding: 14px 18px; }
.ath-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ath-mult { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 800; color: var(--accent); }
.ath-bar-wrap { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.ath-bar-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width .5s ease; box-shadow: 0 0 8px rgba(6,182,212,.3);
}
.ath-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-d); }

/* ═══ TWO COL ═══ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.two-col .card { margin-bottom: 0; }
.info-rows { display: flex; flex-direction: column; gap: 6px; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.info-row span:first-child { color: var(--text-d); font-size: 12px; }
.info-row span:last-child { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ═══ FGI ═══ */
.fgi-badge {
  display: inline-flex; padding: 3px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.fgi-xfear { background: var(--red-bg); color: var(--red); }
.fgi-fear { background: rgba(249,115,22,.1); color: #f97316; }
.fgi-neutral { background: var(--yellow-bg); color: var(--yellow); }
.fgi-greed { background: var(--green-bg); color: var(--green); }
.fgi-xgreed { background: var(--accent-dim); color: var(--accent); }

/* ═══ CHARTS ═══ */
.chart-card { padding: 0; overflow: hidden; }
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.chart-tabs { display: flex; gap: 4px; }
.tab {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-d); cursor: pointer; font-family: inherit; transition: .15s;
}
.tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.tab:hover:not(.active) { border-color: var(--border-h); color: var(--text-s); }
.chart-body { height: 320px; }

/* ═══ TRADES ═══ */
.trades-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 600; color: var(--text-d);
  text-transform: uppercase; letter-spacing: .3px; text-align: left;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card);
}
td { padding: 8px 14px; border-bottom: 1px solid rgba(30,41,59,.5); font-size: 13px; }
tr:hover td { background: rgba(30,41,59,.3); }
.empty-state { padding: 32px; text-align: center; color: var(--text-d); font-size: 13px; }

/* ═══ CONTROLS ═══ */
.controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.controls-label { font-size: 12px; font-weight: 600; color: var(--text-d); }
.controls-info { font-size: 12px; color: var(--text-d); }
.btn {
  padding: 7px 16px; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  border: none; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .8; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #000; }

/* ═══ FOOTER ═══ */
.footer {
  text-align: center; padding: 14px; font-size: 11px; color: var(--text-d);
  border-top: 1px solid var(--border);
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .chart-body { height: 260px; }
  .nav-price { display: none; }
  .hide-m { display: none; }
  .hero-total { font-size: 26px; }
  .hero-meta { gap: 14px; }
  .login-card { margin: 0 16px; padding: 32px 20px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 0 8px 16px; }
}
