/* ================================================
   RUSTY SENTINEL - CYBERPUNK 2077 DASHBOARD
   Neo Militarism Style - Luxurious Edition
   Security Operations Center
   ================================================ */

/* Google Fonts - Official CP2077 fonts */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@300;400;500;600;700&family=Oxanium:wght@200;300;400;500;600;700;800&display=swap');

/* ================================================
   CSS VARIABLES - REFINED MILITECH PALETTE
   Muted, luxurious copper & gold tones
   ================================================ */
:root {
  /* Primary Colors - Muted Copper/Rust */
  --primary: #c45c26;
  --primary-dim: #9a4a1f;
  --primary-glow: rgba(196, 92, 38, 0.35);
  --primary-bright: #d4703a;
  
  /* Secondary Colors - Muted Gold/Amber */
  --secondary: #d4a84b;
  --secondary-dim: #b8923f;
  --secondary-glow: rgba(212, 168, 75, 0.3);
  
  /* Accent Colors - Warm Bronze */
  --accent: #b87333;
  --accent-dim: #8f5a28;
  --accent-glow: rgba(184, 115, 51, 0.35);
  
  /* Status Colors - Refined */
  --green: #5cb85c;
  --green-dim: #4a9a4a;
  --green-glow: rgba(92, 184, 92, 0.35);
  --red: #c9302c;
  --red-dim: #a02622;
  --red-glow: rgba(201, 48, 44, 0.35);
  --orange: #d9831f;
  --blue: #5bc0de;
  
  /* Legacy compatibility */
  --cyan: var(--secondary);
  --cyan-dim: var(--secondary-dim);
  --cyan-glow: var(--secondary-glow);
  --magenta: var(--primary);
  --magenta-dim: var(--primary-dim);
  --magenta-glow: var(--primary-glow);
  --yellow: var(--secondary);
  --yellow-dim: var(--secondary-dim);
  --yellow-glow: var(--secondary-glow);
  
  /* Background Colors - Rich Warm Darks */
  --bg-primary: #0a0908;
  --bg-secondary: #0f0e0c;
  --bg-tertiary: #161412;
  --bg-card: rgba(16, 14, 12, 0.96);
  --bg-card-hover: rgba(24, 21, 18, 0.98);
  --bg-highlight: rgba(196, 92, 38, 0.06);
  
  /* Text Colors - Warm Tones */
  --text-primary: #ece6dc;
  --text-secondary: #8a847a;
  --text-muted: #5a5550;
  --text-accent: var(--secondary);
  
  /* Border Colors */
  --border-primary: rgba(196, 92, 38, 0.3);
  --border-secondary: rgba(212, 168, 75, 0.2);
  --border-dim: rgba(255, 255, 255, 0.05);
  --border-harsh: rgba(196, 92, 38, 0.5);
  
  /* Severity Colors - Muted */
  --severity-critical: #c9302c;
  --severity-high: #c45c26;
  --severity-medium: #d9831f;
  --severity-low: #5cb85c;
  
  /* Typography - Official CP2077 fonts */
  --font-display: 'Orbitron', 'Oxanium', sans-serif;
  --font-mono: 'Oxanium', 'Rajdhani', monospace;
  --font-body: 'Rajdhani', sans-serif;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  
  /* Animation */
  --transition-fast: 100ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 350ms ease-out;
  
  /* HUD Element Sizing */
  --hud-corner-size: 12px;
  --hud-bracket-width: 2px;
}

/* ================================================
   RESET & BASE STYLES
   ================================================ */
*, *::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-body);
  font-weight: 500;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Selection */
::selection {
  background: var(--primary);
  color: var(--bg-primary);
}

/* Scrollbar - Military style */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-dim);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-dim);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ================================================
   ANIMATED BACKGROUND - LUXURIOUS DEPTH
   ================================================ */
.cyber-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: 
    /* Deep vignette for depth */
    radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%),
    /* Subtle warm glow - bottom left */
    radial-gradient(ellipse at 5% 95%, rgba(196, 92, 38, 0.07) 0%, transparent 45%),
    /* Subtle gold accent - top right */
    radial-gradient(ellipse at 95% 5%, rgba(212, 168, 75, 0.04) 0%, transparent 35%),
    /* Base gradient - warm dark tones */
    linear-gradient(165deg, #0c0a08 0%, #0a0908 35%, #080705 100%);
}

/* Grid Pattern - Very subtle, refined */
.cyber-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(212, 168, 75, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 168, 75, 0.012) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.5;
}

/* Scanlines - Very subtle CRT effect */
.cyber-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 4px,
    rgba(0, 0, 0, 0.02) 4px,
    rgba(0, 0, 0, 0.02) 5px
  );
  pointer-events: none;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.6; }
}

@keyframes scanlines {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* Noise Overlay */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ================================================
   HUD FRAME ELEMENTS - IMMERSIVE TACTICAL
   ================================================ */
.hud-corner {
  position: fixed;
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 100;
}

.hud-corner::before,
.hud-corner::after {
  content: '';
  position: absolute;
  background: var(--secondary);
  opacity: 0.6;
}

.hud-corner--tl {
  top: 15px;
  left: 15px;
}

.hud-corner--tl::before {
  top: 0;
  left: 0;
  width: 50px;
  height: 1px;
}

.hud-corner--tl::after {
  top: 0;
  left: 0;
  width: 1px;
  height: 50px;
}

.hud-corner--tr {
  top: 15px;
  right: 15px;
}

.hud-corner--tr::before {
  top: 0;
  right: 0;
  width: 50px;
  height: 1px;
}

.hud-corner--tr::after {
  top: 0;
  right: 0;
  width: 1px;
  height: 50px;
}

.hud-corner--bl {
  bottom: 15px;
  left: 15px;
}

.hud-corner--bl::before {
  bottom: 0;
  left: 0;
  width: 50px;
  height: 1px;
}

.hud-corner--bl::after {
  bottom: 0;
  left: 0;
  width: 1px;
  height: 50px;
}

.hud-corner--br {
  bottom: 15px;
  right: 15px;
}

.hud-corner--br::before {
  bottom: 0;
  right: 0;
  width: 50px;
  height: 1px;
}

.hud-corner--br::after {
  bottom: 0;
  right: 0;
  width: 1px;
  height: 50px;
}

/* ================================================
   LOGIN SCREEN
   ================================================ */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: var(--bg-primary);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.login-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.1);
}

.login-container {
  position: relative;
  text-align: center;
  max-width: 480px;
  padding: var(--space-xxl) var(--space-xl);
  background: linear-gradient(170deg, rgba(16, 14, 12, 0.6) 0%, rgba(10, 8, 6, 0.7) 100%);
  border: 1px solid var(--border-dim);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: containerReveal 0.8s ease-out forwards;
}

@keyframes containerReveal {
  0% {
    opacity: 0;
    transform: scale(0.95);
    border-color: transparent;
  }
  50% {
    border-color: var(--secondary);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    border-color: var(--border-dim);
  }
}

/* Scan line sweep effect */
.login-container .scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%,
    var(--secondary) 20%,
    var(--secondary) 80%,
    transparent 100%
  );
  opacity: 0;
  animation: scanSweep 1.5s ease-in-out 0.2s forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes scanSweep {
  0% {
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Login container HUD corners */
.login-container .hud-corner-tl,
.login-container .hud-corner-br {
  position: absolute;
  width: 24px;
  height: 24px;
  opacity: 0;
  animation: cornerFade 0.5s ease-out 0.8s forwards;
}

.login-container .hud-corner-tl {
  top: 10px;
  left: 10px;
  border-top: 1px solid var(--secondary);
  border-left: 1px solid var(--secondary);
}

.login-container .hud-corner-br {
  bottom: 10px;
  right: 10px;
  border-bottom: 1px solid var(--secondary);
  border-right: 1px solid var(--secondary);
}

@keyframes cornerFade {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 0.4;
    transform: scale(1);
  }
}

/* Remove old pseudo-element corners - now using real elements */
.login-container::before,
.login-container::after {
  display: none;
}

.login-logo {
  width: 140px;
  height: auto;
  margin-bottom: var(--space-lg);
  filter: drop-shadow(0 0 15px var(--primary-glow)) saturate(1.0) brightness(0.9);
  opacity: 0;
  transform: scale(0.8);
  animation: logoReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards,
             logoPulse 5s ease-in-out 1s infinite;
}

@keyframes logoReveal {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: drop-shadow(0 0 40px var(--secondary)) brightness(2) saturate(0);
  }
  50% {
    filter: drop-shadow(0 0 30px var(--secondary)) drop-shadow(0 0 60px var(--primary)) brightness(1.5) saturate(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 15px var(--primary-glow)) saturate(1.0) brightness(0.9);
  }
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 12px var(--primary-glow)) saturate(1.0) brightness(0.9); }
  50% { filter: drop-shadow(0 0 25px var(--primary-glow)) drop-shadow(0 0 40px var(--secondary-glow)) saturate(1.1) brightness(0.95); }
}

.login-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--secondary);
  text-shadow: 0 0 25px var(--secondary-glow), 0 1px 0 rgba(0,0,0,0.6);
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* Individual letter animations */
.login-title .letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px) scaleY(0.3);
  filter: blur(8px);
  animation: letterReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-title .letter:nth-child(1) { animation-delay: 0.3s; }
.login-title .letter:nth-child(2) { animation-delay: 0.38s; }
.login-title .letter:nth-child(3) { animation-delay: 0.46s; }
.login-title .letter:nth-child(4) { animation-delay: 0.54s; }
.login-title .letter:nth-child(5) { animation-delay: 0.62s; }
.login-title .letter:nth-child(6) { animation-delay: 0.70s; }
.login-title .letter:nth-child(7) { animation-delay: 0.78s; }
.login-title .letter:nth-child(8) { animation-delay: 0.86s; }

@keyframes letterReveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scaleY(0.3);
    filter: blur(8px);
    text-shadow: 0 0 0 transparent;
  }
  40% {
    opacity: 1;
    transform: translateY(-5px) scaleY(1.1);
    filter: blur(0);
    text-shadow: 
      0 0 30px var(--secondary),
      0 0 60px var(--secondary),
      0 0 90px var(--primary);
  }
  70% {
    transform: translateY(2px) scaleY(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: blur(0);
    text-shadow: 0 0 25px var(--secondary-glow), 0 1px 0 rgba(0,0,0,0.6);
  }
}

/* Post-reveal subtle animation */
.login-title.revealed .letter {
  animation: letterIdle 4s ease-in-out infinite;
}

.login-title.revealed .letter:nth-child(odd) {
  animation-delay: 0s;
}

.login-title.revealed .letter:nth-child(even) {
  animation-delay: 2s;
}

@keyframes letterIdle {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 25px var(--secondary-glow), 0 1px 0 rgba(0,0,0,0.6);
  }
  50% {
    opacity: 0.95;
    text-shadow: 
      0 0 35px var(--secondary-glow),
      0 0 50px var(--secondary-glow),
      0 1px 0 rgba(0,0,0,0.6);
  }
}

/* Glitch flicker on random letters */
.login-title.revealed .letter:nth-child(3),
.login-title.revealed .letter:nth-child(6) {
  animation: letterGlitch 6s ease-in-out infinite;
}

@keyframes letterGlitch {
  0%, 92%, 94%, 96%, 100% {
    opacity: 1;
    transform: translateX(0);
    filter: none;
  }
  93% {
    opacity: 0.8;
    transform: translateX(-2px);
    filter: hue-rotate(-30deg);
  }
  95% {
    opacity: 0.9;
    transform: translateX(2px);
    filter: hue-rotate(30deg);
  }
}

.login-subtitle {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-bottom: var(--space-xl);
  opacity: 0;
  animation: subtitleReveal 0.8s ease-out 1.2s forwards;
}

@keyframes subtitleReveal {
  0% {
    opacity: 0;
    letter-spacing: 0.8em;
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    letter-spacing: 0.35em;
    filter: blur(0);
  }
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.input-wrapper {
  position: relative;
}

.input-wrapper::before {
  content: '//';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--primary);
  animation: cursorBlink 1.5s step-end infinite;
}

@keyframes cursorBlink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.3; }
}

.cyber-input {
  width: 100%;
  padding: var(--space-md) var(--space-md) var(--space-md) 48px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  background: rgba(14, 12, 10, 0.8);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--primary);
  outline: none;
  transition: var(--transition-normal);
}

.cyber-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.cyber-input:focus {
  border-color: var(--border-primary);
  background: rgba(18, 16, 14, 0.9);
  box-shadow: 0 0 15px var(--primary-glow), inset 0 0 20px rgba(196, 92, 38, 0.02);
}

.cyber-button {
  position: relative;
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dim) 100%);
  border: none;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition-normal);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.cyber-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.cyber-button:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dim) 100%);
  box-shadow: 0 0 25px var(--primary-glow);
  transform: translateY(-1px);
}

.cyber-button:hover::before {
  left: 100%;
}

.cyber-button:active {
  transform: translateY(0);
}

.cyber-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.login-error {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--red);
  background: rgba(255, 60, 60, 0.1);
  border: 1px solid rgba(255, 60, 60, 0.3);
  display: none;
}

.login-error.visible {
  display: block;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* ================================================
   MAIN DASHBOARD
   ================================================ */
.dashboard {
  display: none;
  min-height: 100vh;
  padding: var(--space-lg);
}

.dashboard.visible {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Header - Luxurious Command Style */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  background: linear-gradient(180deg, rgba(18, 16, 14, 0.98) 0%, rgba(12, 10, 8, 0.98) 100%);
  border: 1px solid var(--border-dim);
  border-top: 2px solid var(--primary);
  position: relative;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
}

/* HUD brackets on header */
.dashboard-header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-top: 1px solid var(--secondary);
  border-left: 1px solid var(--secondary);
  opacity: 0.35;
}

.dashboard-header::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-bottom: 1px solid var(--secondary);
  border-right: 1px solid var(--secondary);
  opacity: 0.35;
}

@keyframes gradientShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  width: 40px;
  height: auto;
  filter: drop-shadow(0 0 10px var(--primary-glow)) saturate(1.1) brightness(0.95);
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--secondary);
  text-shadow: 0 0 20px var(--secondary-glow), 0 1px 0 rgba(0,0,0,0.6);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-indicator.connected {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.status-indicator.disconnected {
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.3); }
}

.current-time {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
  letter-spacing: 0.1em;
}

.logout-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
  background: transparent;
  border: 2px solid var(--primary);
  cursor: pointer;
  transition: var(--transition-fast);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}

.logout-btn:hover {
  background: var(--primary);
  color: var(--bg-primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto 1fr;
  gap: var(--space-lg);
  min-height: calc(100vh - 200px);
}

/* ================================================
   STATS PANEL
   ================================================ */
.stats-panel {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  position: relative;
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + 4px);
  background: linear-gradient(165deg, var(--bg-card) 0%, rgba(12, 10, 8, 0.98) 100%);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--primary);
  overflow: visible;
  transition: var(--transition-normal);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* HUD corner brackets on cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  border-top: 1px solid var(--secondary);
  border-right: 1px solid var(--secondary);
  opacity: 0.4;
  transition: opacity var(--transition-normal);
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 14px;
  height: 14px;
  border-bottom: 1px solid var(--secondary);
  border-left: 1px solid var(--secondary);
  opacity: 0.4;
  transition: opacity var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-primary);
  background: linear-gradient(165deg, var(--bg-card-hover) 0%, rgba(18, 15, 12, 0.98) 100%);
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-card:hover::before,
.stat-card:hover::after {
  opacity: 0.7;
}

.stat-card.critical { border-left-color: var(--severity-critical); }
.stat-card.high { border-left-color: var(--severity-high); }
.stat-card.warning { border-left-color: var(--severity-medium); }
.stat-card.success { border-left-color: var(--severity-low); }

.stat-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: var(--space-sm);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.critical { color: var(--severity-critical); text-shadow: 0 0 15px var(--red-glow); }
.stat-value.high { color: var(--severity-high); }
.stat-value.warning { color: var(--severity-medium); }
.stat-value.success { color: var(--severity-low); text-shadow: 0 0 10px var(--green-glow); }

.stat-change {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ================================================
   INCIDENTS PANEL
   ================================================ */
.incidents-panel {
  grid-column: span 7;
  position: relative;
  background: linear-gradient(170deg, var(--bg-card) 0%, rgba(10, 8, 6, 0.98) 100%);
  border: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  max-height: 600px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
}

/* Panel HUD corners */
.incidents-panel::before,
.incidents-panel::after,
.actions-panel::before,
.actions-panel::after,
.event-stream::before,
.event-stream::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 10;
}

.incidents-panel::before,
.actions-panel::before,
.event-stream::before {
  top: 8px;
  right: 8px;
  border-top: 1px solid var(--secondary);
  border-right: 1px solid var(--secondary);
}

.incidents-panel::after,
.actions-panel::after,
.event-stream::after {
  bottom: 8px;
  left: 8px;
  border-bottom: 1px solid var(--secondary);
  border-left: 1px solid var(--secondary);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-dim);
  background: linear-gradient(90deg, rgba(22, 20, 18, 0.98) 0%, rgba(16, 14, 12, 0.95) 100%);
  border-left: 2px solid var(--primary);
  position: relative;
}

/* Panel header scan line decoration */
.panel-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent 30%, transparent 70%, var(--secondary));
  opacity: 0.3;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--secondary);
  text-shadow: 0 0 15px var(--secondary-glow);
}

.panel-badge {
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(196, 92, 38, 0.1);
  border: 1px solid var(--border-primary);
  color: var(--primary);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.incident-card {
  position: relative;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  cursor: pointer;
  transition: var(--transition-fast);
}

.incident-card:last-child {
  margin-bottom: 0;
}

.incident-card:hover {
  border-color: var(--border-primary);
  background: var(--bg-card-hover);
}

.incident-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.incident-card.critical::before { background: var(--severity-critical); box-shadow: 0 0 8px var(--red-glow); }
.incident-card.high::before { background: var(--severity-high); }
.incident-card.medium::before { background: var(--severity-medium); }
.incident-card.low::before { background: var(--severity-low); }

.incident-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.incident-type {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.incident-severity {
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.incident-severity.critical {
  background: rgba(255, 60, 60, 0.2);
  color: var(--severity-critical);
  border: 1px solid var(--severity-critical);
}

.incident-severity.high {
  background: rgba(255, 149, 0, 0.2);
  color: var(--severity-high);
  border: 1px solid var(--severity-high);
}

.incident-severity.medium {
  background: rgba(252, 238, 9, 0.2);
  color: var(--severity-medium);
  border: 1px solid var(--severity-medium);
}

.incident-severity.low {
  background: rgba(5, 255, 161, 0.2);
  color: var(--severity-low);
  border: 1px solid var(--severity-low);
}

.incident-meta {
  display: flex;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.incident-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.incident-assessment {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-dim);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ================================================
   ACTIONS PANEL
   ================================================ */
.actions-panel {
  grid-column: span 5;
  position: relative;
  background: linear-gradient(170deg, var(--bg-card) 0%, rgba(10, 8, 6, 0.98) 100%);
  border: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  max-height: 600px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
}

.action-card {
  position: relative;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  transition: var(--transition-fast);
}

.action-card:last-child {
  margin-bottom: 0;
}

.action-card:hover {
  border-color: var(--border-primary);
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--magenta);
}

.action-card.urgent::before {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: urgentPulse 1s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.action-type {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.action-urgency {
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.action-urgency.critical {
  background: rgba(255, 60, 60, 0.2);
  color: var(--severity-critical);
  border: 1px solid var(--severity-critical);
  animation: urgentBadge 1s ease-in-out infinite;
}

@keyframes urgentBadge {
  0%, 100% { box-shadow: 0 0 5px var(--severity-critical); }
  50% { box-shadow: 0 0 15px var(--severity-critical); }
}

.action-urgency.high {
  background: rgba(255, 149, 0, 0.2);
  color: var(--severity-high);
  border: 1px solid var(--severity-high);
}

.action-urgency.medium {
  background: rgba(252, 238, 9, 0.2);
  color: var(--severity-medium);
  border: 1px solid var(--severity-medium);
}

.action-urgency.low {
  background: rgba(5, 255, 161, 0.2);
  color: var(--severity-low);
  border: 1px solid var(--severity-low);
}

.action-params {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.action-params code {
  display: block;
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-dim);
  overflow-x: auto;
  white-space: pre;
}

.action-reasoning {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: var(--space-md);
}

.action-buttons {
  display: flex;
  gap: var(--space-sm);
}

.action-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 2px solid;
  cursor: pointer;
  transition: var(--transition-fast);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}

.action-btn.approve {
  color: var(--green);
  background: transparent;
  border-color: var(--green);
}

.action-btn.approve:hover {
  background: var(--green);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--green-glow);
}

.action-btn.deny {
  color: var(--red);
  background: transparent;
  border-color: var(--red);
}

.action-btn.deny:hover {
  background: var(--red);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--red-glow);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ================================================
   EVENT STREAM
   ================================================ */
.event-stream {
  grid-column: span 12;
  position: relative;
  background: linear-gradient(170deg, var(--bg-card) 0%, rgba(10, 8, 6, 0.98) 100%);
  border: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  max-height: 300px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
}

.event-stream .panel-header {
  flex-shrink: 0;
}

.event-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.8;
}

.event-line {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-dim);
  animation: eventSlideIn 0.3s ease-out;
}

@keyframes eventSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.event-time {
  color: var(--text-muted);
  flex-shrink: 0;
}

.event-type {
  color: var(--secondary);
  flex-shrink: 0;
  min-width: 80px;
  font-weight: 600;
}

.event-message {
  color: var(--text-secondary);
  flex: 1;
}

.event-line.alert .event-type { color: var(--severity-high); }
.event-line.incident .event-type { color: var(--severity-critical); }
.event-line.action .event-type { color: var(--primary); }
.event-line.success .event-type { color: var(--green); }
.event-line.critical .event-type { color: var(--severity-critical); }
.event-line.warning .event-type { color: var(--severity-medium); }

/* Critical events - add background highlight */
.event-line.critical {
  background: linear-gradient(90deg, rgba(201, 48, 44, 0.15) 0%, transparent 100%);
  border-left: 2px solid var(--severity-critical);
  padding-left: var(--space-sm);
}

.event-line.warning {
  background: linear-gradient(90deg, rgba(217, 131, 31, 0.1) 0%, transparent 100%);
  border-left: 2px solid var(--severity-medium);
  padding-left: var(--space-sm);
}

.event-line.incident {
  background: linear-gradient(90deg, rgba(201, 48, 44, 0.2) 0%, transparent 100%);
  border-left: 2px solid var(--severity-critical);
  padding-left: var(--space-sm);
}

/* ================================================
   EMPTY STATES
   ================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl);
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state-text {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ================================================
   LOADING STATES
   ================================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-dim);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1200px) {
  .stats-panel {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .incidents-panel,
  .actions-panel {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .dashboard {
    padding: var(--space-md);
  }
  
  .dashboard-header {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .stats-panel {
    grid-template-columns: 1fr;
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  .hud-corner {
    display: none;
  }
}
