/* ═══════════════════════════════════════════════════════════════
   DAS-SMART PORTAL — HACKER COMMAND CENTER v3.0
   "Even a fool feels like a hacker here."
   ═══════════════════════════════════════════════════════════════ */

/* ═══ CORE VARIABLES ═══ */
:root {
  --hack-bg: #030308;
  --hack-surface: #0a0a14;
  --hack-card: #0d0d1a;
  --hack-border: rgba(0, 255, 65, 0.08);
  --hack-border-glow: rgba(0, 255, 65, 0.18);
  --matrix-green: #00ff41;
  --matrix-dim: #00cc34;
  --cyber-blue: #00d4ff;
  --neon-purple: #8b5cf6;
  --neon-red: #ff3b3b;
  --neon-amber: #ff9f43;
  --neon-pink: #ff2d95;
  --text-primary: #e0e0e8;
  --text-secondary: #8888a8;
  --text-dim: #555577;
  --glass-bg: rgba(10, 10, 20, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glow-green: 0 0 20px rgba(0, 255, 65, 0.12);
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.12);
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.15);
  --glow-red: 0 0 20px rgba(255, 59, 59, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ═══ BASE RESET ═══ */
*, *::before, *::after { box-sizing: border-box; }

/* ═══ BODY — Deep space background ═══ */
body {
  font-family: var(--font-sans);
  background: var(--hack-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scan-line overlay with animation */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, 0.03) 2px,
    rgba(0, 255, 65, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
  animation: scanLines 8s linear infinite;
}
@keyframes scanLines {
  0% { background-position: 0 0; }
  100% { background-position: 0 4px; }
}

/* Vignette overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  z-index: 9998;
}

/* ═══ TYPOGRAPHY ═══ */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.3px; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* Monospace for code/data */
code, pre, .mono, .terminal, .finding-id, .hash {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ═══ SCROLLBAR — Thin cyber scroll ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--hack-bg); }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 65, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 255, 65, 0.3); }

/* ═══════════════ LOGIN SCREEN ═══════════════ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #0a0a1a 0%, var(--hack-bg) 70%);
}
.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.04), 0 8px 32px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: -1px; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--matrix-green), transparent);
  opacity: 0.3;
}
.login-card .logo {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--matrix-green), var(--cyber-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-card .sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 36px;
  line-height: 1.5;
}
.login-card input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.3s;
}
.login-card input:focus {
  border-color: var(--matrix-green);
  box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.08);
}
.login-card input::placeholder { color: var(--text-dim); }
.login-card .btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00cc34, #00e63c);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-card .btn:hover {
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
  transform: translateY(-1px);
}
.login-card .error { color: var(--neon-red); font-size: 13px; margin-bottom: 12px; display: none; }
.login-card .error.show { display: block; }

/* ═══════════════ SIDEBAR ═══════════════ */
#sidebar {
  background: var(--hack-surface);
  border-right: 1px solid rgba(0, 255, 65, 0.06);
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 240px;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo-text {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--matrix-green), var(--cyber-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
#sidebar .nav-item {
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
#sidebar .nav-item:hover {
  background: rgba(0, 255, 65, 0.05);
  color: var(--matrix-green);
}
#sidebar .nav-item.active {
  background: rgba(0, 255, 65, 0.08);
  color: var(--matrix-green);
  border-left: 2px solid var(--matrix-green);
  font-weight: 600;
}
#sidebar .nav-parent {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 14px 6px;
  font-weight: 700;
}
#sidebar .nav-icon { font-size: 16px; width: 20px; text-align: center; }
#sidebar .nav-badge {
  background: rgba(0, 255, 65, 0.12);
  color: var(--matrix-green);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 700;
}

/* ═══════════════ MAIN CONTENT ═══════════════ */
#main-content {
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
  flex: 1;
}

/* ═══ CARDS — Glassmorphism ═══ */
.card, .stat-card, .agent-card, .finding-card, .scan-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.card::before, .stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover::before, .stat-card:hover::before { opacity: 1; }

/* Animated border glow on hover */
.card:hover, .stat-card:hover, .agent-card:hover {
  border-color: var(--hack-border-glow);
  box-shadow: var(--glow-green), 0 0 0 1px rgba(0, 255, 65, 0.1);
  transform: translateY(-1px);
}
@keyframes borderPulse {
  0%, 100% { border-color: rgba(0, 255, 65, 0.12); box-shadow: 0 0 8px rgba(0, 255, 65, 0.05); }
  50% { border-color: rgba(0, 255, 65, 0.25); box-shadow: 0 0 16px rgba(0, 255, 65, 0.1); }
}
.card.active-scan {
  animation: borderPulse 2s infinite;
}

/* ═══ STATUS CARDS ═══ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card { text-align: center; }
.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--matrix-green), var(--cyber-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Severity-colored stat cards */
.stat-card.critical .stat-value { background: linear-gradient(135deg, #ff3b3b, #ff6b6b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card.high .stat-value { background: linear-gradient(135deg, #ff6b3b, #ff9f43); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card.medium .stat-value { background: linear-gradient(135deg, #ff9f43, #ffbe4d); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ═══ AGENT / PIPELINE CARDS ═══ */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.agent-card .agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.agent-card .agent-name {
  font-weight: 600;
  font-size: 14px;
}
.agent-card .agent-status {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 100px;
}
.agent-status.running { background: rgba(0, 255, 65, 0.12); color: var(--matrix-green); }
.agent-status.idle { background: rgba(139, 92, 246, 0.12); color: var(--neon-purple); }
.agent-status.error { background: rgba(255, 59, 59, 0.12); color: var(--neon-red); }
.agent-status.completed { background: rgba(0, 212, 255, 0.12); color: var(--cyber-blue); }

/* ═══ PROGRESS BAR ═══ */
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--matrix-green), var(--cyber-blue));
  animation: progressPulse 2s infinite;
}
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; box-shadow: 0 0 8px rgba(0, 255, 65, 0.4); }
}

/* ═══ FINDING CARDS ═══ */
.finding-card {
  border-left: 3px solid var(--matrix-green);
  padding: 14px 18px;
  margin-bottom: 8px;
}
.finding-card.critical { border-left-color: var(--neon-red); }
.finding-card.high { border-left-color: var(--neon-amber); }
.finding-card.medium { border-left-color: var(--neon-amber); }
.finding-card.info { border-left-color: var(--cyber-blue); }
.finding-card .finding-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.finding-card .finding-desc {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.finding-card .finding-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.finding-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
}
.finding-badge.crit { background: rgba(255, 59, 59, 0.15); color: var(--neon-red); }
.finding-badge.high { background: rgba(255, 159, 67, 0.15); color: var(--neon-amber); }

/* ═══ TERMINAL OUTPUT ═══ */
.terminal {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-radius: 6px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--matrix-green);
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  position: relative;
}
.terminal::before {
  content: 'root@argus:~$ ';
  color: var(--cyber-blue);
  font-weight: 600;
}
.terminal .cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--matrix-green);
  animation: cursorBlink 1s infinite;
  vertical-align: middle;
  margin-left: 2px;
}
@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ═══ TABS ═══ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--matrix-green);
  border-bottom-color: var(--matrix-green);
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #00cc34, #00e63c);
  color: #000;
}
.btn-primary:hover {
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.3);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1px solid rgba(0, 255, 65, 0.2);
  color: var(--matrix-green);
}
.btn-outline:hover {
  background: rgba(0, 255, 65, 0.06);
  border-color: var(--matrix-green);
  box-shadow: var(--glow-green);
}
.btn-danger {
  background: rgba(255, 59, 59, 0.12);
  color: var(--neon-red);
  border: 1px solid rgba(255, 59, 59, 0.2);
}
.btn-danger:hover {
  background: rgba(255, 59, 59, 0.2);
  box-shadow: var(--glow-red);
}
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ═══ SECTION HEADERS ═══ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matrix-green);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
  animation: dotPulse 2s infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 255, 65, 0.3); }
  50% { box-shadow: 0 0 12px rgba(0, 255, 65, 0.6); }
}

/* ═══ PULSING GLOW EFFECTS ═══ */
.glow-green { box-shadow: var(--glow-green); }
.glow-blue { box-shadow: var(--glow-blue); }
.glow-purple { box-shadow: var(--glow-purple); }
.glow-red { box-shadow: var(--glow-red); }

.pulse {
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ═══ GLITCH TEXT ═══ */
.glitch {
  position: relative;
}
.glitch:hover::before,
.glitch:hover::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--hack-bg);
}
.glitch:hover::before {
  color: var(--neon-red);
  animation: glitchShift 0.3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  transform: translate(-2px, 0);
}
.glitch:hover::after {
  color: var(--cyber-blue);
  animation: glitchShift 0.3s infinite reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  transform: translate(2px, 0);
}
@keyframes glitchShift {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
}

/* ═══ TABLE — Terminal style ═══ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 12px;
}
tr:hover td {
  background: rgba(0, 255, 65, 0.02);
}

/* ═══ BADGE ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-green { background: rgba(0, 255, 65, 0.12); color: var(--matrix-green); }
.badge-blue { background: rgba(0, 212, 255, 0.12); color: var(--cyber-blue); }
.badge-purple { background: rgba(139, 92, 246, 0.12); color: var(--neon-purple); }
.badge-red { background: rgba(255, 59, 59, 0.12); color: var(--neon-red); }
.badge-amber { background: rgba(255, 159, 67, 0.12); color: var(--neon-amber); }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--hack-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), var(--glow-green);
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--neon-red); }
.modal-body { padding: 24px; }

/* ═══ TOAST ═══ */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  animation: slideUp 0.3s;
  backdrop-filter: blur(12px);
  border: 1px solid;
}
.toast-success { background: rgba(0, 255, 65, 0.1); border-color: rgba(0, 255, 65, 0.2); color: var(--matrix-green); }
.toast-error { background: rgba(255, 59, 59, 0.1); border-color: rgba(255, 59, 59, 0.2); color: var(--neon-red); }
.toast-warn { background: rgba(255, 159, 67, 0.1); border-color: rgba(255, 159, 67, 0.2); color: var(--neon-amber); }
.toast-info { background: rgba(0, 212, 255, 0.1); border-color: rgba(0, 212, 255, 0.2); color: var(--cyber-blue); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ═══ SCAN LIVE INDICATOR ═══ */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--matrix-green);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matrix-green);
  animation: dotPulse 1.5s infinite;
}

/* ═══ CHART / GRAPH PLACEHOLDER ═══ */
.chart-placeholder {
  height: 200px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  h1 { font-size: 1.4rem; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card .logo { font-size: 28px; }
}
