/**
 * Infostratos X Design Tokens
 * Modern Design System com Glassmorphism e Variáveis CSS
 * 
 * Estrutura:
 * - Cores (Light/Dark themes)
 * - Espaçamento
 * - Tipografia
 * - Bordas & Sombras
 * - Efeitos (Glassmorphism, Blur)
 * - Animações & Transições
 * - Z-Index Layers
 */

/* =============================================
   CORE THEME TOKENS
   ============================================= */

:root {
  /* Paleta Principal - Cores Primárias */
  --color-primary-hsl: 242 44% 37%;
  --color-primary: hsl(var(--color-primary-hsl));
  --color-primary-light: hsl(242 44% 45%);
  --color-primary-dark: hsl(242 44% 28%);
  --color-primary-glow: hsla(242, 44%, 37%, 0.3);

  /* Cores dos Agentes */
  --agent-strategos: #0D9488;
  --agent-creativo: #F97316;
  --agent-kritikos: #be123c;
  --agent-executus: #3B82F6;
  --agent-productus: #6D28D9;
  --agent-neuronaut: #9B59B6;
  --agent-vanguard: #2ECC71;
  --agent-polymath: #007bff;
  --agent-nexus: #6c757d;
  --agent-legal: #8b5cf6;
  --agent-hr: #ec4899;
  --agent-sales: #f59e0b;
  --agent-architect: #3498DB;
  --agent-content: #16A085;
  --agent-capital: #F1C40F;
  --agent-identitas: #E74C3C;
  --agent-momentum: #27AE60;
  --agent-communio: #3498DB;
  --agent-technicus: #2C3E50;
  --agent-auxilium: #3498DB;
  --agent-foedus: #9B59B6;
  --agent-divulgus: #be185d;
  --agent-didactus: #0891b2;
  --agent-analytikos: #65a30d;

  /* Estados Semânticos */
  --color-success: #15803D;
  --color-success-light: #86EFAC;
  --color-success-glow: rgba(21, 128, 61, 0.3);

  --color-danger: #B91C1C;
  --color-danger-light: #FCA5A5;
  --color-danger-glow: rgba(185, 28, 28, 0.3);

  --color-warning: #B45309;
  --color-warning-light: #FCD34D;
  --color-warning-glow: rgba(180, 83, 9, 0.3);

  --color-info: #0E7490;
  --color-info-light: #67E8F9;
  --color-info-glow: rgba(14, 116, 144, 0.3);
}

/* =============================================
   LIGHT THEME
   ============================================= */

[data-theme="light"] {
  /* Superfícies */
  --color-surface: #FFFFFF;
  --color-surface-secondary: #F9FAFB;
  --color-surface-tertiary: #F3F4F6;
  --color-surface-elevated: #FFFFFF;

  /* Backgrounds */
  --color-background: #F9FAFB;
  --color-background-alt: #F3F4F6;
  --color-background-glass: rgba(255, 255, 255, 0.85);

  /* Bordas */
  --color-border: #E5E7EB;
  --color-border-light: #F3F4F6;
  --color-border-focus: rgba(74, 71, 163, 0.4);

  /* Texto */
  --color-text-base: #111827;
  --color-text-primary: #1F2937;
  --color-text-secondary: #4B5563;
  --color-text-muted: #6B7280;
  --color-text-subtle: #9CA3AF;
  --color-text-inverse: #FFFFFF;

  /* Sombras */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(74, 71, 163, 0.3);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* =============================================
   DARK THEME
   ============================================= */

[data-theme="dark"] {
  /* Superfícies */
  --color-surface: #1F2937;
  --color-surface-secondary: #111827;
  --color-surface-tertiary: #0F172A;
  --color-surface-elevated: #374151;

  /* Backgrounds */
  --color-background: #0B0F19;
  --color-background-alt: #111827;
  --color-background-glass: rgba(15, 23, 42, 0.85);

  /* Bordas */
  --color-border: #374151;
  --color-border-light: #1F2937;
  --color-border-focus: rgba(139, 92, 246, 0.5);

  /* Texto */
  --color-text-base: #F9FAFB;
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #E5E7EB;
  --color-text-muted: #9CA3AF;
  --color-text-subtle: #6B7280;
  --color-text-inverse: #111827;

  /* Sombras */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.4);

  /* Glassmorphism */
  --glass-bg: rgba(31, 41, 55, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* =============================================
   SPACING & SIZING
   ============================================= */

:root {
  /* Espaçamento Base (escala de 4px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Layout */
  --header-height: 64px;
  --footer-height: 48px;
  --sidebar-width-mini: 80px;
  --sidebar-width-full: 280px;
  --workbench-sidebar-width: 340px;
  --max-content-width: 1400px;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
}

/* =============================================
   TYPOGRAPHY
   ============================================= */

:root {
  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Font Sizes (Mobile-first) */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
}

/* =============================================
   BORDER RADIUS
   ============================================= */

:root {
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-3xl: 2rem;     /* 32px */
  --radius-full: 9999px;

  /* Radius de componentes */
  --radius-button: var(--radius-lg);
  --radius-input: var(--radius-md);
  --radius-card: var(--radius-xl);
  --radius-modal: var(--radius-2xl);
  --radius-badge: var(--radius-full);
}

/* =============================================
   GLASSMORPHISM & BLUR EFFECTS
   ============================================= */

:root {
  /* Blur */
  --blur-sm: 4px;
  --blur-md: 8px;
  --blur-lg: 12px;
  --blur-xl: 16px;
  --blur-2xl: 24px;
  --blur-3xl: 40px;

  /* Backdrop */
  --backdrop-blur: blur(12px);
  --backdrop-blur-sm: blur(4px);
  --backdrop-blur-lg: blur(16px);
  --backdrop-saturate: saturate(180%);
  --backdrop-saturate-2: saturate(200%);

  /* Glass Classes (para uso direto) */
  --glass-surface: var(--backdrop-blur) var(--backdrop-saturate);
  --glass-card: var(--backdrop-blur-lg) var(--backdrop-saturate-2);
}

/* =============================================
   ANIMATIONS & TRANSITIONS
   ============================================= */

:root {
  /* Timing Functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Durations */
  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
  --duration-700: 700ms;
  --duration-1000: 1000ms;

  /* Transitions Predefinidas */
  --transition-base: all var(--duration-200) var(--ease-in-out);
  --transition-fast: all var(--duration-150) var(--ease-out);
  --transition-slow: all var(--duration-500) var(--ease-in-out);
  --transition-colors: color var(--duration-200), background-color var(--duration-200), border-color var(--duration-200);
  --transition-transform: transform var(--duration-200) var(--ease-in-out);
  --transition-shadow: box-shadow var(--duration-200) var(--ease-out);

  /* Keyframes (definidos em @keyframes no CSS) */
}

/* =============================================
   Z-INDEX LAYERS
   ============================================= */

:root {
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --z-max: 9999;
}

/* =============================================
   COMPONENT TOKENS
   ============================================= */

:root {
  /* Buttons */
  --btn-height: 40px;
  --btn-height-sm: 32px;
  --btn-height-lg: 48px;
  --btn-padding-x: var(--space-6);
  --btn-padding-y: var(--space-2);
  --btn-font-weight: var(--font-medium);
  --btn-border-radius: var(--radius-button);
  --btn-transition: var(--transition-base);

  /* Inputs */
  --input-height: 40px;
  --input-padding-x: var(--space-4);
  --input-padding-y: var(--space-2);
  --input-border-width: 1px;
  --input-border-radius: var(--radius-input);
  --input-focus-ring: var(--color-border-focus);

  /* Cards */
  --card-padding: var(--space-6);
  --card-border-radius: var(--radius-card);
  --card-border-width: 1px;
  --card-shadow: var(--shadow-md);
  --card-hover-shadow: var(--shadow-lg);
  --card-transition: var(--transition-base);

  /* Badges */
  --badge-padding-x: var(--space-3);
  --badge-padding-y: var(--space-1);
  --badge-font-size: var(--text-xs);
  --badge-font-weight: var(--font-medium);
  --badge-border-radius: var(--radius-badge);

  /* Avatar */
  --avatar-size-sm: 24px;
  --avatar-size-md: 32px;
  --avatar-size-lg: 40px;
  --avatar-size-xl: 56px;
  --avatar-border-radius: var(--radius-full);
}

/* =============================================
   AGENT COLOR MAP
   ============================================= */

:root {
  --agent-colors: (
    'strategos': var(--agent-strategos),
    'creativo': var(--agent-creativo),
    'kritikos': var(--agent-kritikos),
    'executus': var(--agent-executus),
    'productus': var(--agent-productus),
    'neuronaut': var(--agent-neuronaut),
    'vanguard': var(--agent-vanguard),
    'polymath': var(--agent-polymath),
    'nexus': var(--agent-nexus),
    'legal': var(--agent-legal),
    'hr': var(--agent-hr),
    'sales': var(--agent-sales),
    'architect': var(--agent-architect),
    'content': var(--agent-content),
    'capital': var(--agent-capital),
    'identitas': var(--agent-identitas),
    'momentum': var(--agent-momentum),
    'communio': var(--agent-communio),
    'technicus': var(--agent-technicus),
    'auxilium': var(--agent-auxilium),
    'foedus': var(--agent-foedus),
    'divulgus': var(--agent-divulgus),
    'didactus': var(--agent-didactus),
    'analytikos': var(--agent-analytikos)
  );
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-card);
  -webkit-backdrop-filter: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
}

/* Glow Effects */
.glow-primary {
  box-shadow: 0 0 20px var(--color-primary-glow);
}

.glow-success {
  box-shadow: 0 0 20px var(--color-success-glow);
}

.glow-danger {
  box-shadow: 0 0 20px var(--color-danger-glow);
}

/* Focus Ring */
.focus-ring {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Scrollbar Customization */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--color-background-alt);
  border-radius: var(--radius-full);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-text-muted);
  border-radius: var(--radius-full);
  opacity: 0.5;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/*
  Breakpoints (para uso em media queries):
  
  --breakpoint-sm: 640px   (small tablets)
  --breakpoint-md: 768px   (tablets)
  --breakpoint-lg: 1024px  (laptops)
  --breakpoint-xl: 1280px  (desktops)
  --breakpoint-2xl: 1536px (large desktops)
*/

/* =============================================
   MOTION PREFERENCES
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-75: 0ms;
    --duration-100: 0ms;
    --duration-150: 0ms;
    --duration-200: 0ms;
    --duration-300: 0ms;
    --duration-500: 0ms;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
