/**
 * ManageMate Synapse - Design Tokens
 * Unified CSS variables for consistent theming
 * Microsoft 365 Admin Center inspired design system
 */

:root {
  /* ========================================
     BRAND COLORS
     ======================================== */
  
  /* Primary Brand Colors */
  --brand-primary: #0E6E64;
  --brand-primary-light: #1A8C80;
  --brand-primary-dark: #085048;
  --brand-primary-50: #f0fdfa;
  --brand-primary-100: #ccfbf1;
  --brand-primary-200: #99f6e4;
  --brand-primary-300: #5eead4;
  --brand-primary-400: #2dd4bf;
  --brand-primary-500: #14b8a6;
  --brand-primary-600: #0d9488;
  --brand-primary-700: #0f766e;
  --brand-primary-800: #115e59;
  --brand-primary-900: #134e4a;
  --brand-primary-950: #042f2e;

  /* Secondary Colors */
  --brand-secondary: #6366f1;
  --brand-secondary-light: #818cf8;
  --brand-secondary-dark: #4f46e5;

  /* Brand Green (Alias for Primary) */
  --brand-green: #0E6E64;
  --brand-green-light: #1A8C80;
  --brand-green-dark: #085048;

  /* ========================================
     SEMANTIC COLORS
     ======================================== */
  
  /* Status Colors */
  --color-success: #059669;
  --color-success-light: #10b981;
  --color-success-dark: #047857;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;

  --color-warning: #d97706;
  --color-warning-light: #f59e0b;
  --color-warning-dark: #b45309;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fcd34d;

  --color-error: #dc2626;
  --color-error-light: #ef4444;
  --color-error-dark: #b91c1c;
  --color-error-bg: #fef2f2;
  --color-error-border: #fca5a5;

  --color-info: #2563eb;
  --color-info-light: #3b82f6;
  --color-info-dark: #1d4ed8;
  --color-info-bg: #eff6ff;
  --color-info-border: #93c5fd;

  /* ========================================
     LIGHT THEME COLORS
     ======================================== */
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-quaternary: #94a3b8;
  --text-placeholder: #cbd5e1;
  --text-disabled: #e2e8f0;
  --text-inverse: #f8fafc;

  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-quaternary: #e2e8f0;
  --bg-overlay: rgba(15, 23, 42, 0.5);
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;

  /* Border Colors */
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  --border-tertiary: #94a3b8;
  --border-focus: var(--brand-primary);
  --border-error: var(--color-error);
  --border-success: var(--color-success);

  /* Interactive Colors */
  --interactive-primary: var(--brand-primary);
  --interactive-primary-hover: var(--brand-primary-light);
  --interactive-primary-active: var(--brand-primary-dark);
  --interactive-secondary: #f1f5f9;
  --interactive-secondary-hover: #e2e8f0;
  --interactive-secondary-active: #cbd5e1;

  /* ========================================
     MICROSOFT 365 ADMIN CENTER COLORS
     ======================================== */
  
  /* Admin-specific colors inspired by Microsoft 365 */
  --admin-primary: #0078d4;
  --admin-primary-hover: #106ebe;
  --admin-primary-active: #005a9e;
  
  --admin-neutral-10: #faf9f8;
  --admin-neutral-20: #f3f2f1;
  --admin-neutral-30: #edebe9;
  --admin-neutral-40: #e1dfdd;
  --admin-neutral-50: #d2d0ce;
  --admin-neutral-60: #c8c6c4;
  --admin-neutral-70: #a19f9d;
  --admin-neutral-80: #797775;
  --admin-neutral-90: #605e5c;
  --admin-neutral-100: #484644;
  --admin-neutral-110: #323130;
  --admin-neutral-120: #201f1e;

  /* Admin card backgrounds */
  --admin-card-bg: rgba(240, 246, 252, 0.9);
  --admin-card-border: rgba(0, 0, 0, 0.08);
  --admin-card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

  /* ========================================
     SHADOWS & EFFECTS
     ======================================== */
  
  /* Box Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Glass-morphism */
  --glass-bg: rgba(240, 246, 252, 0.9);
  --glass-border: rgba(240, 246, 252, 0.2);
  --glass-backdrop: blur(10px);

  /* ========================================
     SPACING & SIZING
     ======================================== */
  
  /* Spacing Scale */
  --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 */

  /* Border Radius - Enhanced rounded design */
  --radius-sm: 0.5rem;    /* 8px - Increased for more roundness */
  --radius-md: 0.75rem;   /* 12px - More rounded */
  --radius-lg: 1rem;      /* 16px - Noticeably rounded */
  --radius-xl: 1.25rem;   /* 20px - Very rounded */
  --radius-2xl: 1.5rem;   /* 24px - Extra rounded */
  --radius-3xl: 2rem;     /* 32px - Super rounded */
  --radius-full: 9999px;  /* Full circle */

  /* ========================================
     TYPOGRAPHY
     ======================================== */
  
  /* Font Families */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, monospace;

  /* Font Sizes */
  --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 */

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

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

  /* ========================================
     TRANSITIONS & ANIMATIONS
     ======================================== */
  
  --transition-fast: 150ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 300ms ease-out;
  
  --transition-colors: color 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out;
  --transition-transform: transform 150ms ease-out;
  --transition-all: all 150ms ease-out;

  /* ========================================
     Z-INDEX SCALE
     ======================================== */
  
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

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

.dark {
  /* Text Colors - Dark Theme */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-quaternary: #64748b;
  --text-placeholder: #475569;
  --text-disabled: #334155;
  --text-inverse: #0f172a;

  /* Background Colors - Dark Theme */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-quaternary: #475569;
  --bg-overlay: rgba(0, 0, 0, 0.8);
  --bg-card: #1e293b;
  --bg-elevated: #334155;

  /* Border Colors - Dark Theme */
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-tertiary: #64748b;
  --border-focus: var(--brand-primary-light);

  /* Interactive Colors - Dark Theme */
  --interactive-secondary: #334155;
  --interactive-secondary-hover: #475569;
  --interactive-secondary-active: #64748b;

  /* Admin Colors - Dark Theme */
  --admin-card-bg: rgba(30, 41, 59, 0.9);
  --admin-card-border: rgba(240, 246, 252, 0.1);
  --admin-card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);

  /* Glass-morphism - Dark Theme */
  --glass-bg: rgba(30, 41, 59, 0.9);
  --glass-border: rgba(240, 246, 252, 0.1);

  /* Microsoft 365 Dark Theme Adjustments */
  --admin-neutral-10: #201f1e;
  --admin-neutral-20: #323130;
  --admin-neutral-30: #484644;
  --admin-neutral-40: #605e5c;
  --admin-neutral-50: #797775;
  --admin-neutral-60: #a19f9d;
  --admin-neutral-70: #c8c6c4;
  --admin-neutral-80: #d2d0ce;
  --admin-neutral-90: #e1dfdd;
  --admin-neutral-100: #edebe9;
  --admin-neutral-110: #f3f2f1;
  --admin-neutral-120: #faf9f8;

  /* Status Colors - Enhanced for dark theme */
  --color-success-bg: rgba(5, 150, 105, 0.1);
  --color-warning-bg: rgba(217, 119, 6, 0.1);
  --color-error-bg: rgba(220, 38, 38, 0.1);
  --color-info-bg: rgba(37, 99, 235, 0.1);
}

/* ========================================
   SYSTEM THEME RESPECT
   ======================================== */

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    /* Apply dark theme variables when system prefers dark and no explicit theme is set */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --border-primary: #334155;
    --border-secondary: #475569;
  }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: none;
    --transition-normal: none;
    --transition-slow: none;
    --transition-colors: none;
    --transition-transform: none;
    --transition-all: none;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   HIGH CONTRAST SUPPORT
   ======================================== */

@media (prefers-contrast: high) {
  :root {
    --border-primary: #000000;
    --border-secondary: #000000;
    --text-primary: #000000;
    --text-secondary: #000000;
  }
  
  .dark {
    --border-primary: #ffffff;
    --border-secondary: #ffffff;
    --text-primary: #F0F6FC;
    --text-secondary: #ffffff;
  }
}

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

.theme-transition {
  transition: var(--transition-colors);
}

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

.admin-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-card-border);
  box-shadow: var(--admin-card-shadow);
  border-radius: var(--radius-lg);
}

.focus-ring {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.focus-ring:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}