/* ================================================================
   ORBIT DESIGN SYSTEM (HIGH-CRAFT PRODUCTION STANDARD)
   Typography: Plus Jakarta Sans (Display) + Inter (Interface) + JetBrains Mono (Data)
   Semantic Tokens, Glassmorphism, OLED Dark Mode, and Hub Sidebar Tokens
   ================================================================ */

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

:root {
  /* Typography Scale */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

  /* Spacing Scale (6px grid standard) */
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 30px;
  --space-6: 36px;
  --space-8: 48px;

  /* Transition Curves (High-responsiveness cubic-bezier) */
  --transition: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Radius Scale */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-card: 14px;
  --radius-bubble: 12px;
  --radius-pill: 9999px;

  /* Hub Navigation Dimensions */
  --sidebar-width-expanded: 230px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 52px;

  /* Interactive Control Heights */
  --control-height-sm: 30px;
  --control-height-md: 36px;
  --control-height-lg: 40px;
}

/* Light Theme Tokens */
[data-theme="light"] {
  --color-bg: #F8F9FB;
  --color-surface: #FFFFFF;
  --color-surface-card: #FFFFFF;
  --color-surface-subtle: #F3F4F7;
  --color-surface-alt: #EBECEF;
  --color-frosted: rgba(255, 255, 255, 0.88);
  
  --color-border: #E3E5EB;
  --color-border-subtle: #D2D5DE;
  --color-border-hover: #B5B9C6;
  --color-focus: #3E6AE1;

  --color-text-primary: #12141A;
  --color-text-body: #343844;
  --color-text-tertiary: #636775;
  --color-text-placeholder: #9498A6;

  /* Primary Interactive Colors */
  --color-primary: #2B59DE;
  --color-primary-hover: #1E46B8;
  --color-primary-subtle: rgba(43, 89, 222, 0.08);
  --color-primary-glow: rgba(43, 89, 222, 0.22);

  /* Semantic Status Colors */
  --color-success: #15803D;
  --color-success-text: #14532D;
  --color-success-bg: #EDFDF2;
  --color-success-border: #BBF7D0;

  --color-warning: #D97706;
  --color-warning-text: #92400E;
  --color-warning-bg: #FFFBEB;
  --color-warning-border: #FDE68A;

  --color-danger: #DC2626;
  --color-danger-text: #991B1B;
  --color-danger-bg: #FEF2F2;
  --color-danger-border: #FECACA;

  --color-info: #0284C7;

  /* Shadows */
  --shadow-subtle: 0 1px 3px rgba(18, 20, 26, 0.04), 0 4px 12px rgba(18, 20, 26, 0.03);
  --shadow-card: 0 2px 8px rgba(18, 20, 26, 0.05), 0 12px 28px rgba(18, 20, 26, 0.04);
  --shadow-modal: 0 20px 48px rgba(18, 20, 26, 0.16);

  /* WhatsApp Simulation Tokens */
  --wa-stage-bg: #EAE6DF;
  --wa-bubble-bg: #E7FFDB;
  --wa-bubble-border: #D2F4C4;
  --wa-bubble-text: #111B21;
  --wa-bubble-meta: #667781;
  --wa-btn-bg: #FFFFFF;
  --wa-btn-text: #007DFC;
  --wa-btn-hover: #F2F4F7;
  --wa-blue-tick: #53BDEB;
}

/* Dark Theme Tokens (OLED-optimised / Deep Carbon) */
[data-theme="dark"] {
  --color-bg: #0D0F12;
  --color-surface: #14171D;
  --color-surface-card: #181C24;
  --color-surface-subtle: #11141A;
  --color-surface-alt: #1F242F;
  --color-frosted: rgba(20, 23, 29, 0.88);

  --color-border: #232834;
  --color-border-subtle: #2C3342;
  --color-border-hover: #404B5E;
  --color-focus: #4F78F5;

  --color-text-primary: #F7F8FA;
  --color-text-body: #D4D8E2;
  --color-text-tertiary: #8C93A4;
  --color-text-placeholder: #5A6173;

  /* Primary Interactive Colors */
  --color-primary: #3E6AE1;
  --color-primary-hover: #5B84F7;
  --color-primary-subtle: rgba(62, 106, 225, 0.16);
  --color-primary-glow: rgba(62, 106, 225, 0.35);

  /* Semantic Status Colors (Dark mode adjusted) */
  --color-success: #22C55E;
  --color-success-text: #86EFAC;
  --color-success-bg: rgba(34, 197, 94, 0.14);
  --color-success-border: rgba(34, 197, 94, 0.32);

  --color-warning: #F59E0B;
  --color-warning-text: #FDE68A;
  --color-warning-bg: rgba(245, 158, 11, 0.14);
  --color-warning-border: rgba(245, 158, 11, 0.32);

  --color-danger: #EF4444;
  --color-danger-text: #FCA5A5;
  --color-danger-bg: rgba(239, 68, 68, 0.14);
  --color-danger-border: rgba(239, 68, 68, 0.32);

  --color-info: #38BDF8;

  /* Shadows */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4), 0 16px 36px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.6);

  /* WhatsApp Simulation Tokens (Authentic WhatsApp Dark Mode) */
  --wa-stage-bg: #0C1317;
  --wa-bubble-bg: #005C4B;
  --wa-bubble-border: #025142;
  --wa-bubble-text: #E9EDEF;
  --wa-bubble-meta: #8696A0;
  --wa-btn-bg: #1F2C34;
  --wa-btn-text: #00A884;
  --wa-btn-hover: #263843;
  --wa-blue-tick: #53BDEB;
}

/* Base Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-body);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color var(--transition), color var(--transition);
  overflow: hidden;
}

h1, h2, h3, h4, .brand-wordmark, .sidebar-title {
  font-family: var(--font-display);
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
}

/* Accessibility: Focus-Visible System-Wide */
:focus {
  outline: none;
}

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

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

/* Utility Animations */
.spin {
  animation: orbitSpin 1s linear infinite;
}

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

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}
