/* =========================================================================
   Nik Neural AI Inc. — Sovereign Design System & M3 Token Framework
   Official 5-Color Brand Palette:
   #0a1128 : Canvas (Deep Space Navy)
   #ff6d00 : Electric Vibrant Orange (Primary Accent & Energy)
   #0e1736 : Surface & Cards (Elevated Navy)
   #ffffff : Pure Crisp White (Text & High Contrast)
   #1282a2 : Tech Cyan/Teal (Secondary Accent & Borders)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Bricolage+Grotesque:opsz,wght@12..96,400;500;600;700;800&display=swap');

:root {
  /* Core Brand 5-Color Hierarchy */
  --nn-canvas: #0a1128;
  --nn-surface: #0e1736;
  --nn-orange: #ff6d00;
  --nn-cyan: #1282a2;
  --nn-white: #ffffff;

  /* Material Design 3 (M3) Semantic Role Mapping */
  --md-sys-color-primary: #ff6d00;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: rgba(255, 109, 0, 0.16);
  --md-sys-color-on-primary-container: #ff9138;

  --md-sys-color-secondary: #1282a2;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: rgba(18, 130, 162, 0.16);
  --md-sys-color-on-secondary-container: #48c3e6;

  --md-sys-color-surface: #0a1128;
  --md-sys-color-on-surface: #ffffff;
  --md-sys-color-surface-dim: #070c1e;
  --md-sys-color-surface-bright: #142048;
  --md-sys-color-surface-container-lowest: #050917;
  --md-sys-color-surface-container-low: #070d22;
  --md-sys-color-surface-container: #0e1736;
  --md-sys-color-surface-container-high: #131d42;
  --md-sys-color-surface-container-highest: #1a2756;

  --md-sys-color-outline: rgba(255, 255, 255, 0.14);
  --md-sys-color-outline-variant: rgba(18, 130, 162, 0.28);

  --md-sys-color-error: #ef4444;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: rgba(239, 68, 68, 0.18);
  --md-sys-color-on-error-container: #fca5a5;

  --md-sys-color-success: #10b981;
  --md-sys-color-success-container: rgba(16, 185, 129, 0.16);

  /* Typography Scale */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Shapes & Corners */
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-s: 8px;
  --md-sys-shape-corner-m: 12px;
  --md-sys-shape-corner-l: 16px;
  --md-sys-shape-corner-xl: 24px;
  --md-sys-shape-corner-full: 9999px;

  /* Shadows & Glows */
  --glow-orange: 0 0 24px rgba(255, 109, 0, 0.35);
  --glow-cyan: 0 0 24px rgba(18, 130, 162, 0.35);
  --shadow-sm: 0 2px 8px rgba(5, 9, 23, 0.5);
  --shadow-md: 0 8px 28px rgba(5, 9, 23, 0.6);
  --shadow-lg: 0 16px 48px rgba(5, 9, 23, 0.75);

  --transition-fast: 150ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--nn-canvas);
  color: var(--nn-white);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

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

/* Typography Hierarchy */
.md-display-large {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.md-display-medium {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.md-headline-large {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.md-headline-medium {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}

.md-title-large {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
}

.md-title-medium {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #ffffff;
}

.md-body-large {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.86);
}

.md-body-medium {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.74);
}

.md-label-large {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.md-label-small {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Layout Containers */
.m3-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Glass Navigation */
.m3-top-app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 17, 40, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  padding: 14px 0;
  transition: all var(--transition-normal);
}

.m3-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nn-orange);
}

.brand-word {
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-word-accent {
  color: var(--nn-orange);
}

.m3-nav-links {
  display: flex;
  list-style: none;
  gap: 28px;
  align-items: center;
}

.m3-nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  position: relative;
  padding: 6px 0;
}

.m3-nav-links a:hover {
  color: var(--nn-orange);
}

/* Buttons */
.m3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--md-sys-shape-corner-full);
  padding: 10px 22px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

/* Primary Electric Orange Button */
.m3-btn-filled, .btn-orange {
  background: var(--nn-orange);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(255, 109, 0, 0.32);
}

.m3-btn-filled:hover, .btn-orange:hover {
  background: #ff852e;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(255, 109, 0, 0.45);
}

/* Secondary Tech Teal Button */
.m3-btn-tonal, .btn-cyan {
  background: rgba(18, 130, 162, 0.18);
  border: 1px solid rgba(18, 130, 162, 0.45);
  color: #ffffff;
}

.m3-btn-tonal:hover, .btn-cyan:hover {
  background: rgba(18, 130, 162, 0.32);
  border-color: var(--nn-cyan);
  transform: translateY(-1px);
}

/* Outlined Glass Button */
.m3-btn-outlined {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.m3-btn-outlined:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.m3-btn-text {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 8px 12px;
}

.m3-btn-text:hover {
  color: var(--nn-orange);
}

/* Eyebrow & Trust Badges */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(14, 23, 54, 0.85);
  border: 1px solid rgba(18, 130, 162, 0.35);
  padding: 6px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(5, 9, 23, 0.4);
}

.eyebrow-dot, .dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

.eyebrow-dot-orange {
  background: var(--nn-orange);
  box-shadow: 0 0 10px var(--nn-orange);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Chips & Tags */
.m3-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 23, 54, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.85);
}

.m3-chip-primary, .chip-orange {
  background: rgba(255, 109, 0, 0.12);
  border-color: rgba(255, 109, 0, 0.35);
  color: var(--nn-orange);
}

.m3-chip-cyan, .chip-cyan {
  background: rgba(18, 130, 162, 0.15);
  border-color: rgba(18, 130, 162, 0.4);
  color: #48c3e6;
}

.m3-chip-green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

/* Cards & Surfaces */
.m3-card {
  background: var(--nn-surface);
  border-radius: var(--md-sys-shape-corner-l);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.m3-card:hover {
  border-color: rgba(18, 130, 162, 0.35);
  box-shadow: var(--shadow-md);
}

.m3-card-elevated {
  background: linear-gradient(180deg, #0e1736 0%, #0a1128 100%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: var(--shadow-md);
}

.m3-card-highlighted {
  border: 2px solid var(--nn-orange) !important;
  box-shadow: 0 8px 32px rgba(255, 109, 0, 0.22);
}

/* Grids */
.m3-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.m3-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.m3-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .m3-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .m3-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .m3-grid-4, .m3-grid-3, .m3-grid-2 { grid-template-columns: 1fr; }
  .m3-nav-links { display: none; }
}

/* Live Waveform Canvas Box */
.m3-waveform-box {
  background: linear-gradient(180deg, #0e1736 0%, #080e22 100%);
  border: 1px solid rgba(18, 130, 162, 0.35);
  border-radius: var(--md-sys-shape-corner-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(18, 130, 162, 0.12);
}

.m3-waveform-canvas {
  width: 100%;
  height: 96px;
  background: #060b1b;
  border-radius: var(--md-sys-shape-corner-m);
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Telemetry Card in Hero */
.hero-telemetry-card {
  background: rgba(14, 23, 54, 0.85);
  border: 1px solid rgba(18, 130, 162, 0.32);
  border-radius: var(--md-sys-shape-corner-l);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.hero-telemetry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-telemetry-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--nn-cyan);
  font-weight: 700;
}

.hero-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.hero-stat-box {
  background: rgba(6, 11, 27, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 14px 16px;
}

.hero-stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  display: block;
  line-height: 1.2;
}

.hero-stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  margin-top: 4px;
}

.hero-telemetry-code {
  background: #060b1b;
  border-radius: var(--md-sys-shape-corner-s);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Controls */
.m3-form-group {
  margin-bottom: 20px;
}

.m3-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
}

.m3-input, .m3-select, .m3-textarea {
  width: 100%;
  background: #060b1b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: #ffffff;
  transition: all var(--transition-fast);
  outline: none;
}

.m3-input:focus, .m3-select:focus, .m3-textarea:focus {
  border-color: var(--nn-cyan);
  box-shadow: 0 0 0 3px rgba(18, 130, 162, 0.25);
}

.m3-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Linear Progress Meter */
.m3-linear-progress {
  width: 100%;
  height: 8px;
  background: #060b1b;
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.m3-linear-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--nn-cyan) 0%, var(--nn-orange) 100%);
  border-radius: var(--md-sys-shape-corner-full);
  transition: width 0.4s ease;
}

/* Modals */
.m3-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 9, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.m3-modal-backdrop.is-open {
  display: flex;
}

.m3-modal-dialog {
  background: var(--nn-surface);
  border: 1px solid rgba(18, 130, 162, 0.4);
  border-radius: var(--md-sys-shape-corner-xl);
  padding: 36px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(18, 130, 162, 0.15);
  animation: modal-enter 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Alerts & Snackbars */
.m3-snackbar {
  background: var(--nn-surface);
  border: 1px solid rgba(255, 109, 0, 0.4);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

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

th {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: rgba(255, 255, 255, 0.9);
}

/* Code & Pre */
code, pre {
  font-family: var(--font-mono);
}
