/* ============================================================
   BASE.CSS — Design System Tokens & Global Resets
   Math Tutor UI — Glassmorphism + Liquid Morphism
   ============================================================ */

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

/* ── Color Tokens ─────────────────────────────────────────── */
:root {
  /* Background */
  --bg-gradient:        linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --bg-gradient-alt:    linear-gradient(135deg, #0a0a1a 0%, #1a1040 50%, #0d0d2b 100%);

  /* Glass Panels */
  --glass-bg:           rgba(255, 255, 255, 0.08);
  --glass-bg-hover:     rgba(255, 255, 255, 0.13);
  --glass-bg-strong:    rgba(255, 255, 255, 0.15);
  --glass-border:       rgba(255, 255, 255, 0.15);
  --glass-border-focus: rgba(0, 217, 255, 0.6);
  --glass-blur:         blur(12px);
  --glass-blur-heavy:   blur(20px);

  /* Accent Colors */
  --cyan:               #00d9ff;
  --cyan-dim:           rgba(0, 217, 255, 0.3);
  --cyan-glow:          0 0 20px rgba(0, 217, 255, 0.4), 0 0 60px rgba(0, 217, 255, 0.15);
  --cyan-glow-intense:  0 0 30px rgba(0, 217, 255, 0.6), 0 0 80px rgba(0, 217, 255, 0.25);
  --purple:             #a855f7;
  --purple-dim:         rgba(168, 85, 247, 0.3);

  /* Semantic Colors */
  --success:            #00ff88;
  --success-dim:        rgba(0, 255, 136, 0.2);
  --warning:            #ffaa00;
  --warning-dim:        rgba(255, 170, 0, 0.2);
  --error:              #ff0055;
  --error-dim:          rgba(255, 0, 85, 0.2);

  /* Typography */
  --text-primary:       rgba(255, 255, 255, 0.93);
  --text-secondary:     rgba(255, 255, 255, 0.65);
  --text-muted:         rgba(255, 255, 255, 0.40);
  --text-disabled:      rgba(255, 255, 255, 0.25);

  /* Font Families */
  --font-body:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading:       'Poppins', 'Inter', sans-serif;

  /* Font Sizes */
  --text-xs:   0.70rem;
  --text-sm:   0.825rem;
  --text-base: 0.9375rem;
  --text-md:   1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

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

  /* Border Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl:   0 16px 60px rgba(0, 0, 0, 0.6);
  --shadow-glass: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 20px rgba(0, 0, 0, 0.35);

  /* Easing */
  --ease-out:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce:   cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Liquid Morphism */
  --liquid-cyan:   rgba(0, 217, 255, 0.18);
  --liquid-purple: rgba(168, 85, 247, 0.18);
  --liquid-pink:   rgba(236, 72, 153, 0.12);
  --liquid-gradient: linear-gradient(135deg, #00d9ff, #a855f7, #ec4899, #00d9ff);
  --liquid-gradient-size: 300% 300%;

  /* Transitions */
  --transition-fast:    150ms var(--ease-out);
  --transition-base:    200ms var(--ease-out);
  --transition-slow:    300ms var(--ease-out);
  --transition-slower:  400ms var(--ease-out);

  /* Layout */
  --sidebar-width:      280px;
  --header-height:      64px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-gradient);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background orbs */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  right: -20%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
  animation: orb-float 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -15%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 217, 255, 0.08) 0%, transparent 70%);
  animation: orb-float 20s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.97); }
}

/* ── Glass Panel Utility ─────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
}

.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-glass);
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

p { line-height: 1.65; }

a {
  color: var(--cyan);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
a:hover { opacity: 0.8; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* ── Selection ───────────────────────────────────────────── */
::selection {
  background: rgba(0, 217, 255, 0.25);
  color: var(--text-primary);
}

/* ── Focus Ring ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Utility Classes ─────────────────────────────────────── */
.hidden     { display: none !important; }
.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;
}
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2      { gap: var(--space-2); }
.gap-3      { gap: var(--space-3); }
.gap-4      { gap: var(--space-4); }
.w-full     { width: 100%; }
.relative   { position: relative; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: var(--text-sm); }
.text-xs    { font-size: var(--text-xs); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate   {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Liquid Morphism Utilities ───────────────────────────────── */

/* Morphing blob decorations */
.liquid-blob {
  position: absolute;
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  background: var(--liquid-gradient);
  background-size: var(--liquid-gradient-size);
  filter: blur(40px);
  opacity: 0.18;
  animation:
    liquid-morph 10s ease-in-out infinite,
    gradient-flow 6s ease infinite;
  pointer-events: none;
  z-index: 0;
}

.liquid-blob.blob-sm  { width: 200px; height: 200px; }
.liquid-blob.blob-md  { width: 350px; height: 350px; }
.liquid-blob.blob-lg  { width: 500px; height: 500px; }

.liquid-blob.blob-2 {
  animation-delay: -4s;
  animation-duration: 14s, 8s;
  opacity: 0.12;
}

.liquid-blob.blob-3 {
  animation-delay: -7s;
  animation-duration: 12s, 5s;
  opacity: 0.10;
}

/* Liquid gradient button / accent */
.liquid-gradient-bg {
  background: var(--liquid-gradient);
  background-size: var(--liquid-gradient-size);
  animation: gradient-flow 4s ease infinite;
}

/* Flowing border effect */
.liquid-border {
  position: relative;
}
.liquid-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--liquid-gradient);
  background-size: 200% 200%;
  animation: gradient-flow 3s ease infinite;
  z-index: -1;
  opacity: 0.7;
}

/* Color-shifting glass */
.glass-morph {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid transparent;
  background-clip: padding-box;
  animation: border-color-shift 6s ease-in-out infinite;
}

@keyframes border-color-shift {
  0%   { border-color: rgba(0, 217, 255, 0.2); }
  33%  { border-color: rgba(168, 85, 247, 0.2); }
  66%  { border-color: rgba(236, 72, 153, 0.15); }
  100% { border-color: rgba(0, 217, 255, 0.2); }
}
