/**
 * Stream Platform Branding Alignment
 * Matches DX Stream platform design system, colors, navigation, and light mode
 */

/* ===== DX Brand Colors (from Stream Platform) ===== */
:root {
  /* DX Brand Colors */
  --dx-cyan: #1FDDFE;
  --dx-emerald: #10B981;
  --dx-gold: #F4B73E;

  /* Background Colors */
  --bg1: #0b2f53;
  --bg2: #0a2240;
  --bg3: #0b0b10;

  /* Text Colors (RGB format for opacity control) */
  --text: 255 255 255;
  --text-dim: 255 255 255;
  --text-dim-opacity: 0.65;
  --line: 255 255 255;
  --line-opacity: 0.12;

  /* Panel Colors */
  --panel-top: 255 255 255;
  --panel-top-opacity: 0.06;
  --panel-bot: 255 255 255;
  --panel-bot-opacity: 0.03;

  /* Primary Colors */
  --oui-color-primary: 16 185 129; /* emerald */
  --oui-color-primary-light: 88 229 185;
  --oui-color-primary-darken: 5 150 105;
  --oui-color-primary-contrast: 0 0 0;

  /* Link Colors */
  --oui-color-link: 244 183 62; /* gold */
  --oui-color-link-light: 251 191 36;

  /* Gradients */
  --oui-gradient-primary-start: 244 183 62; /* gold */
  --oui-gradient-primary-end: 16 185 129; /* emerald */
  --oui-gradient-brand-start: 244 183 62;
  --oui-gradient-brand-end: 16 185 129;

  /* Danger Colors */
  --oui-color-danger: 245 97 139;
  --oui-color-danger-light: 250 167 188;
  --oui-color-danger-darken: 237 72 122;

  /* Warning Colors */
  --oui-color-warning: 244 183 62;
  --oui-color-warning-light: 251 191 36;
  --oui-color-warning-darken: 217 119 6;

  /* Base Colors */
  --oui-color-base-1: 210 210 220;
  --oui-color-base-2: 180 184 196;
  --oui-color-base-3: 70 74 92;
  --oui-color-base-4: 58 62 82;
  --oui-color-base-5: 52 56 74;
  --oui-color-base-6: 44 48 66;
  --oui-color-base-7: 11 47 83;
  --oui-color-base-8: 10 34 64;
  --oui-color-base-9: 18 20 32;
  --oui-color-base-10: 11 11 16;

  --oui-color-base-foreground: 255 255 255;
  --oui-color-line: 255 255 255;

  /* Trading Colors */
  --oui-color-trading-loss: 245 97 139;
  --oui-color-trading-profit: 16 185 129;

  /* Border Radius */
  --oui-rounded: 4px;
  --oui-rounded-md: 6px;
  --oui-rounded-lg: 8px;
  --oui-rounded-xl: 12px;
  --oui-rounded-full: 9999px;
}

/* ===== Background (Matches Stream Platform) ===== */
html {
  background: radial-gradient(
    ellipse at 50% -10%,
    #0b2f53,
    #0a2240 35%,
    #0b0b10 100%
  ) fixed !important;
}

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
  background: radial-gradient(
    ellipse at 50% -10%,
    #0b2f53,
    #0a2240 35%,
    #0b0b10 100%
  ) fixed !important;
  color: rgb(var(--oui-color-base-foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Light Mode Support ===== */
html.light {
  --bg1: #f8f9fa;
  --bg2: #fafafa;
  --bg3: #ffffff;

  --text: 0 0 0;
  --text-dim: 0 0 0;
  --text-dim-opacity: 0.8;
  --line: 0 0 0;
  --line-opacity: 0.08;

  --panel-top: 0 0 0;
  --panel-top-opacity: 0.02;
  --panel-bot: 0 0 0;
  --panel-bot-opacity: 0.01;

  --oui-color-base-foreground: 0 0 0;
  --oui-color-line: 0 0 0;
}

html.light body {
  background: linear-gradient(180deg, #f8f9fa 0%, #fafafa 50%, #ffffff 100%) fixed !important;
  color: rgb(var(--oui-color-base-foreground));
}

html.light html {
  background: linear-gradient(180deg, #f8f9fa 0%, #fafafa 50%, #ffffff 100%) fixed !important;
}

/* ===== Navigation (Matches Stream Platform Top Header) ===== */
.nav {
  background: linear-gradient(180deg, rgba(26,29,41,.95) 0%, rgba(21,24,33,.98) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.1);
  box-shadow:
    0 2px 8px rgba(0,0,0,.2),
    0 0 0 1px rgba(255,255,255,.05);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

html.light .nav {
  background: linear-gradient(180deg, #f8f9fa 0%, #fafafa 100%);
  border-bottom: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
}

.nav-brand .brand-text {
  font-size: var(--font-size-xl);
  font-weight: 700;
  background: linear-gradient(135deg, var(--dx-gold) 0%, var(--dx-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.nav-brand .brand-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
}

.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
}

.nav-link {
  color: rgba(var(--text), var(--text-dim-opacity));
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  padding: var(--spacing-xs) 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, var(--dx-gold) 0%, var(--dx-emerald) 100%);
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: rgb(var(--oui-color-primary));
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

html.light .nav-link {
  color: rgba(var(--text), var(--text-dim-opacity));
}

html.light .nav-link:hover,
html.light .nav-link.active {
  color: rgb(var(--oui-color-primary-darken));
}

/* ===== Wallet Info (Matches Stream Platform) ===== */
.wallet-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--oui-rounded-lg);
  backdrop-filter: blur(8px);
}

html.light .wallet-info {
  background: rgba(0,0,0,.02);
  border: 1px solid rgba(0,0,0,.08);
}

.wallet-address {
  font-family: 'Courier New', monospace;
  font-size: var(--font-size-sm);
  color: rgba(var(--text), var(--text-dim-opacity));
}

.wallet-balance {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-weight: 600;
}

.balance-label {
  color: rgba(var(--text), var(--text-dim-opacity));
  font-size: var(--font-size-sm);
}

.balance-value {
  color: var(--dx-gold);
  font-weight: 700;
}

html.light .balance-value {
  color: var(--dx-gold);
}

/* ===== Buttons (Matches Stream Platform) ===== */
.btn {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  border-radius: var(--oui-rounded-lg);
  padding: var(--spacing-sm) var(--spacing-lg);
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    rgb(var(--oui-gradient-primary-start)),
    rgb(var(--oui-gradient-primary-end))
  ) !important;
  color: rgb(var(--oui-color-primary-contrast)) !important;
  border-color: rgba(0,0,0,.2) !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  filter: brightness(0.95);
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.1);
  color: rgb(var(--oui-color-base-foreground));
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
  transform: translateY(-1px);
}

html.light .btn-secondary {
  background: rgba(0,0,0,.02);
  border: 1px solid rgba(0,0,0,.08);
}

html.light .btn-secondary:hover {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.12);
}

.btn-danger {
  background: linear-gradient(
    180deg,
    rgb(153 24 76),
    rgb(245 97 139)
  ) !important;
  color: rgb(255 255 255) !important;
  border-color: rgb(237 72 122) !important;
}

.btn-danger:hover {
  filter: brightness(1.08) !important;
}

.btn-danger:active {
  filter: brightness(0.9) !important;
}

/* ===== Dashboard Cards (Matches Stream Platform Style) ===== */
.dashboard-card {
  background: #0a2240 !important; /* Same navy blue as Stream video cards */
  border: 1px solid rgba(var(--line), var(--line-opacity));
  border-radius: var(--oui-rounded-xl);
  padding: var(--spacing-lg);
  backdrop-filter: blur(12px);
  box-shadow:
    0 4px 16px rgba(0,0,0,.2),
    0 0 0 1px rgba(255,255,255,.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden !important;
  position: relative;
}

html.light .dashboard-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.98) 100%) !important;
  border: 1px solid rgba(var(--line), var(--line-opacity));
  box-shadow:
    0 4px 16px rgba(0,0,0,.08),
    0 0 0 1px rgba(0,0,0,.05);
}

.dashboard-card:hover {
  border-color: rgba(var(--oui-color-primary), 0.3);
  box-shadow:
    0 8px 24px rgba(0,0,0,.3),
    0 0 0 1px rgba(var(--oui-color-primary), 0.2),
    0 0 20px rgba(16, 185, 129, 0.15);
  transform: translateY(-2px);
}

html.light .dashboard-card:hover {
  box-shadow:
    0 8px 24px rgba(0,0,0,.12),
    0 0 0 1px rgba(var(--oui-color-primary), 0.2);
}

/* ===== Stat Cards ===== */
.stat-card {
  background: linear-gradient(180deg,
    rgba(var(--panel-top), var(--panel-top-opacity)) 0%,
    rgba(var(--panel-bot), var(--panel-bot-opacity)) 100%);
  border: 1px solid rgba(var(--line), var(--line-opacity));
  border-radius: var(--oui-rounded-xl);
  padding: var(--spacing-lg);
  text-align: center;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
  border-color: rgba(var(--oui-color-primary), 0.3);
  box-shadow:
    0 8px 24px rgba(0,0,0,.3),
    0 0 0 1px rgba(var(--oui-color-primary), 0.2);
  transform: translateY(-2px) scale(1.02);
}

.stat-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: rgba(var(--text), var(--text-dim-opacity));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-md);
}

.stat-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: var(--spacing-sm) 0;
  background: linear-gradient(135deg, var(--dx-gold) 0%, var(--dx-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.positive {
  background: linear-gradient(135deg, rgb(var(--oui-color-trading-profit)) 0%, rgb(var(--oui-color-primary-darken)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.negative {
  background: linear-gradient(135deg, rgb(var(--oui-color-trading-loss)) 0%, rgb(var(--oui-color-danger-darken)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: var(--font-size-sm);
  color: rgba(var(--text), var(--text-dim-opacity));
  font-weight: 500;
  margin-bottom: var(--spacing-md);
}

.stat-change {
  font-size: var(--font-size-sm);
  font-weight: 700;
  margin-top: var(--spacing-xs);
  padding: 0.25rem 0.75rem;
  border-radius: var(--oui-rounded);
  display: inline-block;
}

.stat-change.positive {
  background: rgba(var(--oui-color-trading-profit), 0.1);
  color: rgb(var(--oui-color-trading-profit));
  border: 1px solid rgba(var(--oui-color-trading-profit), 0.2);
}

.stat-change.negative {
  background: rgba(var(--oui-color-trading-loss), 0.1);
  color: rgb(var(--oui-color-trading-loss));
  border: 1px solid rgba(var(--oui-color-trading-loss), 0.2);
}

/* ===== Card Headers ===== */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid rgba(var(--line), var(--line-opacity));
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin: 0;
  color: rgb(var(--oui-color-base-foreground));
}

/* ===== Dashboard Title ===== */
.dashboard-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-sm);
  background: linear-gradient(135deg, var(--dx-gold) 0%, var(--dx-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.dashboard-subtitle {
  font-size: var(--font-size-lg);
  color: rgba(var(--text), var(--text-dim-opacity));
  text-align: center;
  font-weight: 500;
}

/* ===== Links ===== */
a {
  color: rgb(var(--oui-color-link)) !important;
  transition: color 0.2s ease-in-out !important;
}

a:hover {
  color: rgb(var(--oui-color-primary)) !important;
}

html.light a {
  color: rgb(var(--oui-color-link)) !important;
}

html.light a:hover {
  color: rgb(var(--oui-color-primary-darken)) !important;
}

/* ===== Tables ===== */
.positions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.positions-table thead th {
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(8px);
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 700;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(var(--text), var(--text-dim-opacity));
  border-bottom: 2px solid rgba(var(--line), var(--line-opacity));
}

html.light .positions-table thead th {
  background: rgba(0,0,0,.02);
}

.positions-table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(var(--line), var(--line-opacity));
}

.positions-table tbody tr:hover {
  background: rgba(255,255,255,.03);
  transform: scale(1.01);
}

html.light .positions-table tbody tr:hover {
  background: rgba(0,0,0,.02);
}

.positions-table tbody td {
  padding: var(--spacing-md);
  font-weight: 500;
}

/* ===== Filter Buttons ===== */
.stat-filter-btn {
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(var(--line), var(--line-opacity));
  border-radius: var(--oui-rounded-lg);
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  color: rgba(var(--text), var(--text-dim-opacity));
}

.stat-filter-btn:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(var(--oui-color-primary), 0.3);
  transform: translateY(-1px);
}

.stat-filter-btn.active {
  background: linear-gradient(135deg,
    rgb(var(--oui-gradient-primary-start)),
    rgb(var(--oui-gradient-primary-end)));
  border-color: transparent;
  color: rgb(var(--oui-color-primary-contrast));
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

html.light .stat-filter-btn {
  background: rgba(0,0,0,.02);
  border: 1px solid rgba(var(--line), var(--line-opacity));
}

html.light .stat-filter-btn:hover {
  background: rgba(0,0,0,.06);
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: rgba(var(--text), var(--text-dim-opacity));
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .dashboard-card {
    padding: var(--spacing-md);
    border-radius: var(--oui-rounded-lg);
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .dashboard-title {
    font-size: 2rem;
  }
}

/* ===== Scrollbar (Matches Stream Platform - Gray) ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255,255,255,.03);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
  border: none;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

/* Hide scrollbar for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(255,255,255,.03);
}

html.light ::-webkit-scrollbar-track {
  background: rgba(0,0,0,.02);
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.15);
  border: none;
}

html.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.25);
}

html.light * {
  scrollbar-color: rgba(0,0,0,.15) rgba(0,0,0,.02);
}

/* Hide horizontal scrollbar */
body {
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

