/* Theme Variables: Solid Pitch Black Dark Mode, Cyber Grid & Vibedesk Brand Colors */
:root {
  --bg-dark: #000000;
  --bg-sidebar: rgba(20, 23, 31, 0.95);
  --bg-sidebar-border: rgba(255, 255, 255, 0.08);
  --bg-card: rgba(32, 37, 50, 0.85);
  --bg-card-hover: rgba(44, 52, 70, 0.95);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --terminal-bg: #0d0f14;
  
  /* Cyber Grid Background Variables */
  --grid-line-color: rgba(255, 255, 255, 0.035);

  /* 5 Vibedesk Brand Colors */
  --vb-blue: #1361B9;
  --vb-green: #7CC347;
  --vb-yellow: #FFE14A;
  --vb-red: #F73826;
  --vb-purple: #951367;

  --shadow-color: rgba(0, 0, 0, 0.8);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #000000;
  background-image: 
    linear-gradient(to right, var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-color) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-main);
  font-family: var(--font-sans);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  line-height: 1.4;
}

/* Floating Top Metrics Bar */
.floating-top-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-sidebar-border);
  padding: 8px 14px;
  border-radius: 18px;
  box-shadow: 0 8px 32px var(--shadow-color);
}

.metric-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--bg-sidebar-border);
  padding: 6px 14px;
  border-radius: 12px;
  min-width: 135px;
  transition: all 0.2s ease;
}

.pill-label {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.pill-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.2;
  margin-top: 2px;
}

.color-white { color: var(--text-main); }
.color-green { color: var(--vb-green); }
.color-red { color: var(--vb-red); }

/* Floating Bottom QAIF Encryption Status Banner */
.floating-bottom-status {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-sidebar-border);
  padding: 10px 24px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px var(--shadow-color);
  transition: all 0.3s ease;
}

.floating-bottom-status.status-nominal {
  border-color: rgba(124, 195, 71, 0.35);
  box-shadow: 0 0 25px rgba(124, 195, 71, 0.15);
}

.floating-bottom-status.status-breached {
  border-color: rgba(247, 56, 38, 0.45);
  box-shadow: 0 0 25px rgba(247, 56, 38, 0.25);
}

.status-shield-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-nominal .status-shield-icon {
  color: var(--vb-green);
}

.status-breached .status-shield-icon {
  color: var(--vb-red);
}

.status-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.06em;
}

.status-text {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.status-nominal .status-text {
  color: var(--vb-green);
}

.status-breached .status-text {
  color: var(--vb-red);
}

/* Full-Height Sidebars (Left & Right) */
.sidebar-fullheight {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 100vh;
  z-index: 10;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px var(--shadow-color);
}

.sidebar-left {
  left: 0;
  width: 350px;
  border-right: 1px solid var(--bg-sidebar-border);
}

.sidebar-right {
  right: 0;
  width: 350px;
  border-left: 1px solid var(--bg-sidebar-border);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-sidebar-border);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--text-main);
  line-height: 1;
}

.badge-count {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Scrollable Stacks (Left & Right Sidebars) */
.agents-scroll-stack,
.terminal-scroll-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
  
  /* Hide Scrollbar */
  -ms-overflow-style: none;  /* IE/Edge */
  scrollbar-width: none;  /* Firefox */
}

.agents-scroll-stack::-webkit-scrollbar,
.terminal-scroll-stack::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Agent Card Item (Left Sidebar) */
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-sidebar-border);
  border-left: 3px solid var(--agent-color, var(--vb-blue));
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.agent-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.agent-card.expanded {
  background: rgba(44, 52, 70, 0.95);
  border-color: var(--agent-color, var(--vb-blue));
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.agent-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-left-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.agent-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--agent-color, var(--vb-blue));
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--agent-color, var(--vb-blue));
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.agent-info-middle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.agent-title {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-subtitle {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.agent-progress-mini {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
}

.agent-progress-mini-fill {
  height: 100%;
  background: var(--agent-color, var(--vb-blue));
  width: 0%;
  transition: width 0.3s ease;
}

.agent-right-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
}

.agent-pct {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.agent-status-label {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #7CC347;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
}

.agent-drawer {
  display: none;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: #7dd3fc;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--agent-color, var(--vb-blue));
  word-break: break-word;
  animation: slideDown 0.2s ease-in-out;
}

.agent-card.expanded .agent-drawer {
  display: block;
}

/* History Log Card Item (Right Sidebar - Collapsible Accordion) */
.log-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-sidebar-border);
  border-left: 3px solid var(--log-color, var(--vb-blue));
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.log-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.log-card.expanded {
  background: rgba(44, 52, 70, 0.95);
  border-color: var(--log-color, var(--vb-blue));
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.log-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-campaign-id {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--log-color, var(--vb-blue));
}

.log-time {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.log-card-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-status-label {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f87171;
  letter-spacing: 0.04em;
}

.log-chevron-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.log-card.expanded .log-chevron-icon {
  transform: rotate(180deg);
  color: var(--log-color, var(--vb-blue));
}

.log-card-drawer {
  display: none;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--log-color, var(--vb-blue));
  word-break: break-word;
  animation: slideDown 0.2s ease-in-out;
}

.log-card.expanded .log-card-drawer {
  display: block;
}

/* Subtle Centered Grey View Full Audit Log Button */
.view-full-log-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 12px;
  margin: 10px auto 2px auto;
  display: block;
  text-align: center;
  width: 100%;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.view-full-log-btn:hover {
  color: #ffffff;
  text-decoration: underline;
  opacity: 0.9;
}

/* Audit Log Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: rgba(20, 24, 33, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(19, 97, 185, 0.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(32, 37, 50, 0.6);
}

.modal-title-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-campaign-id {
  font-size: 1.1rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--modal-color, var(--vb-blue));
  letter-spacing: 0.05em;
}

.modal-agent-name {
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: #ffffff;
  font-weight: 600;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(247, 56, 38, 0.2);
  color: var(--vb-red);
  border-color: var(--vb-red);
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 18px 24px;
  background: rgba(13, 15, 20, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.meta-value {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #ffffff;
}

.modal-timeline-header {
  padding: 16px 24px 8px 24px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--modal-color, var(--vb-blue));
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Scrollable Timeline List Container */
.modal-timeline {
  padding: 8px 24px 24px 24px;
  overflow-y: auto;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

/* Custom Scrollbar for Modal Timeline */
.modal-timeline::-webkit-scrollbar {
  width: 6px;
}

.modal-timeline::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.modal-timeline::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.timeline-step {
  display: flex;
  gap: 14px;
  position: relative;
  padding-left: 20px;
}

.timeline-step::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--step-color, var(--vb-blue));
  box-shadow: 0 0 8px var(--step-color, var(--vb-blue));
}

.timeline-step::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: -14px;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-step:last-child::after {
  display: none;
}

.timeline-time {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.timeline-text {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: #ffffff;
  line-height: 1.4;
  word-break: break-word;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fullscreen Direct Center Stage (No Container Card) */
.center-stage-direct {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

#attack-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Central QAIF Target Vault Node with Background Video Animation & Dark Overlay */
.qaif-target-vault {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 5;
  width: 320px;
  height: 320px;
}

.vault-video-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.vault-video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  filter: brightness(0.65) contrast(1.15);
  opacity: 0.85;
}

.vault-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2;
  pointer-events: none;
}

.vault-file-icon {
  position: relative;
  z-index: 4;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.7));
}

.vault-file-id {
  position: relative;
  z-index: 4;
  font-size: 0.95rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
  margin-top: 10px;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 1);
}

/* ==========================================================================
   MOBILE RESPONSIVE LAYOUT (<= 868px Screens)
   ========================================================================== */
@media (max-width: 868px) {
  body {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  /* Hide Left Sidebar (Swarm), Central Canvas Radar Stage, and Bottom Status Banner on Mobile */
  .sidebar-left,
  .center-stage-direct,
  .floating-bottom-status {
    display: none !important;
  }

  /* Top Metrics Bar: Sticky Top, Fixed 2x2 Grid (2 Rows, 2 Columns) */
  .floating-top-bar {
    position: sticky;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 16px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
  }

  .metric-pill {
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
  }

  /* Make the 5th metric pill (EST. TIME TO BREACH) span full width on mobile */
  .metric-pill:nth-child(5) {
    grid-column: 1 / -1;
  }

  .pill-label {
    font-size: 0.55rem;
  }

  .pill-value {
    font-size: 1rem;
  }

  /* Right Sidebar (Live History Feed) as Main Full-Width Content */
  .sidebar-right {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    height: auto;
    border: none;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    padding: 0 14px 28px 14px;
  }

  .sidebar-header {
    margin-bottom: 12px;
  }

  .terminal-scroll-stack {
    overflow-y: visible;
    height: auto;
    flex: none;
  }

  .log-card {
    width: 100%;
  }

  .modal-card {
    max-height: 92vh;
  }

  .modal-meta-grid {
    grid-template-columns: 1fr;
  }
}
