/* ============================================
   NEXUS ENGINE | Admin Dashboard
   Brand: GE-AS.COM (Global E-Commerce Arbitrage Store)
   Colors: Purple primary, Orange accent, Dark base
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0c0a15;
  --bg-surface: #141221;
  --bg-surface-2: #1c1930;
  --bg-surface-3: #241f3a;
  --border: #2d2847;
  --border-light: #3d3660;

  --purple: #8747e6;
  --purple-light: #a06eef;
  --purple-dim: rgba(135, 71, 230, 0.12);
  --purple-glow: rgba(135, 71, 230, 0.25);

  --orange: #e8842a;
  --orange-light: #f0a050;
  --orange-dim: rgba(232, 132, 42, 0.12);
  --orange-glow: rgba(232, 132, 42, 0.25);

  --green: #2ecc71;
  --green-dim: rgba(46, 204, 113, 0.10);
  --red: #e74c3c;
  --red-dim: rgba(231, 76, 60, 0.10);
  --cyan: #3498db;
  --cyan-dim: rgba(52, 152, 219, 0.10);

  --text: #eae6f5;
  --text-secondary: #9b93b3;
  --text-dim: #685f82;

  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* --- Preview Banner --- */
.preview-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 8px 0;
  background: linear-gradient(90deg, var(--purple), var(--orange));
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #fff;
  text-transform: uppercase;
}

.preview-divider {
  margin: 0 10px;
  opacity: 0.5;
}

/* --- Header --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(135, 71, 230, 0.03) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 5px;
}

.version-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--purple-light);
  background: var(--purple-dim);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(135, 71, 230, 0.2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.header-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  transition: all 0.2s;
}

.header-btn:hover {
  background: var(--bg-surface-2);
  color: var(--text);
}

/* --- Navigation Tabs --- */
.nav-tabs {
  display: flex;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.nav-tab {
  padding: 14px 22px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-body);
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--orange);
}

/* --- Main Content --- */
.main {
  padding: 28px 32px;
  max-width: 1440px;
  margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; }

/* --- Session Controller --- */
.session-controller {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(135, 71, 230, 0.06) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.session-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.session-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 18px;
  color: #fff;
}

.session-title { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.session-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.engine-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-dim);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(46, 204, 113, 0.2);
}

.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.4;
  animation: pulse 2s ease-in-out infinite;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(2.5); opacity: 0; }
}

.engine-status-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.5px;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.session-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.session-card.live {
  background: rgba(135, 71, 230, 0.08);
  border-color: rgba(135, 71, 230, 0.3);
}

.session-card.live::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--orange));
}

.session-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.session-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.session-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 3px;
}

.countdown-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.session-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}

.session-badge.completed {
  color: var(--green);
  background: var(--green-dim);
}

.session-badge.upcoming {
  color: var(--text-dim);
}

/* --- Metric Cards --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  opacity: 0.06;
}

.metric-card.purple::after { background: var(--purple); }
.metric-card.orange::after { background: var(--orange); }
.metric-card.green::after { background: var(--green); }
.metric-card.cyan::after { background: var(--cyan); }

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.metric-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

.metric-change.up { color: var(--green); }
.metric-change.down { color: var(--red); }

/* --- Charts Row --- */
.charts-row {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-link {
  font-size: 11px;
  color: var(--orange);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.card-link:hover { color: var(--orange-light); }

.chart-legend {
  display: flex;
  gap: 18px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

/* --- Canvas charts --- */
.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* --- Donut center text --- */
.donut-wrapper {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.donut-center-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.donut-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.donut-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.donut-legend-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.donut-legend-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-left: 2px;
}

/* --- Bottom Row --- */
.bottom-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
  margin-bottom: 20px;
}

/* --- Table --- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.data-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 12px;
  text-align: left;
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  background: var(--bg-surface-2);
}

.data-table tr td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.data-table tr td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.user-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}

.wins-cell { color: var(--green); font-weight: 600; }
.losses-cell { color: var(--red); }

.profit-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profit-bar-track {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-primary);
  overflow: hidden;
}

.profit-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.profit-text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.volume-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.status-badge.active { color: var(--green); background: var(--green-dim); }
.status-badge.capped { color: var(--orange); background: var(--orange-dim); }
.status-badge.warning { color: var(--red); background: var(--red-dim); }

/* --- Health Bars --- */
.health-item {
  margin-bottom: 16px;
}

.health-item:last-child { margin-bottom: 0; }

.health-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.health-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.health-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.health-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-primary);
  overflow: hidden;
}

.health-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s ease-out;
}

/* --- Market Activity Grid --- */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.market-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.market-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.market-rate {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.market-rate-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.market-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-primary);
  overflow: hidden;
  margin-bottom: 10px;
}

.market-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--purple), var(--orange));
}

.market-stats {
  display: flex;
  justify-content: space-between;
}

.market-stat {
  font-size: 10px;
  color: var(--text-dim);
}

.market-stat strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* --- Admin Controls --- */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.control-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.control-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.control-group-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.control-item:last-child { border-bottom: none; }

.control-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.control-sublabel {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.control-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-input {
  width: 72px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.control-input:focus {
  outline: none;
  border-color: var(--purple);
}

.control-unit {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.control-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}

.control-toggle.on { background: var(--purple); }

.control-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.control-toggle.on::after {
  transform: translateX(18px);
}

.nexus-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--purple-light);
  background: var(--purple-dim);
  padding: 2px 7px;
  border-radius: 3px;
}

.override-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 2px 7px;
  border-radius: 3px;
}

/* --- User Analytics specific --- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-card-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

.stat-card-detail {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* --- Profit Distribution --- */
.dist-chart-container {
  position: relative;
  width: 100%;
  height: 160px;
}

.cap-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.cap-note strong {
  color: var(--red);
  font-weight: 600;
}

/* --- Side columns --- */
.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px 0 12px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.footer-text {
  font-size: 11px;
  color: var(--text-dim);
}

.footer-text strong {
  color: var(--purple-light);
  font-weight: 600;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeUp 0.5s ease-out forwards;
}

.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.16s; }
.animate-in:nth-child(4) { animation-delay: 0.24s; }
