/* Custom utilities and variables for Sentinel */

:root {
  /* Colors from specs */
  --color-bg-primary: #0a0e17;
  --color-bg-secondary: #111827;
  --color-bg-tertiary: #1a2332;
  --color-border: #1e293b;

  --color-text-primary: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;

  --color-accent-blue: #3b82f6;
  --color-accent-blue-hover: #2563eb;
  --color-accent-cyan: #06b6d4;

  --color-threat-critical: #ef4444;
  --color-threat-high: #f97316;
  --color-threat-medium: #eab308;
  --color-threat-low: #22c55e;
  --color-threat-info: #6366f1;
}

/* Tailwind configuration extensions via @layer or direct classes since we use CDN */
.bg-primary {
  background-color: var(--color-bg-primary);
}
.bg-secondary {
  background-color: var(--color-bg-secondary);
}
.bg-tertiary {
  background-color: var(--color-bg-tertiary);
}
.bg-space {
  background-color: #050810;
}
.bg-space-80 {
  background-color: rgba(5, 8, 16, 0.8);
}

.text-primary {
  color: var(--color-text-primary);
}
.text-secondary {
  color: var(--color-text-secondary);
}
.text-muted {
  color: var(--color-text-muted);
}

.border-divider {
  border-color: var(--color-border);
}

.text-accent-blue {
  color: var(--color-accent-blue);
}
.bg-accent-blue {
  background-color: var(--color-accent-blue);
}
.border-accent-blue {
  border-color: var(--color-accent-blue);
}

.text-accent-cyan {
  color: var(--color-accent-cyan);
}
.bg-accent-cyan {
  background-color: var(--color-accent-cyan);
}
.border-accent-cyan {
  border-color: var(--color-accent-cyan);
}

/* Threat colors */
.text-threat-critical {
  color: var(--color-threat-critical);
}
.bg-threat-critical {
  background-color: var(--color-threat-critical);
}
.border-threat-critical {
  border-color: var(--color-threat-critical);
}

.text-threat-high {
  color: var(--color-threat-high);
}
.bg-threat-high {
  background-color: var(--color-threat-high);
}
.border-threat-high {
  border-color: var(--color-threat-high);
}

.text-threat-medium {
  color: var(--color-threat-medium);
}
.bg-threat-medium {
  background-color: var(--color-threat-medium);
}
.border-threat-medium {
  border-color: var(--color-threat-medium);
}

.text-threat-low {
  color: var(--color-threat-low);
}
.bg-threat-low {
  background-color: var(--color-threat-low);
}
.border-threat-low {
  border-color: var(--color-threat-low);
}

.text-threat-info {
  color: var(--color-threat-info);
}
.bg-threat-info {
  background-color: var(--color-threat-info);
}
.border-threat-info {
  border-color: var(--color-threat-info);
}

/* Fonts */
.font-inter {
  font-family: "Inter", sans-serif;
}
.font-jetbrains {
  font-family: "JetBrains Mono", monospace;
}
.text-10 {
  font-size: 10px;
}
.text-11 {
  font-size: 11px;
}
.text-13 {
  font-size: 13px;
}

/* Clamp utilities for Tailwind CDN build (plugin not present) */
.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-1 {
  -webkit-line-clamp: 1;
}
.line-clamp-2 {
  -webkit-line-clamp: 2;
}
.line-clamp-3 {
  -webkit-line-clamp: 3;
}

/* Dense layout helpers */
.compact-panel-title {
  font-size: 13px;
  margin-bottom: 8px;
}
.compact-feed-card {
  padding: 10px;
}
.compact-feed-meta {
  font-size: 10px;
}

.timeline-context-panel {
  box-shadow: inset 0 1px 0 rgba(96, 165, 250, 0.12);
}

.timeline-reference-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  background: rgba(15, 23, 42, 0.55);
  color: var(--color-text-secondary);
}

.timeline-reference-chip strong {
  color: var(--color-text-primary);
}

.feed-card-age-fresh {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.18), 0 0 24px rgba(34, 197, 94, 0.1);
}

.feed-card-age-recent {
  opacity: 0.96;
}

.feed-card-age-stale {
  opacity: 0.84;
  filter: saturate(0.92);
}

.feed-card-age-older {
  opacity: 0.74;
  filter: saturate(0.82);
}

.feed-card-replay-focus {
  position: relative;
}

.feed-card-replay-focus::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 0.5rem;
  border: 1px solid rgba(6, 182, 212, 0.28);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.12), 0 0 22px rgba(6, 182, 212, 0.08);
}

.replay-age-label {
  color: var(--color-text-muted);
}

.replay-age-label strong {
  color: var(--color-text-primary);
}

/* Embedded video cards */
.live-feed-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 6px;
  background: #000;
}

/* Briefing loading skeleton */
@keyframes briefingShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.briefing-skeleton-line {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.12) 20%,
    rgba(148, 163, 184, 0.35) 50%,
    rgba(148, 163, 184, 0.12) 80%
  );
  background-size: 200% 100%;
  animation: briefingShimmer 1.4s linear infinite;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Animations */
@keyframes ticker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  } /* Assumes duplicated content for smooth scoll */
}
.animate-ticker {
  animation: ticker 36s linear infinite;
}
.animate-ticker:hover {
  animation-play-state: paused;
}

/* Base styles */
body {
  font-family: "Inter", sans-serif;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
}

/* Active filter state */
.filter-active-critical {
  background-color: var(--color-threat-critical);
  color: white;
  border-color: var(--color-threat-critical);
}
.filter-active-high {
  background-color: var(--color-threat-high);
  color: white;
  border-color: var(--color-threat-high);
}
.filter-active-medium {
  background-color: var(--color-threat-medium);
  color: white;
  border-color: var(--color-threat-medium);
}
.filter-active-low {
  background-color: var(--color-threat-low);
  color: white;
  border-color: var(--color-threat-low);
}
.filter-active-info {
  background-color: var(--color-threat-info);
  color: white;
  border-color: var(--color-threat-info);
}

/* Panel Glow Overlay */
.panel-glow:focus-within {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.05); /* very subtle blue glow */
}

/* Markdown prose overrides for dark theme */
.prose-invert p,
.prose-invert blockquote {
  color: var(--color-text-primary);
}
.prose-invert h1,
.prose-invert h2,
.prose-invert h3,
.prose-invert h4 {
  color: white;
}
.prose-invert a {
  color: var(--color-accent-blue);
  text-decoration: none;
}
.prose-invert a:hover {
  text-decoration: underline;
}
.prose-invert blockquote {
  border-left-color: var(--color-accent-cyan);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 0 4px 4px 0;
}

/* Rich briefing document typography */
.briefing-rich {
  color: var(--color-text-primary);
  font-size: 13px;
  line-height: 1.75;
}

.briefing-rich > *:first-child {
  margin-top: 0;
}

.briefing-rich h1,
.briefing-rich h2,
.briefing-rich h3,
.briefing-rich h4 {
  color: #f8fafc;
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.briefing-rich h1 {
  font-size: 1.45rem;
  font-weight: 800;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 0.35rem;
}

.briefing-rich h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #c7d2fe;
}

.briefing-rich h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #bfdbfe;
}

.briefing-rich p {
  margin: 0.7rem 0;
  color: var(--color-text-primary);
}

.briefing-rich ul,
.briefing-rich ol {
  margin: 0.65rem 0 0.75rem 1.25rem;
}

.briefing-rich li {
  margin: 0.28rem 0;
}

.briefing-rich strong {
  color: #ffffff;
  font-weight: 700;
}

.briefing-rich em {
  color: #bae6fd;
}

.briefing-rich blockquote {
  border-left: 3px solid var(--color-accent-cyan);
  background: rgba(15, 23, 42, 0.42);
  margin: 0.8rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0 6px 6px 0;
}

.briefing-rich a {
  color: var(--color-accent-blue);
  text-decoration: none;
}

.briefing-rich a:hover {
  text-decoration: underline;
}

.briefing-rich hr {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  margin: 1rem 0;
}

.briefing-rich code {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  padding: 0.08rem 0.33rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82em;
  color: #e2e8f0;
}

.briefing-rich pre {
  background: rgba(2, 6, 23, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 0.7rem;
  overflow: auto;
  margin: 0.85rem 0;
}

.briefing-rich pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

/* Critical alert stack */
.critical-alert-stack {
  position: absolute;
  top: 12px;
  left: 12px;
  width: min(360px, calc(100% - 24px));
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.critical-alert-card {
  border: 1px solid rgba(239, 68, 68, 0.72);
  border-left: 4px solid var(--color-threat-critical);
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(
    145deg,
    rgba(127, 29, 29, 0.92),
    rgba(36, 13, 13, 0.95)
  );
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: criticalAlertFlash 1.1s ease-in-out infinite;
}

.critical-alert-title {
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  color: #ffffff;
  margin-top: 6px;
  margin-bottom: 6px;
}

.critical-alert-meta {
  font-size: 10px;
  color: rgba(241, 245, 249, 0.9);
  margin-bottom: 8px;
}

.critical-alert-actions {
  display: flex;
  gap: 8px;
}

.critical-alert-btn {
  border: 1px solid rgba(226, 232, 240, 0.45);
  background: rgba(15, 23, 42, 0.5);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  padding: 5px 10px;
  transition: all 120ms ease;
}

.critical-alert-btn:hover {
  border-color: rgba(226, 232, 240, 0.75);
  background: rgba(15, 23, 42, 0.72);
}

.critical-alert-btn.ack {
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(20, 83, 45, 0.55);
}

.critical-alert-btn.ack:hover {
  border-color: rgba(34, 197, 94, 0.9);
  background: rgba(20, 83, 45, 0.82);
}

.critical-alert-overflow {
  font-size: 10px;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.78);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  padding: 6px 8px;
}

@keyframes criticalAlertFlash {
  0% {
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35), 0 0 24px rgba(239, 68, 68, 0.55);
  }
  100% {
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}
