/* ═══════════════════════════════════════════════════════════════════════
   NXP v3.1 — Neural Pulse Identity System
   "Command center energy meets warehouse reality"
   
   V1 says "here's your data."
   V3.1 says "here's what the AI is doing with your data right now."
   ═══════════════════════════════════════════════════════════════════════ */

/* ── THE NEURAL PULSE ─────────────────────────────────────────────────
   The signature. A faint crimson ripple across the viewport every 8-10s.
   The system is alive. When ONE makes a decision, the pulse brightens.
   On critical events, the rhythm quickens.
   ──────────────────────────────────────────────────────────────────── */
@keyframes neural-heartbeat {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
@keyframes neural-ripple {
  0% { transform: scale(0.8); opacity: 0.06; }
  50% { transform: scale(1.2); opacity: 0.02; }
  100% { transform: scale(1.6); opacity: 0; }
}

.neural-pulse-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.neural-pulse-layer .np-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120vmax;
  height: 120vmax;
  margin: -60vmax 0 0 -60vmax;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(232,35,74,0.03) 0%, transparent 70%);
  animation: neural-ripple 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform, opacity;
}
.neural-pulse-layer .np-ring:nth-child(2) {
  animation-delay: -3.3s;
  background: radial-gradient(ellipse, rgba(159,108,247,0.015) 0%, transparent 70%);
}
.neural-pulse-layer .np-ring:nth-child(3) {
  animation-delay: -6.6s;
  background: radial-gradient(ellipse, rgba(0,194,240,0.01) 0%, transparent 70%);
}

/* Pulse intensifies on AI events — add .np-active to layer */
.neural-pulse-layer.np-event .np-ring {
  animation-duration: 3s;
}
.neural-pulse-layer.np-event .np-ring:first-child {
  background: radial-gradient(ellipse, rgba(232,35,74,0.06) 0%, transparent 70%);
}

/* Pulse quickens on critical — add .np-critical */
.neural-pulse-layer.np-critical .np-ring {
  animation-duration: 2s;
}
.neural-pulse-layer.np-critical .np-ring:first-child {
  background: radial-gradient(ellipse, rgba(232,69,69,0.08) 0%, transparent 60%);
}

/* ── STAGGERED PAGE ASSEMBLY ──────────────────────────────────────────
   Every page fades in with 200ms stagger. The AI is "assembling" your view.
   ──────────────────────────────────────────────────────────────────── */
@keyframes assemble {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.np-assemble {
  opacity: 0;
  animation: assemble 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.np-a1 { animation-delay: 0s; }
.np-a2 { animation-delay: 0.08s; }
.np-a3 { animation-delay: 0.16s; }
.np-a4 { animation-delay: 0.24s; }
.np-a5 { animation-delay: 0.32s; }
.np-a6 { animation-delay: 0.4s; }
.np-a7 { animation-delay: 0.48s; }
.np-a8 { animation-delay: 0.56s; }

/* ── AI DECISION CARDS ────────────────────────────────────────────────
   Urgency tiers: critical (red pulse), warning (amber), routine (blue).
   Left-edge color accent. Critical cards pulse subtly.
   Shows: what ONE decided, why, confidence level, approve/override.
   ──────────────────────────────────────────────────────────────────── */
.ai-decision {
  background: var(--s1, #08080B);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 12px 14px 12px 18px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s;
}
.ai-decision:hover {
  border-color: rgba(255,255,255,0.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Left edge urgency stripe */
.ai-decision::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}
.ai-decision.critical::before { background: var(--rd, #E84545); }
.ai-decision.warning::before { background: var(--am, #E5A011); }
.ai-decision.routine::before { background: var(--bl, #00C2F0); }
.ai-decision.ai-auto::before { background: var(--p, #9F6CF7); }

/* Critical pulse */
@keyframes urgency-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50% { box-shadow: inset 0 0 12px rgba(232,69,69,0.06); }
}
.ai-decision.critical {
  animation: urgency-pulse 3s ease-in-out infinite;
  border-color: rgba(232,69,69,0.08);
}

.ai-decision-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ai-decision-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.ai-decision.critical .ai-decision-icon { background: rgba(232,69,69,0.08); }
.ai-decision.warning .ai-decision-icon { background: rgba(229,160,17,0.08); }
.ai-decision.routine .ai-decision-icon { background: rgba(0,194,240,0.08); }
.ai-decision.ai-auto .ai-decision-icon { background: rgba(159,108,247,0.08); }

.ai-decision-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  flex: 1;
}
.ai-decision-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: var(--t3, #4A4A54);
}
.ai-decision-body {
  font-size: 0.72rem;
  color: var(--t2, #7C7C86);
  line-height: 1.5;
  margin-bottom: 8px;
}
.ai-decision-reason {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: var(--t3, #4A4A54);
  padding: 4px 8px;
  background: rgba(255,255,255,0.015);
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.6;
}

/* Confidence bar */
.ai-confidence {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.ai-confidence-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}
.ai-confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.ai-confidence-fill.high { background: var(--g, #2DD4A8); }
.ai-confidence-fill.med { background: var(--am, #E5A011); }
.ai-confidence-fill.low { background: var(--rd, #E84545); }
.ai-confidence-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: var(--t3);
  min-width: 28px;
  text-align: right;
}

/* Decision actions */
.ai-decision-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ai-decision-actions .btn-approve {
  font-family: 'Figtree', sans-serif;
  font-weight: 500;
  font-size: 0.62rem;
  padding: 4px 12px;
  border-radius: 100px;
  border: none;
  background: var(--g, #2DD4A8);
  color: #050507;
  cursor: pointer;
  transition: all 0.15s;
}
.ai-decision-actions .btn-approve:hover { filter: brightness(1.1); }
.ai-decision-actions .btn-override {
  font-family: 'Figtree', sans-serif;
  font-weight: 500;
  font-size: 0.62rem;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: var(--t2, #7C7C86);
  cursor: pointer;
  transition: all 0.15s;
}
.ai-decision-actions .btn-override:hover { border-color: rgba(255,255,255,0.12); color: var(--t1); }

/* Provider indicator */
.ai-provider-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.45rem;
  color: var(--t3);
  margin-left: auto;
  padding: 2px 6px;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* ── PREDICTION PANEL ─────────────────────────────────────────────────
   Shows the future with confidence. Each prediction has an action button.
   "D07 will exceed dwell at 14:45, 76% confidence" → [Pre-assign dock]
   ──────────────────────────────────────────────────────────────────── */
.prediction-card {
  background: var(--s2, #0D0D11);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.prediction-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.prediction-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.prediction-dot.high { background: var(--rd); }
.prediction-dot.med { background: var(--am); }
.prediction-dot.low { background: var(--g); }

.prediction-text {
  font-size: 0.7rem;
  color: var(--t1);
  flex: 1;
}
.prediction-confidence {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 500;
}
.prediction-confidence.high { color: var(--g); }
.prediction-confidence.med { color: var(--am); }
.prediction-confidence.low { color: var(--rd); }

.prediction-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  color: var(--t3);
  margin-bottom: 6px;
}
.prediction-action {
  font-family: 'Figtree', sans-serif;
  font-weight: 500;
  font-size: 0.58rem;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid rgba(159,108,247,0.1);
  background: rgba(159,108,247,0.04);
  color: var(--p, #9F6CF7);
  cursor: pointer;
  transition: all 0.15s;
}
.prediction-action:hover {
  background: rgba(159,108,247,0.08);
  border-color: rgba(159,108,247,0.2);
}

/* ── WEIGHTED LIVE FEED ───────────────────────────────────────────────
   Signal vs noise. Dock assignments pop. Scan events are dimmed.
   Important events flash on entry.
   ──────────────────────────────────────────────────────────────────── */
@keyframes feed-flash {
  0% { background: rgba(232,35,74,0.06); }
  100% { background: transparent; }
}

.feed-item-v3 {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  transition: background 0.3s;
}
.feed-item-v3:last-child { border: none; }

/* Signal weight */
.feed-item-v3.signal {
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 6px;
}
.feed-item-v3.signal.new {
  animation: feed-flash 1.5s ease-out;
}
.feed-item-v3.signal .feed-v3-text {
  font-size: 0.72rem;
  color: var(--t1);
  font-weight: 500;
}
.feed-item-v3.signal .feed-v3-text b {
  color: var(--t1);
  font-weight: 600;
}

/* Noise (routine events like scans) */
.feed-item-v3.noise .feed-v3-text {
  font-size: 0.62rem;
  color: var(--t3);
}
.feed-item-v3.noise .feed-v3-text b {
  color: var(--t2);
  font-weight: 500;
}
.feed-item-v3.noise .feed-v3-dot {
  width: 4px;
  height: 4px;
  margin-top: 5px;
}

.feed-v3-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.feed-v3-dot.ok { background: var(--g); }
.feed-v3-dot.warn { background: var(--am); }
.feed-v3-dot.err { background: var(--rd); }
.feed-v3-dot.info { background: var(--bl); }
.feed-v3-dot.ai { background: var(--p); }

.feed-v3-text {
  font-size: 0.68rem;
  color: var(--t2);
  line-height: 1.4;
  flex: 1;
}
.feed-v3-text b { color: var(--t1); font-weight: 500; }
.feed-v3-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.45rem;
  color: var(--t3);
  margin-top: 2px;
}

/* ── OVERRIDE LEARNING LOOP ───────────────────────────────────────────
   When a user overrides AI, capture why. Quick-select options.
   ──────────────────────────────────────────────────────────────────── */
.override-modal {
  background: var(--s1);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  max-width: 340px;
}
.override-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.override-sub {
  font-size: 0.7rem;
  color: var(--t2);
  margin-bottom: 12px;
}
.override-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.override-opt {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: all 0.15s;
}
.override-opt:hover,
.override-opt.selected {
  border-color: var(--c, #E8234A);
  color: var(--c, #E8234A);
  background: rgba(232,35,74,0.04);
}
.override-note {
  width: 100%;
  background: var(--s2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.68rem;
  color: var(--t1);
  resize: none;
  min-height: 48px;
}
.override-note:focus { outline: none; border-color: rgba(232,35,74,0.18); }
.override-note::placeholder { color: var(--t3); }

/* ── SKELETON SHIMMER ─────────────────────────────────────────────────
   Loading states. Not blank. Skeleton shapes with shimmer.
   ──────────────────────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--s2, #0D0D11) 25%,
    rgba(255,255,255,0.03) 50%,
    var(--s2, #0D0D11) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-text { height: 10px; margin-bottom: 6px; }
.skeleton-text.w60 { width: 60%; }
.skeleton-text.w80 { width: 80%; }
.skeleton-text.w40 { width: 40%; }
.skeleton-kpi { height: 32px; width: 80px; border-radius: 8px; }
.skeleton-card { height: 80px; border-radius: 10px; margin-bottom: 8px; }
.skeleton-row { height: 36px; margin-bottom: 2px; }

/* ── EMPTY STATES ─────────────────────────────────────────────────────
   Dashed border + CTA. Never blank.
   ──────────────────────────────────────────────────────────────────── */
.empty-v3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  border: 1.5px dashed rgba(255,255,255,0.06);
  border-radius: 14px;
  margin: 16px;
}
.empty-v3-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--s2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.empty-v3-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.empty-v3-desc {
  font-size: 0.72rem;
  color: var(--t2);
  max-width: 320px;
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ── MAGNETIC TILT ────────────────────────────────────────────────────
   3D perspective tilt on card hover. Subtle. Spring-like.
   ──────────────────────────────────────────────────────────────────── */
.tilt-card {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
  perspective: 800px;
}

/* ── OVERSIZED METRICS (Stripe energy) ────────────────────────────────
   KPIs that demand attention. Big numbers. Tight labels.
   ──────────────────────────────────────────────────────────────────── */
.metric-xl {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--t3);
  margin-top: 4px;
}

/* ── ONE WATERMARK ────────────────────────────────────────────────────
   Tiny "ONE" tag on AI-generated elements.
   ──────────────────────────────────────────────────────────────────── */
.one-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.4rem;
  font-weight: 500;
  color: rgba(159,108,247,0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── AUTOMATION QUEUE PROGRESS ─────────────────────────────────────── */
.auto-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auto-progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}
.auto-progress-fill {
  height: 100%;
  background: var(--p);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.22,1,0.36,1);
}
.auto-progress-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  color: var(--t3);
  min-width: 36px;
  text-align: right;
}

/* ── PUBLIC PAGE: LIVE COUNTER ─────────────────────────────────────── */
.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(8,8,11,0.6);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 100px;
  backdrop-filter: blur(12px);
}
.live-counter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g, #2DD4A8);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-counter-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--t1, #E8E8EC);
}
.live-counter-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: var(--t3, #4A4A54);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── FONT WEIGHT HIERARCHY FIX ─────────────────────────────────────── 
   Headlines: 700-800. Body: 400. Extra contrast for scanning.
   ──────────────────────────────────────────────────────────────────── */
h1, h2, h3, .hdr-title, .page-title, .sec-title,
.wh-sp-h, .inv-sp-h, .p-hero h1, .wh-hero h1 {
  font-weight: 800;
}
body, p, .feed-v3-text, .ai-decision-body, .prediction-text {
  font-weight: 400;
}
