/* Theme Variables and Color System */

:root {
  /* Spacing Scale */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 0.75rem;  /* 12px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;     /* 32px */
  --space-2xl: 3rem;    /* 48px */
  --space-3xl: 4rem;    /* 64px */
  
  /* Font Sizes */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-md: 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 */
  
  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Border Radius */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.5rem;   /* 8px */
  --radius-lg: 0.75rem;  /* 12px */
  --radius-xl: 1rem;     /* 16px */
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
}

/* Light Theme (Default) */
:root,
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-accent: #e2e8f0;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Brand Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  
  --color-secondary: #64748b;
  --color-secondary-hover: #475569;
  --color-secondary-light: #f1f5f9;
  
  --color-accent: #10b981;
  --color-accent-hover: #059669;
  --color-accent-light: #d1fae5;
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;
  
  /* Border Colors */
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  --border-tertiary: #94a3b8;
  --border-focus: var(--color-primary);
  
  /* Navigation */
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.75);
  --nav-border: rgba(226, 232, 240, 0.6);
  --nav-border-scrolled: rgba(226, 232, 240, 0.4);
  --nav-text: var(--text-primary);
  --nav-text-hover: var(--color-primary);
  
  /* Skill Level Colors */
  --skill-expert: var(--color-primary);
  --skill-advanced: var(--color-accent);
  --skill-intermediate: var(--color-warning);
  --skill-beginner: var(--color-secondary);
  
  /* Component Backgrounds */
  --card-bg: var(--bg-primary);
  --card-border: var(--border-primary);
  --card-shadow: var(--shadow-md);
  
  /* Interactive Elements */
  --button-primary-bg: var(--color-primary);
  --button-primary-text: var(--text-inverse);
  --button-primary-hover: var(--color-primary-hover);
  
  --button-secondary-bg: var(--bg-secondary);
  --button-secondary-text: var(--text-secondary);
  --button-secondary-hover: var(--bg-accent);
  
  --link-color: var(--color-primary);
  --link-hover: var(--color-primary-hover);
  --link-visited: #7c3aed;
}

/* Dark Theme */
[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-accent: #475569;
  --bg-hover: #334155;
  --bg-active: #475569;
  
  /* Text Colors */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  
  /* Brand Colors */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #1e3a8a;
  
  --color-secondary: #94a3b8;
  --color-secondary-hover: #cbd5e1;
  --color-secondary-light: #334155;
  
  --color-accent: #34d399;
  --color-accent-hover: #10b981;
  --color-accent-light: #064e3b;
  
  /* Status Colors */
  --color-success: #34d399;
  --color-success-light: #064e3b;
  --color-warning: #fbbf24;
  --color-warning-light: #78350f;
  --color-error: #f87171;
  --color-error-light: #7f1d1d;
  --color-info: #60a5fa;
  --color-info-light: #1e3a8a;
  
  /* Border Colors */
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-tertiary: #64748b;
  --border-focus: var(--color-primary);
  
  /* Navigation */
  --nav-bg: rgba(15, 23, 42, 0.85);
  --nav-bg-scrolled: rgba(15, 23, 42, 0.75);
  --nav-border: rgba(51, 65, 85, 0.6);
  --nav-border-scrolled: rgba(51, 65, 85, 0.4);
  --nav-text: var(--text-primary);
  --nav-text-hover: var(--color-primary);
  
  /* Skill Level Colors */
  --skill-expert: var(--color-primary);
  --skill-advanced: var(--color-accent);
  --skill-intermediate: var(--color-warning);
  --skill-beginner: var(--color-secondary);
  
  /* Component Backgrounds */
  --card-bg: var(--bg-secondary);
  --card-border: var(--border-primary);
  --card-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Interactive Elements */
  --button-primary-bg: var(--color-primary);
  --button-primary-text: var(--text-inverse);
  --button-primary-hover: var(--color-primary-hover);
  
  --button-secondary-bg: var(--bg-tertiary);
  --button-secondary-text: var(--text-secondary);
  --button-secondary-hover: var(--bg-accent);
  
  --link-color: var(--color-primary);
  --link-hover: var(--color-primary-hover);
  --link-visited: #a78bfa;
}

/* System Theme Preference Support */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* Apply dark theme variables when system prefers dark and no theme is set */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-accent: #475569;
    --bg-hover: #334155;
    --bg-active: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #1e3a8a;
    
    --color-secondary: #94a3b8;
    --color-secondary-hover: #cbd5e1;
    --color-secondary-light: #334155;
    
    --color-accent: #34d399;
    --color-accent-hover: #10b981;
    --color-accent-light: #064e3b;
    
    --color-success: #34d399;
    --color-success-light: #064e3b;
    --color-warning: #fbbf24;
    --color-warning-light: #78350f;
    --color-error: #f87171;
    --color-error-light: #7f1d1d;
    --color-info: #60a5fa;
    --color-info-light: #1e3a8a;
    
    --border-primary: #334155;
    --border-secondary: #475569;
    --border-tertiary: #64748b;
    
    --nav-bg: rgba(15, 23, 42, 0.95);
    --nav-border: rgba(51, 65, 85, 0.8);
    --nav-text: var(--text-primary);
    --nav-text-hover: var(--color-primary);
    
    --skill-expert: var(--color-primary);
    --skill-advanced: var(--color-accent);
    --skill-intermediate: var(--color-warning);
    --skill-beginner: var(--color-secondary);
    
    --card-bg: var(--bg-secondary);
    --card-border: var(--border-primary);
    --card-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --button-primary-bg: var(--color-primary);
    --button-primary-text: var(--text-inverse);
    --button-primary-hover: var(--color-primary-hover);
    
    --button-secondary-bg: var(--bg-tertiary);
    --button-secondary-text: var(--text-secondary);
    --button-secondary-hover: var(--bg-accent);
    
    --link-color: var(--color-primary);
    --link-hover: var(--color-primary-hover);
    --link-visited: #a78bfa;
  }
}

/* Smooth theme transitions */
*,
*::before,
*::after {
  transition: 
    background-color var(--transition-normal),
    border-color var(--transition-normal),
    color var(--transition-normal),
    box-shadow var(--transition-normal);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}