/* ============================================
   COD Command Center -- Design System
   Adapted from cod-workshop-performance.html
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Backgrounds */
  --bg-page: #08080d;
  --bg-card: #0f1117;
  --bg-card-hover: #161822;
  --bg-elevated: #1a1c28;
  --bg-input: #0c0d14;
  --bg-overlay: rgba(8, 8, 13, 0.85);
  --bg-subtle: rgba(124, 58, 237, 0.04);
  --bg-card-solid: #0f1117;

  /* Borders */
  --border-card: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(124, 58, 237, 0.3);
  --border-focus: #7c3aed;

  /* Cards */
  --radius-card: 16px;

  /* Accent */
  --color-accent: #7c3aed;
  --color-accent-light: #a78bfa;
  --color-accent-ghost: rgba(124, 58, 237, 0.08);
  --color-accent-glow: rgba(124, 58, 237, 0.15);
  --accent-cyan: #22d3ee;
  --accent-gold: #facc15;
  --accent-gold-dim: rgba(250, 204, 21, 0.12);

  /* Sidebar */
  --bg-sidebar: #0f1117;
  --sidebar-active: linear-gradient(135deg, #7c3aed, #a78bfa);
  --sidebar-hover-border: rgba(124, 58, 237, 0.3);
  --sidebar-hover-bg: rgba(124, 58, 237, 0.04);

  /* Status -- all checked against --bg-card #0f1117
     success   #22c55e ~  8.0:1  AAA
     danger    #ef4444 ~  5.1:1  AA
     warning   #f59e0b ~  9.1:1  AAA
     neutral   #94a3b8 ~  7.5:1  (was #64748b ~3.4:1 -- failed AA for small delta text) */
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-neutral: #94a3b8;
  --status-up-bg: rgba(34, 197, 94, 0.1);
  --status-down-bg: rgba(239, 68, 68, 0.1);
  --status-warning-bg: rgba(245, 158, 11, 0.1);
  --status-neutral-bg: rgba(100, 116, 139, 0.08);

  /* Text -- contrast ratios against --bg-page #08080d
     primary    #f1f5f9  ~ 16.7:1  (AAA)
     secondary  #94a3b8  ~  7.6:1  (AAA)  -- was #7c8da4 ~5.5:1
     muted      #8b95a5  ~  5.6:1  (AA normal text)  -- was #475569 ~2.7:1 (FAILED)
     disabled   #475569  ~  2.7:1  (used only on truly inert / decorative chrome)
     WCAG 1.4.3 Contrast Minimum: AA = 4.5:1 normal, 3:1 large.  */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #8b95a5;
  --text-disabled: #475569;
  --text-inverse: #08080d;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-card);
  --shadow-elevated: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-card);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.06);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.4);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-display: 'Manrope', sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.6875rem;
  --text-sm: 0.75rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* Dot-grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.3;
}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-accent { color: var(--color-accent); }
.text-mono { font-family: var(--font-mono); }

/* Card base -- solid dark surface, no blur */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Selection */
::selection {
  background: rgba(124, 58, 237, 0.4);
  color: #fff;
}

/* Focus -- WCAG 2.4.7 Focus Visible + 1.4.11 Non-text Contrast.
   Two-layer ring: bright cyan for visibility on any background +
   dark inset so the ring stays visible on the accent purple buttons too.
   --accent-cyan (#22d3ee) lands at ~9:1 contrast against bg-page. */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(8, 8, 13, 0.85);
}

/* Buttons / links inside the active sidebar pill need higher-contrast ring */
.nav-item.active:focus-visible,
.auth-btn:focus-visible,
.dp-btn--primary:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.6);
}

/* Honor user's reduced-motion preference -- disable card fade-up, spinner,
   sidebar slide transitions, etc. (WCAG 2.3.3 Animation from Interactions) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utility */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link: visually hidden until focused.
   WCAG 2.4.1 Bypass Blocks. Sits at z-index above sidebar/modals. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  padding: 10px 16px;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 1000;
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: -4px;
}
