/* =====================================================================
   OMNICOPIER NEXUS — PREMIUM TRADING COMMAND CENTER DESIGN SYSTEM
   Modern Algorithmic Multi-Broker Trading Platform
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700;800&display=swap');

:root {
  /* Surface & Background Architecture (Deep Navy & Graphite) */
  --oc-bg-base: #06080f;
  --oc-bg-sidebar: #090d16;
  --oc-bg-header: rgba(9, 13, 22, 0.88);
  --oc-bg-surface-1: #0d121f;
  --oc-bg-surface-2: #121826;
  --oc-bg-surface-3: #182235;
  --oc-bg-input: #080c14;
  --oc-bg-glass: rgba(13, 18, 31, 0.78);

  /* Precise Border System */
  --oc-border-subtle: rgba(38, 52, 78, 0.45);
  --oc-border-medium: rgba(56, 75, 110, 0.65);
  --oc-border-focus: #06b6d4;
  --oc-border-glow: rgba(6, 182, 212, 0.28);

  /* Typography Colors */
  --oc-text-primary: #f8fafc;
  --oc-text-secondary: #94a3b8;
  --oc-text-muted: #64748b;
  --oc-text-dim: #475569;

  /* Accent Hierarchy (Restrained & Calm) */
  --oc-cyan: #06b6d4;
  --oc-cyan-bright: #00f0ff;
  --oc-cyan-light: rgba(6, 182, 212, 0.12);
  --oc-cyan-border: rgba(6, 182, 212, 0.35);

  --oc-indigo: #6366f1;
  --oc-indigo-light: rgba(99, 102, 241, 0.14);
  --oc-indigo-border: rgba(99, 102, 241, 0.35);

  --oc-violet: #8b5cf6;
  --oc-emerald: #10b981;
  --oc-emerald-light: rgba(16, 185, 129, 0.12);
  --oc-amber: #f59e0b;
  --oc-amber-light: rgba(245, 158, 11, 0.12);
  --oc-danger: #ef4444;
  --oc-danger-light: rgba(239, 68, 68, 0.12);

  /* Typography Fonts */
  --oc-font-heading: 'Space Grotesk', -apple-system, sans-serif;
  --oc-font-body: 'Inter', -apple-system, sans-serif;
  --oc-font-mono: 'JetBrains Mono', monospace;

  /* Geometric Radius Tokens */
  --oc-radius-sm: 8px;
  --oc-radius-md: 12px;
  --oc-radius-lg: 16px;
  --oc-radius-xl: 20px;

  /* Shadows & Depth */
  --oc-shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --oc-shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.03);
  --oc-shadow-glow: 0 0 25px -4px rgba(6, 182, 212, 0.18);
}

/* =====================================================================
   GLOBAL BASE STYLING
   ===================================================================== */
html {
  background-color: var(--oc-bg-base);
  color-scheme: dark;
}

body {
  font-family: var(--oc-font-body);
  background-color: var(--oc-bg-base);
  color: var(--oc-text-primary);
  letter-spacing: -0.012em;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-heading {
  font-family: var(--oc-font-heading);
  letter-spacing: -0.025em;
}

.font-mono {
  font-family: var(--oc-font-mono);
  letter-spacing: -0.02em;
}

/* App Layout & Sidebar Shell */
#main-sidebar {
  width: 280px;
  background-color: var(--oc-bg-sidebar);
  border-right: 1px solid var(--oc-border-subtle);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#main-content-wrapper {
  margin-left: 280px;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 100vh;
}

/* Collapsed Sidebar */
#main-sidebar.collapsed {
  width: 76px !important;
}

body.sidebar-is-collapsed #main-content-wrapper {
  margin-left: 76px !important;
}

#main-sidebar.collapsed .sidebar-text,
#main-sidebar.collapsed .nav-group-title,
#main-sidebar.collapsed .sidebar-profile-text,
#main-sidebar.collapsed .workspace-selector-text {
  display: none !important;
}

#main-sidebar.collapsed .sidebar-link {
  justify-content: center;
  padding: 0.75rem 0.5rem;
  margin: 0.15rem 0.4rem;
}

#main-sidebar.collapsed .sidebar-link.active::before {
  left: 0;
  width: 3px;
}

/* Responsive Mobile Sidebar */
@media (max-width: 1024px) {
  #main-sidebar {
    transform: translateX(-100%);
    width: 280px !important;
  }
  #main-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  }
  #main-content-wrapper {
    margin-left: 0 !important;
  }
}

/* Top Command Bar */
#top-header {
  height: 72px;
  background-color: var(--oc-bg-header);
  border-bottom: 1px solid var(--oc-border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* =====================================================================
   SIDEBAR COMPONENT STYLES
   ===================================================================== */
.nav-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--oc-text-muted);
  padding: 0.85rem 1rem 0.35rem 1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.625rem 0.875rem;
  margin: 0.125rem 0.75rem;
  border-radius: var(--oc-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--oc-text-secondary);
  transition: all 0.16s ease;
  position: relative;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-link:hover {
  color: #ffffff;
  background-color: rgba(30, 41, 59, 0.5);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.22);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background-color: var(--oc-cyan);
  box-shadow: 0 0 10px var(--oc-cyan);
}

.sidebar-link svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--oc-text-muted);
  transition: color 0.16s ease, transform 0.16s ease;
}

.sidebar-link:hover svg {
  color: #ffffff;
  transform: scale(1.05);
}

.sidebar-link.active svg {
  color: var(--oc-cyan);
}

/* =====================================================================
   CARD HIERARCHY (3 LEVELS)
   ===================================================================== */
/* Level 1: Primary Workspace Surface */
.oc-card-l1 {
  background-color: var(--oc-bg-surface-1);
  border: 1px solid var(--oc-border-subtle);
  border-radius: var(--oc-radius-lg);
  box-shadow: var(--oc-shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.oc-card-l1:hover {
  border-color: var(--oc-border-medium);
}

/* Level 2: Secondary Elevation */
.oc-card-l2 {
  background-color: var(--oc-bg-surface-2);
  border: 1px solid var(--oc-border-subtle);
  border-radius: var(--oc-radius-md);
  transition: all 0.18s ease;
}

.oc-card-l2:hover {
  border-color: var(--oc-border-medium);
  background-color: #151e30;
}

/* Level 3: Compact Data Tile */
.oc-card-l3 {
  background-color: var(--oc-bg-input);
  border: 1px solid rgba(38, 52, 78, 0.35);
  border-radius: var(--oc-radius-sm);
}

/* Glass Card Support */
.glass-card {
  background: var(--oc-bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--oc-border-subtle);
  border-radius: var(--oc-radius-lg);
}

/* =====================================================================
   BUTTON HIERARCHY
   ===================================================================== */
.btn-nexus-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--oc-radius-md);
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px 0 rgba(6, 182, 212, 0.3);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  text-decoration: none;
}

.btn-nexus-primary:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
  box-shadow: 0 6px 20px 0 rgba(6, 182, 212, 0.42);
  transform: translateY(-1px);
}

.btn-nexus-primary:active {
  transform: translateY(0);
}

.btn-nexus-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--oc-radius-md);
  background-color: var(--oc-bg-surface-2);
  color: var(--oc-text-primary);
  border: 1px solid var(--oc-border-subtle);
  transition: all 0.18s ease;
  cursor: pointer;
}

.btn-nexus-secondary:hover {
  background-color: var(--oc-bg-surface-3);
  border-color: var(--oc-border-medium);
  color: #ffffff;
}

.btn-nexus-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--oc-radius-md);
  background: transparent;
  color: var(--oc-text-secondary);
  border: 1px solid transparent;
  transition: all 0.16s ease;
  cursor: pointer;
}

.btn-nexus-ghost:hover {
  background: rgba(30, 41, 59, 0.4);
  color: #ffffff;
  border-color: var(--oc-border-subtle);
}

.btn-nexus-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--oc-radius-md);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  transition: all 0.18s ease;
  cursor: pointer;
}

.btn-nexus-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #ffffff;
  border-color: #ef4444;
}

/* =====================================================================
   STRATEGY STUDIO LEFT INTERNAL NAV & WORKSPACE
   ===================================================================== */
.strat-internal-nav {
  width: 260px;
  min-width: 260px;
  background-color: var(--oc-bg-surface-1);
  border: 1px solid var(--oc-border-subtle);
  border-radius: var(--oc-radius-lg);
  padding: 1rem 0.75rem;
  align-self: flex-start;
  position: sticky;
  top: 88px;
}

.strat-internal-group-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--oc-text-muted);
  padding: 0.65rem 0.75rem 0.25rem 0.75rem;
}

.strat-tab-btn {
  display: flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  width: 100% !important;
  padding: 0.55rem 0.75rem !important;
  border-radius: var(--oc-radius-md) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--oc-text-secondary) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  transition: all 0.16s ease !important;
  text-align: left !important;
  cursor: pointer !important;
}

.strat-tab-btn:hover {
  color: #ffffff !important;
  background: rgba(30, 41, 59, 0.45) !important;
}

.strat-tab-btn.active {
  color: #ffffff !important;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14) 0%, rgba(99, 102, 241, 0.08) 100%) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 15px -3px rgba(6, 182, 212, 0.2) !important;
}

.strat-tab-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  color: var(--oc-text-muted);
  transition: color 0.16s ease;
}

.strat-tab-btn.active svg {
  color: var(--oc-cyan);
}

/* =====================================================================
   SAFETY RAIL STYLING
   ===================================================================== */
.safety-rail-strip {
  background: linear-gradient(90deg, rgba(9, 13, 22, 0.95) 0%, rgba(13, 18, 31, 0.95) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding: 0.45rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

/* =====================================================================
   MODAL DIALOGS
   ===================================================================== */
.nexus-modal-card {
  background-color: var(--oc-bg-surface-1);
  border: 1px solid var(--oc-border-medium);
  border-radius: var(--oc-radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 30px rgba(6, 182, 212, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* =====================================================================
   COMMAND PALETTE (CTRL/CMD + K)
   ===================================================================== */
#command-palette-modal {
  transition: opacity 0.18s ease;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--oc-radius-md);
  color: var(--oc-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cmd-item:hover, .cmd-item.selected {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14) 0%, rgba(99, 102, 241, 0.08) 100%);
  color: #ffffff;
  border: 1px solid rgba(6, 182, 212, 0.28);
}

/* =====================================================================
   ANIMATIONS & TRANSITIONS
   ===================================================================== */
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-animate {
  animation: fadeInSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Custom Minimal Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

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