/* MoonUI Design System - Advanced Tokens */

/* Base layer styles - Scoped to moonui-pro components only */
.moonui-pro {
  /* ===== Semantic Color Tokens ===== */
  
  /* Background Layers */
  --bg-base: var(--background);
  --bg-subtle: var(--gray-50);
  --bg-muted: var(--gray-100);
  --bg-emphasis: var(--gray-200);
  --bg-inverse: var(--foreground);
  
  /* Surface Colors */
  --surface-base: var(--background);
  --surface-overlay: var(--gray-50);
  --surface-raised: var(--background);
  --surface-sunken: var(--gray-100);
  
  /* Text Colors */
  --text-primary: var(--foreground);
  --text-secondary: var(--gray-600);
  --text-tertiary: var(--gray-500);
  --text-disabled: var(--gray-400);
  --text-inverse: var(--background);
  --text-link: var(--primary);
  --text-link-hover: var(--primary-hover);
  
  /* Brand Colors */
  --brand-primary: var(--primary);
  --brand-primary-hover: var(--primary-hover);
  --brand-primary-active: var(--primary-active);
  --brand-secondary: var(--secondary);
  
  /* Interactive States */
  --state-hover: var(--gray-100);
  --state-active: var(--gray-200);
  --state-selected: var(--primary);
  --state-disabled: var(--gray-300);
  --state-focus: var(--primary);
  
  /* Feedback Colors */
  --feedback-success: var(--success);
  --feedback-success-light: 142 71% 95%;
  --feedback-success-dark: 142 71% 35%;
  --feedback-warning: var(--warning);
  --feedback-warning-light: 38 92% 95%;
  --feedback-warning-dark: 38 92% 40%;
  --feedback-error: var(--error);
  --feedback-error-light: 0 84% 95%;
  --feedback-error-dark: 0 84% 50%;
  --feedback-info: 217 91% 60%;
  --feedback-info-light: 217 91% 95%;
  --feedback-info-dark: 217 91% 50%;
  
  /* Border Colors */
  --border-default: var(--border);
  --border-subtle: var(--gray-200);
  --border-strong: var(--gray-400);
  --border-interactive: var(--primary);
  --border-error: var(--error);
  --border-success: var(--success);
  --border-warning: var(--warning);
  
  /* ===== Shadow System ===== */
  
  /* Elevation Tokens */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Colored Shadows */
  --shadow-primary: 0 4px 14px 0 hsl(var(--primary) / 0.3);
  --shadow-success: 0 4px 14px 0 hsl(var(--success) / 0.3);
  --shadow-error: 0 4px 14px 0 hsl(var(--error) / 0.3);
  --shadow-warning: 0 4px 14px 0 hsl(var(--warning) / 0.3);
  
  /* Inset Shadows */
  --shadow-inner-xs: inset 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-inner-sm: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --shadow-inner-md: inset 0 4px 6px -1px rgb(0 0 0 / 0.1);
  
  /* ===== Animation Timing Functions ===== */
  
  /* Easing 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.68, -0.55, 0.265, 1.55);
  --ease-back-in: cubic-bezier(0.6, -0.28, 0.735, 0.045);
  --ease-back-out: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-back-in-out: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Duration Tokens */
  --duration-instant: 0ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;
  --duration-slowest: 750ms;
  
  /* ===== Spacing System (8px Grid) ===== */
  
  --space-0: 0;
  --space-px: 1px;
  --space-0\.5: 0.125rem; /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1\.5: 0.375rem; /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2\.5: 0.625rem; /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-3\.5: 0.875rem; /* 14px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-7: 1.75rem;     /* 28px */
  --space-8: 2rem;        /* 32px */
  --space-9: 2.25rem;     /* 36px */
  --space-10: 2.5rem;     /* 40px */
  --space-11: 2.75rem;    /* 44px */
  --space-12: 3rem;       /* 48px */
  --space-14: 3.5rem;     /* 56px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */
  --space-24: 6rem;       /* 96px */
  --space-28: 7rem;       /* 112px */
  --space-32: 8rem;       /* 128px */
  --space-36: 9rem;       /* 144px */
  --space-40: 10rem;      /* 160px */
  --space-44: 11rem;      /* 176px */
  --space-48: 12rem;      /* 192px */
  --space-52: 13rem;      /* 208px */
  --space-56: 14rem;      /* 224px */
  --space-60: 15rem;      /* 240px */
  --space-64: 16rem;      /* 256px */
  --space-72: 18rem;      /* 288px */
  --space-80: 20rem;      /* 320px */
  --space-96: 24rem;      /* 384px */
  
  /* ===== Typography Scale (Perfect Fourth) ===== */
  
  /* Font Sizes */
  --text-2xs: 0.625rem;   /* 10px */
  --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 */
  --text-6xl: 3.75rem;    /* 60px */
  --text-7xl: 4.5rem;     /* 72px */
  --text-8xl: 6rem;       /* 96px */
  --text-9xl: 8rem;       /* 128px */
  
  /* 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;
  
  /* Font Weights */
  --font-thin: 100;
  --font-extralight: 200;
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  --font-black: 900;
  
  /* ===== Border Radius ===== */
  
  --radius-none: 0;
  --radius-sm: 0.125rem;    /* 2px */
  --radius-base: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;    /* 6px */
  --radius-lg: 0.5rem;      /* 8px */
  --radius-xl: 0.75rem;     /* 12px */
  --radius-2xl: 1rem;       /* 16px */
  --radius-3xl: 1.5rem;     /* 24px */
  --radius-full: 9999px;
  
  /* ===== Z-Index Scale ===== */
  
  --z-0: 0;
  --z-10: 10;
  --z-20: 20;
  --z-30: 30;
  --z-40: 40;
  --z-50: 50;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-notification: 1080;
  
  /* ===== Blur Values ===== */
  
  --blur-none: 0;
  --blur-sm: 4px;
  --blur-base: 8px;
  --blur-md: 12px;
  --blur-lg: 16px;
  --blur-xl: 24px;
  --blur-2xl: 40px;
  --blur-3xl: 64px;
}

/* Dark Mode Overrides */
.moonui-pro.dark,
.dark .moonui-pro {
  /* Background Layers */
  --bg-base: var(--background);
  --bg-subtle: var(--gray-800);
  --bg-muted: var(--gray-700);
  --bg-emphasis: var(--gray-600);
  
  /* Surface Colors */
  --surface-overlay: var(--gray-800);
  --surface-raised: var(--gray-800);
  --surface-sunken: var(--background);
  
  /* Text Colors */
  --text-secondary: var(--gray-400);
  --text-tertiary: var(--gray-500);
  --text-disabled: var(--gray-600);
  
  /* Interactive States */
  --state-hover: var(--gray-700);
  --state-active: var(--gray-600);
  
  /* Dark Mode Shadows (Lighter for visibility) */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.5);
}

/* ===== Utility Classes ===== */

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

.shadow-primary { box-shadow: var(--shadow-primary); }
.shadow-success { box-shadow: var(--shadow-success); }
.shadow-error { box-shadow: var(--shadow-error); }
.shadow-warning { box-shadow: var(--shadow-warning); }

.shadow-inner-xs { box-shadow: var(--shadow-inner-xs); }
.shadow-inner-sm { box-shadow: var(--shadow-inner-sm); }
.shadow-inner-md { box-shadow: var(--shadow-inner-md); }

/* Animation Utilities */
.animate-none { animation: none; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }
.animate-fade-out { animation: fadeOut var(--duration-normal) var(--ease-out); }
.animate-slide-in { animation: slideIn var(--duration-normal) var(--ease-out); }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-out); }

/* Transition Utilities */
.transition-none { transition: none; }
.transition-all { transition-property: all; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; }
.transition-opacity { transition-property: opacity; }
.transition-shadow { transition-property: box-shadow; }
.transition-transform { transition-property: transform; }

/* Duration Utilities */
.duration-instant { transition-duration: var(--duration-instant); }
.duration-fast { transition-duration: var(--duration-fast); }
.duration-normal { transition-duration: var(--duration-normal); }
.duration-slow { transition-duration: var(--duration-slow); }
.duration-slower { transition-duration: var(--duration-slower); }
.duration-slowest { transition-duration: var(--duration-slowest); }

/* Easing Utilities */
.ease-linear { transition-timing-function: var(--ease-linear); }
.ease-in { transition-timing-function: var(--ease-in); }
.ease-out { transition-timing-function: var(--ease-out); }
.ease-in-out { transition-timing-function: var(--ease-in-out); }
.ease-bounce { transition-timing-function: var(--ease-bounce); }

/* ===== Keyframes ===== */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}