/* ============================================
   Base Styles — Reset + Typography + Utilities
   ============================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--slate-900);
  background-color: var(--slate-50);
  overflow: hidden;
  height: 100vh;
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--slate-900);
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.4;
  color: var(--slate-900);
}

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); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--navy-700);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--navy-900); }

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

small { font-size: var(--text-sm); color: var(--slate-600); }

/* Selection */
::selection {
  background: var(--navy-100);
  color: var(--navy-900);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

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

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

/* Lists */
ul, ol { list-style: none; }

/* Tables */
table { border-collapse: collapse; width: 100%; }

/* Utility classes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.font-heading { font-family: var(--font-heading); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

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

.text-slate-400 { color: var(--slate-400); }
.text-slate-500 { color: var(--slate-500); }
.text-slate-600 { color: var(--slate-600); }
.text-slate-900 { color: var(--slate-900); }
.text-navy { color: var(--navy-900); }
.text-amber { color: var(--amber-700); }
.text-success { color: var(--success-600); }
.text-error { color: var(--error-600); }
.text-violet { color: var(--violet-600); }

.bg-white { background: var(--white); }
.bg-slate-50 { background: var(--slate-50); }
.bg-slate-100 { background: var(--slate-100); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

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

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

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.ml-auto { margin-left: auto; }

.rounded { border-radius: var(--radius-md); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

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

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }

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

.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;
}

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

.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }

/* Loading screen */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--white);
}
.loading-content { text-align: center; }
.loading-logo { margin: 0 auto var(--space-4); }
.loading-text {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--slate-600);
  margin-bottom: var(--space-6);
}
.loading-bar {
  width: 200px; height: 3px;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%; width: 30%;
  background: var(--navy-700);
  border-radius: var(--radius-full);
  animation: loading 1.5s ease-in-out infinite;
}
@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Fade animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes aiBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
