/* ═══ POLYSTATS — Dashboard Styles ═══ */

/* ── Layout ── */
#app-layout { display: flex; min-height: 100vh; }
#app-layout.hidden { display: none; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* ─────────────────────────────────────────
   PROFILE (top of sidebar)
   ───────────────────────────────────────── */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-profile-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', monospace;
  font-size: 14px; font-weight: 900; color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a3a4a, #0d2230);
  border: 1px solid var(--border2);
}
.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-profile-name {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-profile-role {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
  border: 1px solid rgba(0,212,255,0.2);
}
.sidebar-profile-role.admin {
  background: rgba(168,85,247,0.12);
  color: var(--purple);
  border-color: rgba(168,85,247,0.25);
}
.sidebar-profile-wallet {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.wallet-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.wallet-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(0,255,136,0.5);
}
.wallet-dot.disconnected {
  background: var(--red);
}
.wallet-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wallet-label.has-balance {
  color: var(--green);
}
.wallet-connect-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--cyan);
  border-radius: 4px;
  width: 18px; height: 18px;
  font-size: 13px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s, color .2s;
}
.wallet-connect-btn:hover {
  border-color: var(--cyan);
  color: #fff;
}
.sidebar-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 7px;
  width: 30px; height: 30px;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-logout:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255,68,102,0.06);
}

/* ─────────────────────────────────────────
   NAV scroll area
   ───────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 6px 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* ─────────────────────────────────────────
   NAV GROUPS
   ───────────────────────────────────────── */
.nav-group { padding: 0; }

/* Collapsible group header */
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px 6px 14px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: var(--muted);
  transition: color 0.15s;
  margin-top: 4px;
}
.nav-group-header:hover { color: var(--text); }

.nav-group-icon {
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-group-icon svg { width: 14px; height: 14px; }

.nav-group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex: 1;
  text-align: left;
}

.nav-group-chevron {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: transform 0.2s ease;
  display: inline-block;
  transform: rotate(90deg); /* default: open */
  opacity: 0.5;
}

/* Collapsed state */
.nav-group.collapsed .nav-group-chevron {
  transform: rotate(0deg);
}
.nav-group.collapsed .nav-group-items {
  max-height: 0 !important;
  overflow: hidden;
}

/* Items container — animated */
.nav-group-items {
  max-height: 400px;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ─────────────────────────────────────────
   NAV ITEMS
   ───────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 16px;
  margin: 1px 8px;
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.15px;
  position: relative;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  border-left: 2px solid transparent;
}
.nav-item:hover {
  background: rgba(200,230,240,0.04);
  color: var(--text);
}
.nav-item.active {
  background: rgba(0,255,136,0.07);
  color: var(--green);
  border-left-color: var(--green);
}
.nav-item.active .nav-icon { color: var(--green); }

.nav-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  width: 20px; text-align: center;
  flex-shrink: 0; color: inherit;
  opacity: 0.8; letter-spacing: 0;
}
.nav-label { flex: 1; }
.nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  background: var(--red); color: #fff;
  border-radius: 8px; padding: 1px 5px;
  min-width: 16px; text-align: center; line-height: 1.4;
}

/* ─────────────────────────────────────────
   BOTTOM BRAND
   ───────────────────────────────────────── */
.sidebar-bottom-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sbb-logo {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', monospace;
  font-size: 10px; font-weight: 900; color: #000;
  flex-shrink: 0;
}
.sbb-name {
  font-family: 'Orbitron', monospace;
  font-size: 10px; font-weight: 900;
  letter-spacing: 2px;
  color: var(--muted);
  opacity: 0.5;
}

/* ── Legacy ── */
.nav-divider { height: 1px; background: var(--border); margin: 4px 14px; }
.sidebar-footer { display: none; } /* replaced by sidebar-profile */

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  margin-left: var(--sidebar-w);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--bg2);
  position: sticky; top: 0; z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-clock {
  font-family: 'JetBrains Mono', monospace; font-size: 14px;
  color: var(--muted); letter-spacing: 1px;
}
.topbar-clock .now { color: var(--yellow); font-size: 18px; font-weight: 600; letter-spacing: 2px; text-shadow: 0 0 10px rgba(255,229,102,0.3); }
.topbar-date { font-size: 12px; color: var(--cyan); font-weight: 500; }

/* ── Topbar Session Indicator ── */
.topbar-session {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,255,136,0.06); border: 1px solid rgba(0,255,136,0.2);
  border-radius: 8px; padding: 4px 14px; margin: 0 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  animation: tsGlow 2s infinite alternate;
}
.topbar-session.hidden { display: none; }
@keyframes tsGlow { 0% { border-color: rgba(0,255,136,0.15); } 100% { border-color: rgba(0,255,136,0.4); } }
.ts-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
  animation: tsPulse 1.5s infinite;
}
@keyframes tsPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.ts-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.ts-round { color: var(--cyan); font-weight: 700; font-size: 13px; }
.ts-sep { color: var(--border); font-size: 12px; }
.ts-profit { font-weight: 700; font-size: 13px; }
.ts-profit.positive { color: var(--green); text-shadow: 0 0 8px rgba(0,255,136,0.3); }
.ts-profit.negative { color: var(--red); text-shadow: 0 0 8px rgba(255,68,102,0.3); }

/* ── BTC Ticker ── */
.btc-ticker {
  display: flex; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.btc-src { display: flex; align-items: center; gap: 6px; }
.btc-label { font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.btc-price { font-size: 13px; font-weight: 700; color: var(--yellow); text-shadow: 0 0 6px rgba(255,229,102,0.2); transition: color 0.3s; }
.btc-price.up { color: var(--green); text-shadow: 0 0 6px var(--green-glow); }
.btc-price.down { color: var(--red); text-shadow: 0 0 6px var(--red-glow); }
.btc-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
.btc-dot.off { background: var(--muted); animation: none; }
.btc-diff { font-size: 10px; color: var(--muted); }
.btc-icon { font-size: 12px; }

/* ── Content Area ── */
.main-area { min-width: 0; overflow: hidden; }
.main-content {
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  position: relative; z-index: 1;
}
.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-family: 'Orbitron', monospace;
  font-size: 20px; font-weight: 900; letter-spacing: 4px;
  color: var(--green);
  text-shadow: 0 0 16px var(--green);
}
.page-subtitle {
  font-size: 13px; color: var(--muted); margin-top: 4px;
}

/* ── Dashboard Grid ── */
.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

/* ── Dashboard Profile Hero ── */
.profile-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 24px; margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(0,255,136,0.04) 0%, rgba(0,212,255,0.04) 100%);
  border: 1px solid var(--border); border-radius: 12px;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', monospace; font-size: 26px; font-weight: 900;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 0 20px rgba(0,255,136,0.2);
}
.profile-info { flex: 1; }
.profile-name { font-family: 'Orbitron', monospace; font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: 1px; }
.profile-username { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); margin-top: 2px; }
.profile-wallet {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--muted); margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
}
.profile-wallet .copy-btn {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--cyan); font-size: 10px; padding: 2px 6px; cursor: pointer;
  transition: all 0.15s;
}
.profile-wallet .copy-btn:hover { background: rgba(0,212,255,0.1); }
.profile-actions { display: flex; gap: 8px; }

/* ── Dashboard Chart ── */
.chart-container {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; margin-bottom: 24px;
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.chart-title { font-family: 'Orbitron', monospace; font-size: 12px; font-weight: 700; color: var(--cyan); letter-spacing: 2px; text-transform: uppercase; }
.chart-canvas { width: 100%; height: 200px; }

/* ── Recent Sessions Table ── */
.recent-sessions { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.recent-sessions .section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.recent-sessions .section-title { font-family: 'Orbitron', monospace; font-size: 12px; font-weight: 700; color: var(--cyan); letter-spacing: 2px; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar, .main-content { margin-left: 0; }
  .dash-grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; text-align: center; }
  .profile-actions { justify-content: center; }
}
