/* ===================================================
   FitForge AI — Design System & Global Styles
   =================================================== */

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

/* ── Design Tokens ── */
:root {
  /* Colors */
  --clr-bg:           #0B0B0B;
  --clr-bg-card:      rgba(255, 255, 255, 0.04);
  --clr-bg-card-hover:rgba(255, 255, 255, 0.08);
  --clr-primary:      #A3FF12;
  --clr-primary-dim:  rgba(163, 255, 18, 0.15);
  --clr-primary-glow: rgba(163, 255, 18, 0.4);
  --clr-secondary:    #FFFFFF;
  --clr-accent:       #888888;
  --clr-accent-light: #AAAAAA;
  --clr-border:       rgba(255, 255, 255, 0.08);
  --clr-border-hover: rgba(163, 255, 18, 0.3);
  --clr-danger:       #FF4D4D;
  --clr-success:      #4DFF91;
  --clr-warning:      #FFB84D;
  --clr-surface-1:    #111111;
  --clr-surface-2:    #1A1A1A;
  --clr-surface-3:    #222222;

  /* Typography */
  --ff-heading: 'Space Grotesk', sans-serif;
  --ff-body:    'Inter', sans-serif;
  --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 */
  --fs-5xl:  3.5rem;     /* 56px */
  --fs-hero: clamp(2.5rem, 6vw, 4.5rem);

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Radii */
  --rad-sm:   6px;
  --rad-md:   12px;
  --rad-lg:   16px;
  --rad-xl:   24px;
  --rad-2xl:  32px;
  --rad-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--clr-primary-glow);
  --shadow-glow-sm: 0 0 10px rgba(163,255,18,0.2);

  /* Transitions */
  --tr-fast:   150ms ease;
  --tr-base:   300ms ease;
  --tr-slow:   500ms ease;
  --tr-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Glass */
  --glass-bg:     rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur:   blur(20px);

  /* Layout */
  --max-w:    1280px;
  --max-w-sm: 640px;
  --max-w-md: 768px;
  --max-w-lg: 1024px;

  /* Z-index */
  --z-nav:    1000;
  --z-modal:  2000;
  --z-toast:  3000;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  color: var(--clr-secondary);
  background-color: var(--clr-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-heading);
  font-weight: 700;
  line-height: 1.15;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--clr-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--clr-surface-3);
  border-radius: var(--rad-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--clr-accent);
}

::selection {
  background: var(--clr-primary);
  color: var(--clr-bg);
}

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container-sm {
  max-width: var(--max-w-sm);
}

.container-md {
  max-width: var(--max-w-md);
}

/* ── Section ── */
.section {
  padding: var(--sp-24) 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: var(--sp-16);
}

.section-header h2 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-4);
}

.section-header p {
  color: var(--clr-accent);
  font-size: var(--fs-md);
  max-width: 600px;
  margin: 0 auto;
}

.section-label {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--clr-primary);
  margin-bottom: var(--sp-4);
  font-family: var(--ff-heading);
}

/* ── Grid ── */
.grid {
  display: grid;
  gap: var(--sp-8);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .section {
    padding: var(--sp-16) 0;
  }
  .section-header h2 {
    font-size: var(--fs-2xl);
  }
}

/* ── Utilities ── */
.text-center  { text-align: center; }
.text-primary { color: var(--clr-primary); }
.text-accent  { color: var(--clr-accent); }
.text-sm      { font-size: var(--fs-sm); }
.text-lg      { font-size: var(--fs-lg); }
.text-gradient {
  background: linear-gradient(135deg, var(--clr-primary), #7CFF4D, var(--clr-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.gap-2       { gap: var(--sp-2); }
.gap-4       { gap: var(--sp-4); }
.gap-6       { gap: var(--sp-6); }
.gap-8       { gap: var(--sp-8); }

.mt-4  { margin-top: var(--sp-4); }
.mt-8  { margin-top: var(--sp-8); }
.mt-12 { margin-top: var(--sp-12); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-8  { margin-bottom: var(--sp-8); }

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

/* ── Glassmorphism Base ── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--rad-lg);
}

/* ── Page Transition ── */
#app {
  opacity: 1;
  transition: opacity 200ms ease;
}

#app.page-exit {
  opacity: 0;
}

/* Loading screen */
.loader-screen {
  position: fixed;
  inset: 0;
  background: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--clr-surface-3);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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