/* ══════════════════════════════════════════════════════════════
   Base Styles — Reset, Typography, Body, Scrollbar
   ══════════════════════════════════════════════════════════════ */

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated background — abstract waves + particles ── */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% 90%, hsl(270 85% 65% / 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 10%, hsl(0 90% 55% / 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, hsl(300 80% 65% / 0.04) 0%, transparent 50%);
  animation: bgShift 20s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(circle 2px at 15% 25%, hsl(270 85% 65% / 0.28) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 85% 15%, hsl(0 90% 55% / 0.2) 0%, transparent 100%),
    radial-gradient(circle 2px at 70% 75%, hsl(195 90% 55% / 0.2) 0%, transparent 100%),
    radial-gradient(circle 1px at 30% 80%, hsl(270 85% 65% / 0.18) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 55% 40%, hsl(0 90% 55% / 0.12) 0%, transparent 100%),
    radial-gradient(circle 1px at 90% 60%, hsl(300 80% 65% / 0.15) 0%, transparent 100%),
    radial-gradient(circle 2px at 5% 55%, hsl(270 85% 65% / 0.2) 0%, transparent 100%);
  animation: particleFloat 15s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { opacity: 1; transform: scale(1) translate(0, 0); }
  100% { opacity: 0.8; transform: scale(1.05) translate(-2%, 2%); }
}

@keyframes particleFloat {
  0% { transform: translate(0, 0); opacity: 0.7; }
  50% { transform: translate(10px, -15px); opacity: 1; }
  100% { transform: translate(-5px, 8px); opacity: 0.6; }
}

/* Ensure content is above the background effects */
#app, .auth-page, .chatbot-container, .toast-container {
  position: relative;
  z-index: 1;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 600;
  color: hsl(var(--foreground));
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.5rem; }

a {
  color: hsl(var(--primary));
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

small {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

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

/* ── Borders ── */
*, *::before, *::after {
  border-color: hsl(var(--border));
}

/* ── Selection ── */
::selection {
  background: hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
}

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

::-webkit-scrollbar-track {
  background: hsl(var(--muted));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* ── Utility ── */
.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;
}

.text-gradient-primary {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-secondary {
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glow-primary {
  box-shadow: var(--shadow-glow);
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-neon);
}

.text-muted {
  color: hsl(var(--muted-foreground));
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-3xl {
  font-size: 1.875rem;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-auto { margin-left: auto; }
.mr-2 { margin-right: 0.5rem; }

.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: calc(var(--radius) - 4px); }
.rounded-lg { border-radius: calc(var(--radius) + 4px); }
.rounded-full { border-radius: 9999px; }

.border { border: 1px solid hsl(var(--border)); }
.border-b { border-bottom: 1px solid hsl(var(--border)); }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

.transition { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }

/* ── Animations ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-spin { animation: spin 1s linear infinite; }
.animate-fade-in { animation: fadeIn 0.2s ease-out; }
.animate-slide-up { animation: slideUp 0.3s ease-out; }
.animate-float { animation: float 6s ease-in-out infinite; }
