/* SensEval — Design System v2
   Minimalist Swiss-style with charcoal primary + teal accent.
   Science-forward, data-first, fully responsive. */

/* ── Design Tokens: Light ── */
:root {
  /* Surfaces */
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F5F5F5;

  /* Text */
  --color-text: #1A1A1A;
  --color-text-secondary: #6B7280;

  /* Brand */
  --color-primary: #2D2D2D;
  --color-primary-hover: #404040;
  --color-accent: #0F766E;
  --color-accent-hover: #0D6D66;

  /* Semantic */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-destructive: #DC2626;
  --color-destructive-bg: #FEF2F2;
  --color-info: #2563EB;
  --color-info-bg: #EFF6FF;

  /* Borders */
  --color-border: #E5E7EB;
  --color-border-strong: #D1D5DB;

  /* Muted */
  --color-muted: #F3F4F6;
  --color-muted-foreground: #6B7280;

  /* Focus ring */
  --color-ring: #0F766E;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Typography */
  --font-sans: 'Exo', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, monospace;
}

/* ── Design Tokens: Dark ── */
:root[data-theme="dark"] {
  --color-bg: #0C0C0C;
  --color-surface: #1A1A1A;
  --color-surface-hover: #242424;

  --color-text: #F5F5F5;
  --color-text-secondary: #9CA3AF;

  --color-primary: #E5E5E5;
  --color-primary-hover: #FAFAFA;

  --color-accent: #2DD4BF;
  --color-accent-hover: #5EEAD4;

  --color-success: #34D399;
  --color-success-bg: #022C22;
  --color-warning: #FBBF24;
  --color-warning-bg: #2D1B00;
  --color-destructive: #F87171;
  --color-destructive-bg: #2D0000;
  --color-info: #60A5FA;
  --color-info-bg: #001A33;

  --color-border: #2A2A2A;
  --color-border-strong: #404040;
  --color-muted: #1F1F1F;
  --color-muted-foreground: #9CA3AF;

  --color-ring: #2DD4BF;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0C0C0C;
    --color-surface: #1A1A1A;
    --color-surface-hover: #242424;

    --color-text: #F5F5F5;
    --color-text-secondary: #9CA3AF;

    --color-primary: #E5E5E5;
    --color-primary-hover: #FAFAFA;

    --color-accent: #2DD4BF;
    --color-accent-hover: #5EEAD4;

    --color-success: #34D399;
    --color-success-bg: #022C22;
    --color-warning: #FBBF24;
    --color-warning-bg: #2D1B00;
    --color-destructive: #F87171;
    --color-destructive-bg: #2D0000;
    --color-info: #60A5FA;
    --color-info-bg: #001A33;

    --color-border: #2A2A2A;
    --color-border-strong: #404040;
    --color-muted: #1F1F1F;
    --color-muted-foreground: #9CA3AF;

    --color-ring: #2DD4BF;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  }
}

/* ── Base Styles ── */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

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

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: var(--color-surface);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: var(--space-sm);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

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

/* ── Status dots ── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-pending  { background-color: #9CA3AF; }
.status-dot-active   { background-color: var(--color-warning); animation: pulse 1.5s ease-in-out infinite; }
.status-dot-submitted { background-color: var(--color-success); }

/* ── SVG text inheritance ── */
svg text {
  font-family: inherit;
}

/* ── Responsive table wrapper ── */
@media (max-width: 640px) {
  .table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Toast ── */
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
.toast-enter {
  animation: toastSlideIn var(--transition-base) ease forwards;
}
.toast-exit {
  animation: toastSlideOut var(--transition-base) ease forwards;
}

/* ── Skeleton loader ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--color-muted) 25%, var(--color-border) 50%, var(--color-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Screen reader only ── */
.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;
}
