/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  color: #00ff00;
  font-family: 'Courier New', Courier, monospace;
}

/* ===== SNAKE GAME ===== */
#game-container {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  z-index: 1;
}

#game-canvas {
  border: 2px solid #00ff00;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
  background: #000;
}

#game-score {
  margin-top: 12px;
  font-size: 20px;
  color: #00ff00;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

#game-hint {
  margin-top: 6px;
  font-size: 13px;
  color: #005500;
}

/* ===== DASHBOARD ===== */
#dashboard {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  color: #c9d1d9;
  z-index: 2;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Top bar */
#dash-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

#dash-title {
  font-size: 16px;
  font-weight: 700;
  color: #58a6ff;
}

#connection-status {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.status-online {
  background: #1a3d1a;
  color: #3fb950;
}

.status-offline {
  background: #3d1a1a;
  color: #f85149;
}

#btn-back-game {
  margin-left: auto;
  padding: 5px 14px;
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
#btn-back-game:hover { background: #30363d; }

/* Main layout: agent list (left) + command panel (right) */
#dash-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Agent panel */
#agent-panel {
  width: 300px;
  min-width: 260px;
  background: #0d1117;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#agent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #30363d;
}

#agent-panel-header h3 {
  font-size: 14px;
  color: #58a6ff;
  font-weight: 600;
}

#agent-count {
  font-size: 12px;
  color: #8b949e;
}

#agent-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

/* Agent card */
.agent-card {
  padding: 12px 14px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
  transition: background 0.15s;
}
.agent-card:hover { background: #161b22; }
.agent-card.active { background: #1a3050; border-left: 3px solid #58a6ff; }

.agent-card .agent-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.agent-dot.online { background: #3fb950; box-shadow: 0 0 6px rgba(63, 185, 80, 0.5); }
.agent-dot.offline { background: #f85149; box-shadow: 0 0 6px rgba(248, 81, 73, 0.3); }

.agent-hostname {
  font-size: 14px;
  font-weight: 600;
  color: #e6edf3;
}

.agent-user {
  font-size: 11px;
  color: #8b949e;
  margin-left: auto;
}

.agent-specs {
  font-size: 11px;
  color: #8b949e;
  line-height: 1.5;
}

.agent-metrics {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #7ee787;
  margin-top: 4px;
}

.agent-metrics span {
  background: #1a3d1a;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Command panel */
#cmd-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0d1117;
}

#no-agent-selected {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #484f58;
  font-size: 15px;
}

#cmd-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Agent info bar */
#agent-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#active-agent-name {
  font-weight: 700;
  font-size: 15px;
  color: #58a6ff;
}

#active-agent-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}

#active-agent-specs {
  font-size: 12px;
  color: #8b949e;
  flex: 1;
}

#btn-screenshot {
  padding: 5px 14px;
  background: #1a3d1a;
  color: #3fb950;
  border: 1px solid #238636;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
#btn-screenshot:hover { background: #238636; color: #fff; }

/* Command sections */
.cmd-section {
  padding: 10px 16px;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}

.cmd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cmd-section-header label {
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
}

.btn-run {
  padding: 4px 16px;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-run:hover { background: #2ea043; }
.btn-run:active { background: #196c2e; }

.cmd-textarea {
  width: 100%;
  padding: 8px 10px;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  resize: vertical;
  outline: none;
}
.cmd-textarea:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

/* Output terminal */
#output-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 16px 10px;
}

#output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-shrink: 0;
}

#output-header span {
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
}

#btn-clear-output {
  padding: 3px 12px;
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
}
#btn-clear-output:hover { background: #30363d; color: #c9d1d9; }

#output-terminal {
  flex: 1;
  overflow-y: auto;
  background: #0d1117;
  color: #7ee787;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

#output-terminal:empty::after {
  content: 'Command output will appear here...';
  color: #484f58;
}

/* ===== SCREENSHOT MODAL ===== */
#screenshot-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screenshot-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#screenshot-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0d1117;
  color: #c9d1d9;
  font-size: 14px;
  font-weight: 600;
}

#btn-close-modal {
  padding: 2px 10px;
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
#btn-close-modal:hover { color: #f85149; border-color: #f85149; }

#screenshot-image {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0d1117;
}
::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* ===== ANIMATION ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

#dashboard.fade-in {
  animation: fadeIn 0.3s ease;
}

#screenshot-modal.fade-in {
  animation: fadeIn 0.2s ease;
}