/* === RESET & BASE === */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Sans:wght@400;500;600;700&display=swap');

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

:root {
  /* Colors — Dark Mode */
  --bg-primary: #0A0A0F;
  --bg-secondary: rgba(20, 20, 25, 0.85);
  --bg-tertiary: #101016;
  --bg-card: #141419;
  --bg-card-hover: #1A1A22;
  --bg-input: #1C1C24;
  --bg-overlay: rgba(0, 0, 0, 0.55);

  --text-primary: #E8E8ED;
  --text-secondary: #8E8E96;
  --text-muted: #55555E;
  --text-inverse: #0A0A0F;

  --accent: #007AFF;
  --accent-hover: #3395FF;
  --accent-glow: rgba(0, 122, 255, 0.12);
  --accent-glow-strong: rgba(0, 122, 255, 0.22);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);
  --border-accent: rgba(0, 122, 255, 0.30);

  --success: #30D158;
  --warning: #FFD60A;
  --danger: #FF453A;
  --info: #64D2FF;

  --critical-bg: rgba(255, 69, 58, 0.10);
  --critical-border: rgba(255, 69, 58, 0.18);
  --high-bg: rgba(255, 214, 10, 0.10);
  --high-border: rgba(255, 214, 10, 0.18);
  --medium-bg: rgba(100, 210, 255, 0.10);
  --medium-border: rgba(100, 210, 255, 0.18);
  --low-bg: rgba(85, 85, 94, 0.10);
  --low-border: rgba(85, 85, 94, 0.18);

  /* Typography — DM Sans + Instrument Sans */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Instrument Sans', 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.1875rem;
  --text-2xl: 1.375rem;
  --text-3xl: 1.75rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --max-width: 1200px;

  /* Transitions — Spring-feel with cubic-bezier */
  --transition-fast: 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-base: 320ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows — Subtle for dark mode */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.20), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.15), 0 10px 24px rgba(0, 0, 0, 0.18);
  --shadow-xl: 0 8px 12px rgba(0, 0, 0, 0.15), 0 20px 40px rgba(0, 0, 0, 0.22);
  --shadow-glow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  letter-spacing: -0.01em;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); font-weight: 700; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { color: var(--text-secondary); }

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

code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--bg-input);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* === LAYOUT === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.page-content {
  flex: 1;
  padding: var(--space-xl) 0;
}

/* === UTILITIES === */
.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-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

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

/* Focus visible */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35);
  border-radius: var(--radius-sm);
}

/* Animations — Spring-feel */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

.animate-fade-in {
  animation: fadeIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.animate-slide-up {
  animation: slideUp 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
