@import '@bytelyst/design-tokens/generated/tokens.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: light;
  color: #111827;
  background-color: #f4f7fb;
  --background: #f4f7fb;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-elevated: #fcfdff;
  --input: #ffffff;
  --muted: #e8edf5;
  --muted-foreground: #64748b;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.18);
  --primary: #0f172a;
  --primary-foreground: #f8fafc;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --ring: #2563eb;
  --ring-soft: rgba(37, 99, 235, 0.18);
  --destructive: #dc2626;
  --sidebar: rgba(255, 255, 255, 0.88);
  --sidebar-active: rgba(37, 99, 235, 0.12);
  --header: rgba(255, 255, 255, 0.88);
  --card-shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
  --hero-gradient: linear-gradient(135deg, #eff6ff 0%, #ffffff 45%, #eefbf5 100%);
  --bl-accent: var(--accent);
  --bl-accent-muted: var(--accent-soft);
  --bl-accent-foreground: var(--primary-foreground);
  --bl-bg-canvas: var(--background);
  --bl-bg-elevated: var(--card-elevated);
  --bl-surface-card: var(--card);
  --bl-surface-muted: var(--muted);
  --bl-text-primary: var(--foreground);
  --bl-text-secondary: var(--muted-foreground);
  --bl-text-tertiary: color-mix(in oklab, var(--muted-foreground) 76%, var(--background));
  --bl-border: var(--border);
  --bl-success: var(--ml-success);
  --bl-success-muted: color-mix(in oklab, var(--bl-success) 12%, var(--background));
  --bl-warning: var(--ml-warning);
  --bl-warning-muted: color-mix(in oklab, var(--bl-warning) 14%, var(--background));
  --bl-danger: var(--destructive);
  --bl-danger-muted: color-mix(in oklab, var(--bl-danger) 12%, var(--background));
  --bl-info: var(--accent);
  --bl-info-muted: var(--accent-soft);
  --bl-focus-ring: var(--ring);
  --bl-focus-ring-muted: var(--ring-soft);
  --bl-radius-control: 0.5rem;
  --bl-radius-surface: 0.75rem;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.dark {
  color-scheme: dark;
  color: #e5edf7;
  background-color: #0b1220;
  --background: #0b1220;
  --foreground: #e5edf7;
  --card: #101827;
  --card-elevated: #0f172a;
  --input: #0d1524;
  --muted: #162133;
  --muted-foreground: #94a3b8;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --primary: #f8fafc;
  --primary-foreground: #0f172a;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --ring: #60a5fa;
  --ring-soft: rgba(96, 165, 250, 0.2);
  --destructive: #f87171;
  --sidebar: rgba(10, 15, 26, 0.92);
  --sidebar-active: rgba(96, 165, 250, 0.16);
  --header: rgba(10, 15, 26, 0.78);
  --card-shadow: 0 28px 90px rgba(2, 6, 23, 0.45);
  --hero-gradient: linear-gradient(135deg, rgba(37, 99, 235, 0.10) 0%, rgba(15, 23, 42, 0.94) 55%, rgba(34, 197, 94, 0.08) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
}

#root {
  width: 100%;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.pulse-green {
  animation: pulse 2s infinite ease-in-out;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.dashboard-shell {
  display: flex;
  min-height: 100vh;
  background: var(--background);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dashboard-main {
  margin-left: 72px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.dashboard-content-row {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.dashboard-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 32px;
  min-width: 0;
}

.dashboard-right-panel {
  width: 308px;
  min-width: 308px;
  max-width: 308px;
}

.trading-sidebar {
  width: 72px;
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 20px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
}

.page-section-grid {
  display: grid;
  gap: 24px;
}

.tab-strip {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-button {
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-family: inherit;
}

.tab-button:hover {
  color: var(--foreground);
}

.tab-button[data-active="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.hero-surface {
  background: var(--hero-gradient);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--card-shadow);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 4px;
}

.section-description {
  font-size: 13px;
  color: var(--muted-foreground);
}

.pill-group {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-elevated);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 700;
}

.stat-chip[data-tone="success"] {
  color: #16a34a;
}

.stat-chip[data-tone="danger"] {
  color: #dc2626;
}

.trading-sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
  gap: 2px;
}

.trading-sidebar-link {
  width: 100%;
}

@media (max-width: 1023px) {
  .dashboard-shell {
    padding-bottom: 68px;
  }

  .dashboard-main {
    margin-left: 0;
    min-width: 0;
  }

  .dashboard-content-row {
    min-width: 0;
  }

  .dashboard-content {
    padding: 16px 14px 24px;
  }

  .dashboard-right-panel {
    display: none !important;
  }

  .trading-sidebar {
    width: 100%;
    min-height: 64px;
    height: 64px;
    top: auto;
    right: 0;
    bottom: 0;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    padding: 0 8px;
    border-right: 0;
    border-top: 1px solid var(--border);
    overflow-x: auto;
  }

  .trading-sidebar-logo,
  .trading-sidebar-avatar {
    display: none !important;
  }

  .trading-sidebar-nav {
    flex: 0 1 auto;
    flex-direction: row;
    width: auto;
    max-width: 100%;
    align-items: stretch;
    gap: 0;
  }

  .trading-sidebar-link {
    width: 68px;
    min-width: 68px;
  }
}
