/* ============================================
   CodeLevel — Design System & Global Styles
   A Duolingo-style Frontend Assessment Platform
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Fira+Code:wght@400;500;600&display=swap');

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
  /* Brand Colors */
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --primary-glow: rgba(108, 92, 231, 0.3);

  /* Status Colors */
  --success: #00B894;
  --success-light: #55EFC4;
  --success-dark: #00A381;
  --success-glow: rgba(0, 184, 148, 0.3);

  --danger: #FF6B6B;
  --danger-light: #FF8787;
  --danger-dark: #EE5A5A;
  --danger-glow: rgba(255, 107, 107, 0.3);

  --warning: #FDCB6E;
  --warning-light: #FFEAA7;
  --warning-dark: #E6B84D;

  --info: #74B9FF;
  --info-light: #A3D8FF;
  --info-dark: #5BA8F5;

  /* Technology Colors */
  --html-color: #E34F26;
  --html-bg: rgba(227, 79, 38, 0.1);
  --css-color: #264DE4;
  --css-bg: rgba(38, 77, 228, 0.1);
  --js-color: #F7DF1E;
  --js-bg: rgba(247, 223, 30, 0.1);
  --tailwind-color: #06B6D4;
  --tailwind-bg: rgba(6, 182, 212, 0.1);
  --react-color: #61DAFB;
  --react-bg: rgba(97, 218, 251, 0.1);
  --git-color: #F05032;
  --git-bg: rgba(240, 80, 50, 0.1);
  --internet-color: #00CEC9;
  --internet-bg: rgba(0, 206, 201, 0.1);

  /* Dark Theme (Default) */
  --bg-primary: #0F0F23;
  --bg-secondary: #1A1A2E;
  --bg-tertiary: #16213E;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.7);

  --text-primary: #E8E8F0;
  --text-secondary: #9B9BB4;
  --text-tertiary: #6B6B80;
  --text-inverse: #0F0F23;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --divider: rgba(255, 255, 255, 0.05);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px var(--primary-glow);
  --shadow-glow-success: 0 0 20px var(--success-glow);

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --fs-xs: 0.75rem;    /* 12px */
  --fs-sm: 0.875rem;   /* 14px */
  --fs-base: 1rem;     /* 16px */
  --fs-md: 1.125rem;   /* 18px */
  --fs-lg: 1.25rem;    /* 20px */
  --fs-xl: 1.5rem;     /* 24px */
  --fs-2xl: 2rem;      /* 32px */
  --fs-3xl: 2.5rem;    /* 40px */
  --fs-4xl: 3rem;      /* 48px */

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.75;

  /* Spacing */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 70px;
  --max-content: 1200px;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-primary: #F8F9FE;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F0F1F8;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-overlay: rgba(0, 0, 0, 0.4);

  --text-primary: #1A1A2E;
  --text-secondary: #5A5A7A;
  --text-tertiary: #9B9BB4;
  --text-inverse: #FFFFFF;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --divider: rgba(0, 0, 0, 0.06);

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* ---- Global Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 184, 148, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(255, 107, 107, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  font-size: inherit;
}

input, textarea, select {
  font-family: var(--font-main);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

code, pre {
  font-family: var(--font-code);
}

ul, ol {
  list-style: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ---- Selection ---- */
::selection {
  background: var(--primary);
  color: white;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

/* ---- Utility Classes ---- */
.text-center { text-align: center; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
