/* ============================================================
   GLOBAL.CSS — Reset, CSS Variables, Typography
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@700;800&display=swap');

/* ─── CSS CUSTOM PROPERTIES ─── */
:root {
  /* Brand Colors */
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --primary-light: #E8E6FF;
  --secondary: #FF6584;
  --accent: #43E97B;
  --accent-dark: #32D265;
  --warning: #FFB347;

  /* Neutrals */
  --bg: #0F0F1A;
  --surface: #1A1A2E;
  --surface-2: #22223B;
  --surface-3: #2A2A45;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --text: #F0F0FF;
  --text-muted: #8B8BA7;
  --text-subtle: #5A5A7A;

  /* Tool Category Colors */
  --cat-pdf: #EF4444;
  --cat-image: #43E97B;
  --cat-calculator: #F59E0B;
  --cat-code: #3B82F6;
  --cat-security: #EF4444;
  --cat-qr: #8B5CF6;
  --cat-web: #06B6D4;
  --cat-datetime: #6366F1;
  --cat-fun: #14B8A6;
  --cat-text: #10B981;
  --cat-design: #EC4899;
  --cat-data: #F97316;
  --cat-finance: #22C55E;
  --cat-productivity: #8B5CF6;
  --cat-math: #06B6D4;
  --cat-geography: #10B981;
  --cat-media: #EC4899;
  --cat-css: #A855F7;
}

/* Category Classes */
.cat-pdf { --cat-color: var(--cat-pdf); }
.cat-image { --cat-color: var(--cat-image); }
.cat-calculator { --cat-color: var(--cat-calculator); }
.cat-code { --cat-color: var(--cat-code); }
.cat-security { --cat-color: var(--cat-security); }
.cat-qr { --cat-color: var(--cat-qr); }
.cat-web { --cat-color: var(--cat-web); }
.cat-datetime { --cat-color: var(--cat-datetime); }
.cat-fun { --cat-color: var(--cat-fun); }
.cat-text { --cat-color: var(--cat-text); }
.cat-design { --cat-color: var(--cat-design); }
.cat-data { --cat-color: var(--cat-data); }
.cat-finance { --cat-color: var(--cat-finance); }
.cat-productivity { --cat-color: var(--cat-productivity); }
.cat-math { --cat-color: var(--cat-math); }
.cat-geography { --cat-color: var(--cat-geography); }
.cat-media { --cat-color: var(--cat-media); }
.cat-css { --cat-color: var(--cat-css); }

:root {
  /* Spacing Scale */
  --space-1: 2px;
  --space-2: 5px;
  --space-3: 9px;
  --space-4: 11px;
  --space-5: 14px;
  --space-6: 18px;
  --space-8: 22px;
  --space-10: 28px;
  --space-12: 36px;
  --space-16: 46px;

  /* Border Radius */
  --radius-sm: 5px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.3);
  --shadow-glow-sm: 0 0 10px rgba(108, 99, 255, 0.2);
  --shadow-card: 0 5px 20px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Typography Scale */
  --text-xs: 10px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-lg: 14px;
  --text-xl: 18px;
  --text-2xl: 24px;
  --text-3xl: 36px;
  --text-4xl: 46px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-modal: 1200;
  --z-toast: 1300;
}

[data-theme="light"] {
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F5;
  --surface-3: #E9ECEF;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --text: #212529;
  --text-muted: #495057;
  --text-subtle: #868E96;
}

/* ─── CSS RESET ─── */

*, *::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;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ─── TYPOGRAPHY ─── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

.display-font {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
}

p {
  color: var(--text-muted);
  line-height: 1.7;
}

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

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

strong { font-weight: 600; color: var(--text); }

ul, ol { list-style: none; }

img, svg { display: block; max-width: 100%; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

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

/* ─── FOCUS STYLES (Accessibility) ─── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ─── UTILITY CLASSES ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Flex Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease infinite;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
}

/* ─── SYSTEM ANIMATIONS ─── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0px transparent; }
  50%       { box-shadow: 0 0 20px var(--category-color, var(--brand-glow)); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

@keyframes ripple {
  from { transform: scale(0); opacity: 0.6; }
  to   { transform: scale(4); opacity: 0; }
}

@keyframes coinFlip {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(1440deg); }
}

@keyframes wheelSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(calc(360deg * 5 + var(--final-angle))); }
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.animate-slide-up {
  animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-scale-up {
  animation: countUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

