/**
 * MSM-Group Design System Foundation
 *
 * A comprehensive design token system for premium UI consistency
 * Includes: Colors, Typography, Spacing, Shadows, Animations, Breakpoints
 *
 * Usage: All components should reference these CSS custom properties
 * Benefits: Consistent theming, easy updates, maintainable codebase
 */

:root {
  /* ========================================
     COLOR SYSTEM
     Primary: Blue gradient (brand identity)
     Secondary: Complementary colors
     Semantic: Success, warning, error states
     Neutral: Grays for text and backgrounds
     ======================================== */

  /* Primary Brand Colors */
  --msm-color-primary-50: #e6f7fb;
  --msm-color-primary-100: #b3e7f3;
  --msm-color-primary-200: #80d7eb;
  --msm-color-primary-300: #4dc7e3;
  --msm-color-primary-400: #1ab7db;
  --msm-color-primary-500: #00b4d9; /* Main brand color */
  --msm-color-primary-600: #009fbe;
  --msm-color-primary-700: #007a93;
  --msm-color-primary-800: #005568;
  --msm-color-primary-900: #00303d;

  /* Secondary Brand Colors */
  --msm-color-secondary-50: #e8eff5;
  --msm-color-secondary-100: #bdd2e3;
  --msm-color-secondary-200: #92b5d1;
  --msm-color-secondary-300: #6798bf;
  --msm-color-secondary-400: #3c7bad;
  --msm-color-secondary-500: #1d4e89; /* Secondary brand color */
  --msm-color-secondary-600: #1a467a;
  --msm-color-secondary-700: #153767;
  --msm-color-secondary-800: #102854;
  --msm-color-secondary-900: #0b1941;

  /* Semantic Colors - Success */
  --msm-color-success-50: #e8f5e9;
  --msm-color-success-100: #c8e6c9;
  --msm-color-success-500: #4caf50;
  --msm-color-success-700: #388e3c;
  --msm-color-success-900: #1b5e20;

  /* Semantic Colors - Warning */
  --msm-color-warning-50: #fff8e1;
  --msm-color-warning-100: #ffecb3;
  --msm-color-warning-500: #ffc107;
  --msm-color-warning-700: #f57c00;
  --msm-color-warning-900: #e65100;

  /* Semantic Colors - Error */
  --msm-color-error-50: #ffebee;
  --msm-color-error-100: #ffcdd2;
  --msm-color-error-500: #f44336;
  --msm-color-error-700: #d32f2f;
  --msm-color-error-900: #b71c1c;

  /* Semantic Colors - Info */
  --msm-color-info-50: #e3f2fd;
  --msm-color-info-100: #bbdefb;
  --msm-color-info-500: #2196f3;
  --msm-color-info-700: #1976d2;
  --msm-color-info-900: #0d47a1;

  /* Neutral Colors - Grays */
  --msm-color-neutral-50: #fafafa;
  --msm-color-neutral-100: #f5f5f5;
  --msm-color-neutral-200: #eeeeee;
  --msm-color-neutral-300: #e0e0e0;
  --msm-color-neutral-400: #bdbdbd;
  --msm-color-neutral-500: #9e9e9e;
  --msm-color-neutral-600: #757575;
  --msm-color-neutral-700: #616161;
  --msm-color-neutral-800: #424242;
  --msm-color-neutral-900: #212121;

  /* Surface Colors */
  --msm-color-surface-light: #ffffff;
  --msm-color-surface-dark: var(--msm-color-neutral-900);
  --msm-color-surface-elevated: #ffffff;
  --msm-color-surface-overlay: rgba(0, 0, 0, 0.5);

  /* Text Colors */
  --msm-color-text-primary: var(--msm-color-neutral-900);
  --msm-color-text-secondary: var(--msm-color-neutral-700);
  --msm-color-text-disabled: var(--msm-color-neutral-400);
  --msm-color-text-inverse: #ffffff;

  /* Background Colors */
  --msm-color-bg-primary: #ffffff;
  --msm-color-bg-secondary: var(--msm-color-neutral-50);
  --msm-color-bg-tertiary: var(--msm-color-neutral-100);

  /* Border Colors */
  --msm-color-border-light: var(--msm-color-neutral-200);
  --msm-color-border-medium: var(--msm-color-neutral-300);
  --msm-color-border-dark: var(--msm-color-neutral-400);

  /* Gradient Definitions */
  --msm-gradient-primary: linear-gradient(135deg, var(--msm-color-primary-500) 0%, var(--msm-color-secondary-500) 100%);
  --msm-gradient-primary-hover: linear-gradient(135deg, var(--msm-color-primary-600) 0%, var(--msm-color-secondary-600) 100%);
  --msm-gradient-subtle: linear-gradient(135deg, rgba(0, 180, 217, 0.1) 0%, rgba(29, 78, 137, 0.1) 100%);
  --msm-gradient-overlay: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);

  /* ========================================
     TYPOGRAPHY SYSTEM
     Using modular scale (1.25 ratio)
     Base: 16px (1rem)
     ======================================== */

  /* Font Families */
  --msm-font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --msm-font-secondary: Georgia, "Times New Roman", serif;
  --msm-font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;

  /* Font Sizes - Modular Scale (1.25 ratio) */
  --msm-font-size-xs: 0.64rem;    /* 10.24px */
  --msm-font-size-sm: 0.8rem;     /* 12.8px */
  --msm-font-size-base: 1rem;     /* 16px */
  --msm-font-size-md: 1.125rem;   /* 18px */
  --msm-font-size-lg: 1.25rem;    /* 20px */
  --msm-font-size-xl: 1.563rem;   /* 25px */
  --msm-font-size-2xl: 1.953rem;  /* 31.25px */
  --msm-font-size-3xl: 2.441rem;  /* 39.06px */
  --msm-font-size-4xl: 3.052rem;  /* 48.83px */
  --msm-font-size-5xl: 3.815rem;  /* 61.04px */

  /* Font Weights */
  --msm-font-weight-light: 300;
  --msm-font-weight-regular: 400;
  --msm-font-weight-medium: 500;
  --msm-font-weight-semibold: 600;
  --msm-font-weight-bold: 700;
  --msm-font-weight-extrabold: 800;

  /* Line Heights */
  --msm-line-height-tight: 1.25;
  --msm-line-height-snug: 1.375;
  --msm-line-height-normal: 1.5;
  --msm-line-height-relaxed: 1.625;
  --msm-line-height-loose: 2;

  /* Letter Spacing */
  --msm-letter-spacing-tight: -0.025em;
  --msm-letter-spacing-normal: 0;
  --msm-letter-spacing-wide: 0.025em;
  --msm-letter-spacing-wider: 0.05em;
  --msm-letter-spacing-widest: 0.1em;

  /* ========================================
     SPACING SYSTEM
     8-point grid system for consistent spacing
     ======================================== */

  --msm-space-0: 0;
  --msm-space-1: 0.25rem;   /* 4px */
  --msm-space-2: 0.5rem;    /* 8px */
  --msm-space-3: 0.75rem;   /* 12px */
  --msm-space-4: 1rem;      /* 16px */
  --msm-space-5: 1.25rem;   /* 20px */
  --msm-space-6: 1.5rem;    /* 24px */
  --msm-space-8: 2rem;      /* 32px */
  --msm-space-10: 2.5rem;   /* 40px */
  --msm-space-12: 3rem;     /* 48px */
  --msm-space-16: 4rem;     /* 64px */
  --msm-space-20: 5rem;     /* 80px */
  --msm-space-24: 6rem;     /* 96px */
  --msm-space-32: 8rem;     /* 128px */
  --msm-space-40: 10rem;    /* 160px */
  --msm-space-48: 12rem;    /* 192px */

  /* Semantic Spacing (component-specific) */
  --msm-space-section: var(--msm-space-20);
  --msm-space-container: var(--msm-space-16);
  --msm-space-card: var(--msm-space-6);
  --msm-space-input: var(--msm-space-4);
  --msm-space-button: var(--msm-space-3) var(--msm-space-6);

  /* ========================================
     ELEVATION SYSTEM (Shadows)
     Material Design inspired shadow levels
     ======================================== */

  --msm-shadow-none: none;
  --msm-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --msm-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --msm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --msm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --msm-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --msm-shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --msm-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  /* Colored Shadows for Premium Effect */
  --msm-shadow-primary: 0 10px 25px -5px rgba(0, 180, 217, 0.3);
  --msm-shadow-secondary: 0 10px 25px -5px rgba(29, 78, 137, 0.3);

  /* ========================================
     ANIMATION SYSTEM
     Consistent timing and easing functions
     ======================================== */

  /* Animation Durations */
  --msm-duration-instant: 100ms;
  --msm-duration-fast: 200ms;
  --msm-duration-normal: 300ms;
  --msm-duration-slow: 500ms;
  --msm-duration-slower: 700ms;

  /* Easing Functions */
  --msm-ease-linear: linear;
  --msm-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --msm-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --msm-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* Premium Easing (more sophisticated) */
  --msm-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --msm-ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --msm-ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Spring Physics (iOS-like) */
  --msm-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --msm-ease-spring-smooth: cubic-bezier(0.5, 1.5, 0.8, 1);

  /* ========================================
     BORDER RADIUS SYSTEM
     Consistent rounded corners
     ======================================== */

  --msm-radius-none: 0;
  --msm-radius-sm: 0.25rem;   /* 4px */
  --msm-radius-md: 0.5rem;    /* 8px */
  --msm-radius-lg: 0.75rem;   /* 12px */
  --msm-radius-xl: 1rem;      /* 16px */
  --msm-radius-2xl: 1.5rem;   /* 24px */
  --msm-radius-full: 9999px;  /* Fully rounded (pills) */

  /* Component-specific radius */
  --msm-radius-button: var(--msm-radius-lg);
  --msm-radius-card: var(--msm-radius-xl);
  --msm-radius-input: var(--msm-radius-md);
  --msm-radius-modal: var(--msm-radius-2xl);

  /* ========================================
     Z-INDEX SCALE
     Layering system for stacking contexts
     ======================================== */

  --msm-z-index-dropdown: 1000;
  --msm-z-index-sticky: 1020;
  --msm-z-index-fixed: 1030;
  --msm-z-index-modal-backdrop: 1040;
  --msm-z-index-modal: 1050;
  --msm-z-index-popover: 1060;
  --msm-z-index-tooltip: 1070;
  --msm-z-index-toast: 1080;

  /* ========================================
     BREAKPOINT SYSTEM
     Responsive design breakpoints
     ======================================== */

  --msm-breakpoint-xs: 0;
  --msm-breakpoint-sm: 576px;
  --msm-breakpoint-md: 768px;
  --msm-breakpoint-lg: 992px;
  --msm-breakpoint-xl: 1200px;
  --msm-breakpoint-2xl: 1400px;

  /* Container Max Widths */
  --msm-container-sm: 540px;
  --msm-container-md: 720px;
  --msm-container-lg: 960px;
  --msm-container-xl: 1140px;
  --msm-container-2xl: 1320px;

  /* ========================================
     COMPONENT SIZING
     Standard sizes for buttons, inputs, etc.
     ======================================== */

  /* Button Sizes */
  --msm-button-height-sm: 2rem;     /* 32px */
  --msm-button-height-md: 2.5rem;   /* 40px */
  --msm-button-height-lg: 3rem;     /* 48px */
  --msm-button-height-xl: 3.5rem;   /* 56px */

  /* Input Sizes */
  --msm-input-height-sm: 2rem;      /* 32px */
  --msm-input-height-md: 2.5rem;    /* 40px */
  --msm-input-height-lg: 3rem;      /* 48px */

  /* Icon Sizes */
  --msm-icon-size-xs: 1rem;         /* 16px */
  --msm-icon-size-sm: 1.25rem;      /* 20px */
  --msm-icon-size-md: 1.5rem;       /* 24px */
  --msm-icon-size-lg: 2rem;         /* 32px */
  --msm-icon-size-xl: 2.5rem;       /* 40px */

  /* ========================================
     ACCESSIBILITY
     Focus states and accessibility tokens
     ======================================== */

  --msm-focus-ring-width: 3px;
  --msm-focus-ring-color: var(--msm-color-primary-500);
  --msm-focus-ring-offset: 2px;
  --msm-focus-ring: 0 0 0 var(--msm-focus-ring-width) var(--msm-focus-ring-color);
  --msm-focus-ring-offset-shadow: 0 0 0 var(--msm-focus-ring-offset) var(--msm-color-surface-light);

  /* Touch Target Minimum (WCAG 2.1) */
  --msm-touch-target-min: 44px;

  /* ========================================
     PREMIUM EFFECTS
     Advanced visual effects for premium feel
     ======================================== */

  /* Glass Morphism */
  --msm-glass-bg: rgba(255, 255, 255, 0.7);
  --msm-glass-blur: blur(10px);
  --msm-glass-border: rgba(255, 255, 255, 0.18);

  /* Shimmer Effect (loading states) */
  --msm-shimmer-from: rgba(255, 255, 255, 0);
  --msm-shimmer-via: rgba(255, 255, 255, 0.4);
  --msm-shimmer-to: rgba(255, 255, 255, 0);

  /* Glow Effects */
  --msm-glow-primary: 0 0 20px rgba(0, 180, 217, 0.6);
  --msm-glow-secondary: 0 0 20px rgba(29, 78, 137, 0.6);

  /* ========================================
     FORM STATES
     Validation and interaction states
     ======================================== */

  --msm-input-border-default: var(--msm-color-border-medium);
  --msm-input-border-hover: var(--msm-color-primary-400);
  --msm-input-border-focus: var(--msm-color-primary-500);
  --msm-input-border-error: var(--msm-color-error-500);
  --msm-input-border-success: var(--msm-color-success-500);
  --msm-input-border-disabled: var(--msm-color-border-light);

  --msm-input-bg-default: var(--msm-color-surface-light);
  --msm-input-bg-hover: var(--msm-color-neutral-50);
  --msm-input-bg-focus: var(--msm-color-surface-light);
  --msm-input-bg-disabled: var(--msm-color-neutral-100);

  /* ========================================
     TRANSITIONS
     Common transition properties
     ======================================== */

  --msm-transition-default: all var(--msm-duration-normal) var(--msm-ease-out);
  --msm-transition-fast: all var(--msm-duration-fast) var(--msm-ease-out);
  --msm-transition-slow: all var(--msm-duration-slow) var(--msm-ease-out);
  --msm-transition-colors: background-color var(--msm-duration-normal) var(--msm-ease-out),
                           color var(--msm-duration-normal) var(--msm-ease-out),
                           border-color var(--msm-duration-normal) var(--msm-ease-out);
  --msm-transition-transform: transform var(--msm-duration-normal) var(--msm-ease-spring);
  --msm-transition-shadow: box-shadow var(--msm-duration-normal) var(--msm-ease-out);
}

/* ========================================
   RESPONSIVE BREAKPOINT ADJUSTMENTS
   Adjust design tokens for different screen sizes
   ======================================== */

/* Tablet and above */
@media (min-width: 768px) {
  :root {
    /* Increase spacing on larger screens */
    --msm-space-section: var(--msm-space-24);
    --msm-space-container: var(--msm-space-20);

    /* Larger typography on bigger screens */
    --msm-font-size-4xl: 3.5rem;
    --msm-font-size-5xl: 4.5rem;
  }
}

/* Desktop and above */
@media (min-width: 1200px) {
  :root {
    --msm-space-section: var(--msm-space-32);
    --msm-font-size-5xl: 5rem;
  }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   Uncomment to enable dark mode theming
   ======================================== */

/*
@media (prefers-color-scheme: dark) {
  :root {
    --msm-color-surface-light: var(--msm-color-neutral-900);
    --msm-color-surface-dark: var(--msm-color-neutral-100);
    --msm-color-text-primary: var(--msm-color-neutral-100);
    --msm-color-text-secondary: var(--msm-color-neutral-300);
    --msm-color-bg-primary: var(--msm-color-neutral-900);
    --msm-color-bg-secondary: var(--msm-color-neutral-800);
    --msm-color-bg-tertiary: var(--msm-color-neutral-700);
    --msm-color-border-light: var(--msm-color-neutral-700);
    --msm-color-border-medium: var(--msm-color-neutral-600);
    --msm-color-border-dark: var(--msm-color-neutral-500);
  }
}
*/

/* ========================================
   UTILITY CLASSES
   Common utility classes using design tokens
   ======================================== */

/* Text Utilities */
.msm-text-primary { color: var(--msm-color-text-primary); }
.msm-text-secondary { color: var(--msm-color-text-secondary); }
.msm-text-inverse { color: var(--msm-color-text-inverse); }

/* Background Utilities */
.msm-bg-primary { background-color: var(--msm-color-bg-primary); }
.msm-bg-secondary { background-color: var(--msm-color-bg-secondary); }
.msm-bg-gradient { background: var(--msm-gradient-primary); }

/* Shadow Utilities */
.msm-shadow-sm { box-shadow: var(--msm-shadow-sm); }
.msm-shadow-md { box-shadow: var(--msm-shadow-md); }
.msm-shadow-lg { box-shadow: var(--msm-shadow-lg); }
.msm-shadow-xl { box-shadow: var(--msm-shadow-xl); }

/* Transition Utilities */
.msm-transition { transition: var(--msm-transition-default); }
.msm-transition-fast { transition: var(--msm-transition-fast); }
.msm-transition-colors { transition: var(--msm-transition-colors); }

/* Focus Utilities */
.msm-focus-ring:focus {
  outline: none;
  box-shadow: var(--msm-focus-ring-offset-shadow), var(--msm-focus-ring);
}

/* ========================================
   DEBUG MODE
   Uncomment to visualize spacing and layout
   ======================================== */

/*
.msm-debug * {
  outline: 1px solid rgba(255, 0, 0, 0.2);
}
*/
