/* Design tokens: colors, spacing, typography, animations */
:root {
  /* Primary Colors */
  --df-primary: #2563eb;
  --df-primary-hover: #1d4ed8;
  --df-primary-light: #3b82f6;
  --df-primary-lighter: #60a5fa;
  --df-primary-bg: #eff6ff;

  /* Secondary Colors */
  --df-secondary: #7c3aed;
  --df-secondary-hover: #6d28d9;
  --df-secondary-light: #8b5cf6;

  /* Accent Colors */
  --df-accent: #f97316;
  --df-accent-hover: #ea580c;

  /* Semantic Colors */
  --df-success: #22c55e;
  --df-success-bg: #f0fdf4;
  --df-warning: #f59e0b;
  --df-warning-bg: #fffbeb;
  --df-error: #ef4444;
  --df-error-bg: #fef2f2;
  --df-info: #0ea5e9;
  --df-info-bg: #f0f9ff;

  /* Surface Colors */
  --df-surface: #ffffff;
  --df-surface-variant: #f8fafc;
  --df-surface-elevated: #ffffff;
  --df-background: #f8fafc;
  --df-backdrop: rgba(15, 23, 42, 0.5);

  /* Text Colors */
  --df-on-surface: #0f172a;
  --df-on-surface-secondary: #475569;
  --df-muted: #64748b;
  --df-disabled: #94a3b8;
  --df-placeholder: #9ca3af;

  /* Border Colors */
  --df-border: #e2e8f0;
  --df-border-light: #f1f5f9;
  --df-border-focus: #3b82f6;

  /* Border Radius */
  --df-radius-xs: 4px;
  --df-radius-sm: 6px;
  --df-radius: 8px;
  --df-radius-md: 12px;
  --df-radius-lg: 16px;
  --df-radius-xl: 24px;
  --df-radius-full: 9999px;

  /* Spacing */
  --df-spacing-xs: 4px;
  --df-spacing-sm: 8px;
  --df-spacing-md: 16px;
  --df-spacing-lg: 24px;
  --df-spacing-xl: 32px;
  --df-spacing-2xl: 48px;
  --df-spacing-3xl: 64px;

  /* Typography */
  --df-font-base: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --df-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --df-font-size-xs: 0.75rem;
  --df-font-size-sm: 0.875rem;
  --df-font-size-base: 1rem;
  --df-font-size-lg: 1.125rem;
  --df-font-size-xl: 1.25rem;
  --df-font-size-2xl: 1.5rem;
  --df-font-size-3xl: 1.875rem;
  --df-font-size-4xl: 2.25rem;
  --df-line-height-tight: 1.25;
  --df-line-height-normal: 1.5;
  --df-line-height-relaxed: 1.625;

  /* Shadows */
  --df-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --df-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --df-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --df-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --df-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --df-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --df-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  --df-shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.3);

  /* Transitions */
  --df-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --df-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --df-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --df-transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --df-z-dropdown: 1000;
  --df-z-sticky: 1020;
  --df-z-fixed: 1030;
  --df-z-modal-backdrop: 1040;
  --df-z-modal: 1050;
  --df-z-popover: 1060;
  --df-z-tooltip: 1070;
  --df-z-toast: 1080;

  /* Breakpoints (for reference in media queries) */
  --df-breakpoint-sm: 640px;
  --df-breakpoint-md: 768px;
  --df-breakpoint-lg: 1024px;
  --df-breakpoint-xl: 1280px;
  --df-breakpoint-2xl: 1536px;

  /* Component Specific */
  --df-navbar-height: 64px;
  --df-sidebar-width: 280px;
  --df-sidebar-collapsed: 72px;
  --df-bottom-nav-height: 64px;
  --df-card-padding: 16px;
  --df-input-height: 44px;
  --df-button-height: 40px;
}

/* ============================================
   LIGHT MODE (explicit class)
   ============================================ */
.light,
.light *,
.mud-theme-light,
.mud-theme-light * {
  --df-primary: #2563eb;
  --df-primary-hover: #1d4ed8;
  --df-primary-light: #3b82f6;
  --df-primary-lighter: #60a5fa;
  --df-primary-bg: #eff6ff;

  --df-secondary: #7c3aed;
  --df-secondary-hover: #6d28d9;

  --df-success-bg: #f0fdf4;
  --df-warning-bg: #fffbeb;
  --df-error-bg: #fef2f2;
  --df-info-bg: #f0f9ff;

  --df-surface: #ffffff;
  --df-surface-variant: #f8fafc;
  --df-surface-elevated: #ffffff;
  --df-background: #f8fafc;
  --df-backdrop: rgba(15, 23, 42, 0.5);

  --df-on-surface: #0f172a;
  --df-on-surface-secondary: #475569;
  --df-muted: #64748b;
  --df-disabled: #94a3b8;
  --df-placeholder: #9ca3af;

  --df-border: #e2e8f0;
  --df-border-light: #f1f5f9;
  --df-border-focus: #3b82f6;

  --df-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --df-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --df-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --df-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --df-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --df-shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* ============================================
   DARK MODE (explicit class)
   ============================================ */
.dark,
.dark *,
.mud-theme-dark,
.mud-theme-dark * {
  --df-primary: #3b82f6;
  --df-primary-hover: #2563eb;
  --df-primary-light: #60a5fa;
  --df-primary-lighter: #93c5fd;
  --df-primary-bg: rgba(59, 130, 246, 0.15);

  --df-secondary: #8b5cf6;
  --df-secondary-hover: #7c3aed;

  --df-success-bg: rgba(34, 197, 94, 0.15);
  --df-warning-bg: rgba(245, 158, 11, 0.15);
  --df-error-bg: rgba(239, 68, 68, 0.15);
  --df-info-bg: rgba(14, 165, 233, 0.15);

  --df-surface: #1e293b;
  --df-surface-variant: #334155;
  --df-surface-elevated: #334155;
  --df-background: #0f172a;
  --df-backdrop: rgba(0, 0, 0, 0.7);

  --df-on-surface: #f8fafc;
  --df-on-surface-secondary: #cbd5e1;
  --df-muted: #94a3b8;
  --df-disabled: #64748b;
  --df-placeholder: #6b7280;

  --df-border: #334155;
  --df-border-light: #475569;
  --df-border-focus: #60a5fa;

  --df-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --df-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --df-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --df-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --df-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  --df-shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

/* ============================================
   GLOBAL BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--df-font-base);
  font-size: var(--df-font-size-base);
  line-height: var(--df-line-height-normal);
  color: var(--df-on-surface);
  background-color: var(--df-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--df-transition), color var(--df-transition);
}

/* Focus Visible */
:focus-visible {
  outline: none;
  box-shadow: var(--df-shadow-focus);
}

/* Selection */
::selection {
  background-color: var(--df-primary);
  color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--df-surface-variant);
  border-radius: var(--df-radius);
}

::-webkit-scrollbar-thumb {
  background: var(--df-muted);
  border-radius: var(--df-radius);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--df-on-surface-secondary);
}

/* ============================================
   MUDBLAZOR LIGHT MODE OVERRIDES
   ============================================ */
.light .mud-layout,
.mud-theme-light .mud-layout {
  background-color: var(--df-background) !important;
}

.light .mud-card,
.mud-theme-light .mud-card {
  background-color: var(--df-surface) !important;
  border-color: var(--df-border) !important;
  color: var(--df-on-surface) !important;
}

.light .mud-paper,
.mud-theme-light .mud-paper {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.light .mud-appbar,
.mud-theme-light .mud-appbar {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.light .mud-drawer,
.mud-theme-light .mud-drawer {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.light .mud-main-content,
.mud-theme-light .mud-main-content {
  background-color: var(--df-background) !important;
  color: var(--df-on-surface) !important;
}

.light .mud-input,
.light .mud-input-control,
.mud-theme-light .mud-input,
.mud-theme-light .mud-input-control {
  color: var(--df-on-surface) !important;
}

.light .mud-input-outlined .mud-input-outlined-border,
.mud-theme-light .mud-input-outlined .mud-input-outlined-border {
  border-color: var(--df-border) !important;
}

.light .mud-typography,
.mud-theme-light .mud-typography {
  color: var(--df-on-surface) !important;
}

.light .mud-nav-link,
.mud-theme-light .mud-nav-link {
  color: var(--df-on-surface) !important;
}

.light .mud-nav-link .mud-nav-link-text,
.mud-theme-light .mud-nav-link .mud-nav-link-text {
  color: var(--df-on-surface) !important;
}

.light .mud-nav-link .mud-nav-link-icon,
.mud-theme-light .mud-nav-link .mud-nav-link-icon {
  color: var(--df-muted) !important;
}

.light .mud-nav-group .mud-nav-group-text,
.mud-theme-light .mud-nav-group .mud-nav-group-text {
  color: var(--df-muted) !important;
}

/* ============================================
   MUDBLAZOR DARK MODE OVERRIDES
   ============================================ */
.dark .mud-layout,
.mud-theme-dark .mud-layout {
  background-color: var(--df-background) !important;
}

.dark .mud-card,
.mud-theme-dark .mud-card {
  background-color: var(--df-surface) !important;
  border-color: var(--df-border) !important;
  color: var(--df-on-surface) !important;
}

.dark .mud-paper,
.mud-theme-dark .mud-paper {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.dark .mud-appbar,
.mud-theme-dark .mud-appbar {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.dark .mud-drawer,
.mud-theme-dark .mud-drawer {
  background-color: var(--df-surface) !important;
  color: var(--df-on-surface) !important;
}

.dark .mud-main-content,
.mud-theme-dark .mud-main-content {
  background-color: var(--df-background) !important;
  color: var(--df-on-surface) !important;
}

.dark .mud-input,
.dark .mud-input-control,
.mud-theme-dark .mud-input,
.mud-theme-dark .mud-input-control {
  color: var(--df-on-surface) !important;
}

.dark .mud-input-outlined .mud-input-outlined-border,
.mud-theme-dark .mud-input-outlined .mud-input-outlined-border {
  border-color: var(--df-border) !important;
}

.dark .mud-typography,
.mud-theme-dark .mud-typography {
  color: var(--df-on-surface) !important;
}

.dark .mud-nav-link,
.mud-theme-dark .mud-nav-link {
  color: var(--df-on-surface) !important;
}

.dark .mud-nav-link .mud-nav-link-text,
.mud-theme-dark .mud-nav-link .mud-nav-link-text {
  color: var(--df-on-surface) !important;
}

.dark .mud-nav-link .mud-nav-link-icon,
.mud-theme-dark .mud-nav-link .mud-nav-link-icon {
  color: var(--df-muted) !important;
}

.dark .mud-nav-group .mud-nav-group-text,
.mud-theme-dark .mud-nav-group .mud-nav-group-text {
  color: var(--df-muted) !important;
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-5%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.animate-fade-in { animation: fadeIn var(--df-transition); }
.animate-fade-in-up { animation: fadeInUp var(--df-transition-slow); }
.animate-fade-in-down { animation: fadeInDown var(--df-transition-slow); }
.animate-scale-in { animation: scaleIn var(--df-transition); }
.animate-slide-in-left { animation: slideInLeft var(--df-transition-slow); }
.animate-slide-in-right { animation: slideInRight var(--df-transition-slow); }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounce 1s infinite; }

/* Staggered Animation Delays */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
