/* ══════════════════════════════════════════════════════════════════
   NEXUSSTOCK 360 - CORE DESIGN TOKENS & BASE CSS
   ══════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── LIGHT MODE (Default) ────────────────────────────────────────── */
:root {
  /* Background layers */
  --bg-base:        #f0f4f8;
  --bg-surface:     #ffffff;
  --bg-surface2:    #f8fafc;
  --bg-overlay:     rgba(255, 255, 255, 0.85);
  --bg-sidebar:     #ffffff;

  /* Borders */
  --border:         #e2e8f0;
  --border-hover:   #cbd5e1;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* Accent — Cobalt Blue */
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-light:   #dbeafe;
  --accent-glow:    rgba(37, 99, 235, 0.20);

  /* Status Colors */
  --success:        #16a34a;
  --success-bg:     #dcfce7;
  --warning:        #d97706;
  --warning-bg:     #fef3c7;
  --danger:         #dc2626;
  --danger-bg:      #fee2e2;
  --info:           #0284c7;
  --info-bg:        #e0f2fe;

  /* Dimensions */
  --sidebar-width:       260px;
  --sidebar-width-mini:  68px;
  --header-h:            64px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 10px 40px rgba(0,0,0,0.14);
  --shadow-accent:  0 4px 20px rgba(37,99,235,0.25);

  /* Charts */
  --chart-1: #2563eb;
  --chart-2: #16a34a;
  --chart-3: #ea580c;
  --chart-4: #9333ea;
  --chart-5: #dc2626;
  --chart-6: #0284c7;
}

/* ── DARK MODE TOKENS ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:        #060d1a;
  --bg-surface:     #0d1b2e;
  --bg-surface2:    #112240;
  --bg-overlay:     rgba(13, 27, 46, 0.90);
  --bg-sidebar:     #0a1628;

  --border:         rgba(255,255,255,0.08);
  --border-hover:   rgba(255,255,255,0.16);

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-inverse:   #0f172a;

  --accent:         #3b82f6;
  --accent-hover:   #60a5fa;
  --accent-light:   rgba(59,130,246,0.15);
  --accent-glow:    rgba(59,130,246,0.30);

  --success:        #4ade80;
  --success-bg:     rgba(74,222,128,0.12);
  --warning:        #fbbf24;
  --warning-bg:     rgba(251,191,36,0.12);
  --danger:         #f87171;
  --danger-bg:      rgba(248,113,113,0.12);
  --info:           #38bdf8;
  --info-bg:        rgba(56,189,248,0.12);

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.40);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.50);
  --shadow-lg:      0 10px 40px rgba(0,0,0,0.60);
  --shadow-accent:  0 4px 20px rgba(59,130,246,0.35);

  --chart-1: #1d4ed8;
  --chart-2: #2563eb;
  --chart-3: #3b82f6;
  --chart-4: #60a5fa;
  --chart-5: #93c5fd;
  --chart-6: #bfdbfe;
}

/* ── BASE STYLES & RESETS ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

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

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease;
}

::view-transition-old(root) {
  animation-name: nexus-fade-out;
}

::view-transition-new(root) {
  animation-name: nexus-fade-in;
}

@keyframes nexus-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(4px); }
}

@keyframes nexus-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── SCROLLBAR ───────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── UTILITY HELPERS ─────────────────────────────────────────────── */
.theme-transition {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-full { grid-column: 1 / -1; }

/* ── RESPONSIVE GRID & UTILITIES ─────────────────────────────────── */
@media (min-width: 640px) {
  .sm\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:col-span-1  { grid-column: span 1 / span 1; }
  .sm\:col-span-2  { grid-column: span 2 / span 2; }
  .sm\:col-span-full { grid-column: 1 / -1; }
  .sm\:flex-row    { flex-direction: row; }
}

@media (min-width: 768px) {
  .md\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-1  { grid-column: span 1 / span 1; }
  .md\:col-span-2  { grid-column: span 2 / span 2; }
  .md\:col-span-3  { grid-column: span 3 / span 3; }
  .md\:col-span-full { grid-column: 1 / -1; }
  .md\:flex-row    { flex-direction: row; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:col-span-1  { grid-column: span 1 / span 1; }
  .lg\:col-span-2  { grid-column: span 2 / span 2; }
  .lg\:col-span-3  { grid-column: span 3 / span 3; }
  .lg\:col-span-full { grid-column: 1 / -1; }
  .lg\:flex-row    { flex-direction: row; }
}

/* Visibility helpers */
@media (max-width: 767px) {
  .hidden-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .visible-mobile-only { display: none !important; }
}
@media (max-width: 1024px) {
  .hidden-tablet { display: none !important; }
}
@media (min-width: 1025px) {
  .visible-tablet-only { display: none !important; }
}

.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.hidden { display: none !important; }
.block { display: block; }

/* ── ANIMATIONS ──────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.25s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-pulse { animation: pulseGlow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
