/* ============================================================
   CYBERSECURITY LIVE DASHBOARD — style.css
   Color palette:
     Background  : #05050f
     Accent Cyan : #00d4ff
     Accent Violet: #7c3aed / #a855f7
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary:         #05050f;
  --bg-secondary:       #0a0a1a;
  --bg-card:            #0d0d20;
  --accent-cyan:        #00d4ff;
  --accent-violet:      #7c3aed;
  --accent-violet-lt:   #a855f7;
  --text-primary:       #e2e8f0;
  --text-secondary:     #94a3b8;
  --text-muted:         #475569;
  --success:            #10b981;
  --warning:            #f59e0b;
  --danger:             #ef4444;
  --border-subtle:      rgba(0, 212, 255, 0.15);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 8% 8%,   rgba(124, 58, 237, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 92% 92%, rgba(0, 212, 255,  0.06) 0%, transparent 50%);
}

/* ── Header ───────────────────────────────────────────────── */
header {
  background: rgba(8, 8, 20, 0.96);
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  padding: 0 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(0, 212, 255, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.header-content {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.1;
}

.logo-title {
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.2px;
}

.logo-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}

.nav-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.18s, background 0.18s;
  letter-spacing: 0.2px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.last-updated-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  white-space: nowrap;
}

/* Card title group */
.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-icon {
  width: 15px;
  height: 15px;
  color: var(--accent-cyan);
  flex-shrink: 0;
  opacity: 0.85;
}

.card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Live indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--danger);
}

/* Capability SVG icons */
.cap-svg {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.9;
}


/* ── Intro Hero Section ───────────────────────────────────── */
.intro-hero {
  max-width: 1440px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

/* Status bar */
.intro-status-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  padding: 0 0.2rem;
}

.intro-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 7px var(--success);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.intro-status-text { flex: 1; letter-spacing: 0.2px; }

.intro-status-right {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--accent-cyan);
  font-size: 0.7rem;
}

/* Main body */
.intro-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.6rem;
  align-items: start;
}

/* ── Left panel ───────────────────────────────────────────── */
.intro-eyebrow { margin-bottom: 0.75rem; }

.intro-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 0.24rem 0.75rem;
  border-radius: 20px;
}

.intro-title {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.9rem;
  letter-spacing: -0.3px;
}

.intro-title-accent {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro-lead {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 580px;
  margin-bottom: 1.4rem;
  border-left: 2px solid rgba(0, 212, 255, 0.3);
  padding-left: 0.85rem;
}

/* Capability grid */
.intro-capabilities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.3rem;
}

.cap-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 9px;
  transition: background 0.2s, border-color 0.2s;
}

.cap-item:hover {
  background: rgba(0, 212, 255, 0.04);
  border-color: rgba(0, 212, 255, 0.18);
}

.cap-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 1px;
  filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.3));
}

.cap-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.18rem;
}

.cap-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Stack row */
.intro-stack {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.stack-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 0.2rem;
}

.tag {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.28);
  color: var(--accent-violet-lt);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
}

/* ── Right panel ──────────────────────────────────────────── */
.intro-right {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.intro-card {
  background: rgba(8, 8, 20, 0.9);
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 14px;
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.intro-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
}

/* Avatar with animated ring */
.intro-avatar-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-cyan) 0%, var(--accent-violet) 50%, var(--accent-cyan) 100%);
  padding: 2px;
  animation: spin-ring 6s linear infinite;
  margin-bottom: 0.3rem;
  flex-shrink: 0;
}

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

.intro-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0a0a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

.intro-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.intro-role {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.intro-divider {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.4), transparent);
  margin: 0.25rem 0;
}

.intro-about {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 220px;
  margin-bottom: 0.4rem;
}

.intro-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.intro-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s ease;
  letter-spacing: 0.2px;
}

.intro-link.linkedin {
  background: rgba(10, 102, 194, 0.14);
  border: 1px solid rgba(10, 102, 194, 0.4);
  color: #5aaee8;
}
.intro-link.linkedin:hover {
  background: rgba(10, 102, 194, 0.26);
  box-shadow: 0 4px 18px rgba(10, 102, 194, 0.25);
  transform: translateY(-1px);
}

.intro-link.github {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #a0aec0;
}
.intro-link.github:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(255,255,255,0.06);
}

/* Quick stats under profile card */
.intro-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.8rem 0.6rem;
}

.istat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}

.istat-val {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.istat-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}

.istat-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

/* Footer links row */
.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.footer-sep { color: var(--text-muted); font-size: 0.75rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 920px) {
  .intro-body {
    grid-template-columns: 1fr;
  }
  .intro-right {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .intro-card {
    flex: 1;
    min-width: 240px;
  }
  .intro-stats {
    flex: 1;
    min-width: 240px;
  }
}

@media (max-width: 600px) {
  .intro-capabilities {
    grid-template-columns: 1fr;
  }
  .intro-right {
    flex-direction: column;
  }
}

/* ── Dashboard Grid ───────────────────────────────────────── */
main.dashboard-grid {
  max-width: 1440px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ── Cards / Panels ───────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 1.4rem;
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

/* Top gradient accent line */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan), var(--accent-violet));
  opacity: 0.75;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(0, 212, 255, 0.12),
    inset 0 0 24px rgba(124, 58, 237, 0.06);
  border-color: rgba(0, 212, 255, 0.38);
}

/* AI card: full-width, violet tint */
.ai-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(13,13,32,0.92), rgba(124,58,237,0.09));
}

/* Chart card: spans 2 columns */
#chart-section {
  grid-column: span 2;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header h2 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2px;
  line-height: 1;
}

/* ── Refresh Button ───────────────────────────────────────── */
.refresh-btn {
  background: transparent;
  border: 1px solid rgba(0, 212, 255, 0.38);
  color: var(--accent-cyan);
  padding: 0.28rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.refresh-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.22);
}

/* ── Pulse Dot ────────────────────────────────────────────── */
.pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 7px var(--success);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

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

/* ── Skeleton Loader ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 7px;
  height: 42px;
  margin-bottom: 0.6rem;
}

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

/* ── Uptime Section ───────────────────────────────────────── */
.uptime-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Summary badge row above the list */
.panel-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding: 0 0.1rem;
  margin-bottom: 0.15rem;
}

.panel-summary-score {
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.3px;
}
.panel-summary-score.good { color: var(--success); }
.panel-summary-score.warn { color: var(--warning); }
.panel-summary-score.bad  { color: var(--danger);  }

.uptime-item {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.uptime-item:hover { background: rgba(0, 212, 255, 0.05); }

/* Top row: dot · URL · uptime% */
.uptime-row-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.uptime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.uptime-dot.online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.uptime-dot.offline { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }

.uptime-url {
  flex: 1;
  font-size: 0.81rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uptime-pct {
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.uptime-pct.online  { color: var(--success); }
.uptime-pct.offline { color: var(--danger); }

/* Second row: latency label + bar */
.uptime-row-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.uptime-latency-label { flex-shrink: 0; }

.uptime-latency-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.uptime-latency-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.uptime-offline-msg {
  font-size: 0.73rem;
  color: var(--danger);
  opacity: 0.75;
}

/* ── SSL Section ──────────────────────────────────────────── */
.ssl-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ssl-item {
  padding: 0.8rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background 0.2s;
}

.ssl-item.valid   { border-left-color: var(--success); }
.ssl-item.expired { border-left-color: var(--danger); }
.ssl-item.warning { border-left-color: var(--warning); }

.ssl-item:hover { background: rgba(255, 255, 255, 0.05); }

/* Domain + grade badge on same row */
.ssl-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  gap: 0.5rem;
}

.ssl-domain {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Certificate grade (A / B / F) */
.ssl-grade {
  font-size: 0.95rem;
  font-weight: 800;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}
.ssl-grade.grade-valid   { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.ssl-grade.grade-warning { background: rgba(245, 158, 11,  0.2); color: var(--warning); }
.ssl-grade.grade-expired { background: rgba(239, 68,  68,  0.2); color: var(--danger); }

.ssl-expiry-text {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Days-remaining progress bar */
.ssl-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.ssl-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.7s ease;
}

.ssl-progress-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── HTTP Headers Section ─────────────────────────────────── */
.headers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Compliance score row at top of headers list */
.headers-score-row {
  padding: 0.6rem 0.7rem;
  background: rgba(255,255,255,0.025);
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 0.25rem;
}

.headers-score-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.headers-score-track {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.headers-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.7s ease;
}

.header-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  transition: background 0.2s;
}

.header-item:hover { background: rgba(255, 255, 255, 0.055); }

/* Left side: header name + risk category tag */
.header-name-group {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1;
  overflow: hidden;
}

.header-name {
  font-family: 'Courier New', monospace;
  color: var(--accent-violet-lt);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-risk {
  font-size: 0.63rem;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.header-badge {
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-badge.present { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.header-badge.missing { background: rgba(239, 68,  68,  0.15); color: var(--danger); }
.header-badge.partial { background: rgba(245, 158, 11,  0.15); color: var(--warning); }

/* ── Threat Feed Section ──────────────────────────────────── */
.threat-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.threat-item {
  padding: 0.85rem 0.85rem 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}

/* Severity colour bar on left */
.threat-item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
}

.threat-item.high::before   { background: var(--danger); }
.threat-item.medium::before { background: var(--warning); }
.threat-item.low::before    { background: var(--success); }

.threat-item:hover { background: rgba(124, 58, 237, 0.07); }

.threat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.35rem;
  gap: 0.5rem;
}

.threat-cve {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

.severity-badge {
  padding: 0.1rem 0.48rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}

.severity-badge.high   { background: rgba(239, 68,  68,  0.2); color: var(--danger); }
.severity-badge.medium { background: rgba(245, 158, 11,  0.2); color: var(--warning); }
.severity-badge.low    { background: rgba(16,  185, 129, 0.2); color: var(--success); }

.threat-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.threat-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.5rem;
}

/* Footer row: CVSS bar + date */
.threat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

.cvss-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}

.cvss-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.cvss-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
  max-width: 90px;
}

.cvss-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.7s ease;
}

.cvss-score {
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.threat-date {
  font-size: 0.69rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Chart Section ────────────────────────────────────────── */
#threatChart {
  max-height: 210px;
  width: 100% !important;
}

/* ── AI Summary Section ───────────────────────────────────── */
.ai-badge {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  color: #fff;
  padding: 0.18rem 0.65rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.ai-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 3fr;
  gap: 1rem;
  align-items: start;
}

.ai-stat {
  padding: 1.1rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  text-align: center;
  border: 1px solid rgba(124, 58, 237, 0.22);
  transition: border-color 0.2s;
}

.ai-stat:hover { border-color: rgba(124, 58, 237, 0.5); }

.ai-stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  display: block;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.ai-stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  display: block;
}

.ai-text-block {
  padding: 1.1rem 1.2rem;
  background: rgba(124, 58, 237, 0.07);
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-left: 3px solid var(--accent-violet);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.75;
  position: relative;
}

.ai-text-label {
  display: block;
  font-size: 0.72rem;
  color: var(--accent-violet-lt);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-cyan);
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Cloudflare Worker placeholder notice */
.cf-notice {
  grid-column: 1 / -1;
  padding: 0.7rem 1rem;
  background: rgba(0, 212, 255, 0.04);
  border: 1px dashed rgba(0, 212, 255, 0.22);
  border-radius: 7px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.cf-notice code {
  color: var(--accent-cyan);
  font-family: 'Courier New', monospace;
  background: rgba(0, 212, 255, 0.09);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.74rem;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: rgba(5, 5, 15, 0.92);
  border-top: 1px solid rgba(0, 212, 255, 0.1);
  padding: 1.4rem 2rem;
  margin-top: 1rem;
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-content a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.footer-content a:hover { text-decoration: underline; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-violet); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ── Responsive: 2-column at ≤1100px ─────────────────────── */
@media (max-width: 1100px) {
  main.dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #chart-section {
    grid-column: span 2;
  }

  .ai-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .ai-text-block {
    grid-column: 1 / -1;
  }
}

/* ── Responsive: 1-column at ≤680px ──────────────────────── */
@media (max-width: 680px) {
  main.dashboard-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem 2rem;
  }

  .ai-card,
  #chart-section {
    grid-column: 1;
  }

  .ai-summary {
    grid-template-columns: 1fr;
  }

  .header-meta, .last-updated-text, .header-nav {
    display: none;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================================
   NEW ENHANCEMENTS
============================================================ */

/* ── Matrix Rain Canvas ───────────────────────────────────── */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
}

/* ── Glitch Animation on H1 Title ────────────────────────── */
@keyframes glitch-anim {
  0%, 88%, 100% { transform: none; filter: none; }
  89% { transform: translateX(-3px) skewX(-2deg); filter: hue-rotate(50deg) brightness(1.4); }
  90% { transform: translateX(3px)  skewX(2deg);  filter: hue-rotate(-50deg); }
  91% { transform: translateX(-2px);               filter: none; }
  92% { transform: none; filter: brightness(1.6); }
  93% { transform: none; filter: none; }
}

h1 {
  animation: glitch-anim 5s infinite;
}

/* ── Threat Count Badge (header) ──────────────────────────── */
.threat-count-badge {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  padding: 0.18rem 0.6rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* ── Card Entrance Animations ─────────────────────────────── */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.card { animation: card-enter 0.5s ease both; }

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.20s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.30s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.40s; }

/* ── Scan-line Overlay on Card Hover ──────────────────────── */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.018) 2px,
    rgba(0, 212, 255, 0.018) 4px
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 14px;
}

.card:hover::after { opacity: 1; }

/* ── Metrics Clock ────────────────────────────────────────── */
.metrics-clock {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

/* ── System Metrics Panel ─────────────────────────────────── */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.metric-item { padding: 0.1rem 0; }

.metric-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.32rem;
  font-size: 0.8rem;
}

.metric-icon  { font-size: 0.9rem; flex-shrink: 0; }
.metric-label { flex: 1; color: var(--text-secondary); }
.metric-value { font-family: 'Courier New', monospace; font-weight: 700; font-size: 0.8rem; }

.metric-bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 1.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Live Attack Map Canvas ───────────────────────────────── */
.attackmap-card {
  grid-column: span 2;
}

#attackCanvas {
  width: 100% !important;
  height: 220px;
  display: block;
  border-radius: 8px;
}

/* ── Toast Notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 340px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: rgba(8, 8, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: var(--text-primary);
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 0.38s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.38s;
  opacity: 0;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.toast.toast-show { transform: translateX(0); opacity: 1; }
.toast.toast-hide { transform: translateX(120%); opacity: 0; }

.toast-danger  { border-left: 3px solid var(--danger);  }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-success { border-left: 3px solid var(--success); }

.toast-icon  { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast-text  { flex: 1; line-height: 1.45; color: var(--text-secondary); }
.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem; padding: 0; line-height: 1;
  flex-shrink: 0; pointer-events: all; transition: color 0.2s;
  font-family: inherit;
}
.toast-close:hover { color: var(--text-primary); }

/* ── Responsive updates for new panels ───────────────────── */
@media (max-width: 1100px) {
  .attackmap-card { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .attackmap-card { grid-column: 1; }
  #toast-container { max-width: calc(100vw - 2rem); right: 1rem; left: 1rem; }
}

/* ============================================================
   WORLD-MONITOR-INSPIRED ADDITIONS
   Reference: github.com/koala73/worldmonitor
============================================================ */

/* ── Theme Toggle Button ──────────────────────────────────── */
.theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.3);
}

/* ── Light Theme Overrides ────────────────────────────────── */
[data-theme="light"] {
  --bg-primary:    #f0f4f8;
  --bg-secondary:  #e4ecf4;
  --bg-card:       #ffffff;
  --text-primary:  #1a202c;
  --text-secondary:#4a5568;
  --text-muted:    #718096;
  --border-subtle: rgba(0, 120, 200, 0.18);
}

[data-theme="light"] body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 8% 8%,   rgba(124, 58, 237, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 92% 92%, rgba(0, 100, 200, 0.04) 0%, transparent 50%);
}

[data-theme="light"] header {
  background: linear-gradient(135deg, rgba(255,255,255,0.97), rgba(240,244,248,0.99));
  border-bottom-color: rgba(0, 100, 200, 0.16);
}

[data-theme="light"] .card {
  background: #ffffff;
  border-color: rgba(0, 100, 200, 0.1);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .card-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .threat-count-badge {
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="light"] #matrix-canvas {
  opacity: 0.04;
}

[data-theme="light"] .intro-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 100, 200, 0.16);
}

[data-theme="light"] .intro-lead {
  border-left-color: rgba(0, 150, 220, 0.4);
}

[data-theme="light"] .cap-item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .intro-status-bar {
  color: #718096;
}

[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a202c;
}

[data-theme="light"] .intro-avatar-inner {
  background: #f0f4f8;
}

