/* Agent Observatory - Dark Theme Dashboard */

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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --border: #2a2a3a;
  --text-primary: #e4e4ef;
  --text-secondary: #8888a0;
  --text-muted: #555568;
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --grey: #6b7280;
  --grey-dim: rgba(107, 114, 128, 0.15);
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.summary {
  display: flex;
  gap: 20px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.summary-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-count.running { color: var(--green); }
.summary-count.errored { color: var(--red); }
.summary-count.stopped { color: var(--grey); }

.summary-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.last-updated {
  color: var(--text-muted);
  font-size: 12px;
}

.auto-refresh {
  color: var(--text-muted);
  font-size: 12px;
}

/* Agent Grid */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* Agent Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  background: var(--bg-card-hover);
}

.card.status-running { border-left: 3px solid var(--green); }
.card.status-errored { border-left: 3px solid var(--red); }
.card.status-stopped { border-left: 3px solid var(--grey); }
.card.status-starting { border-left: 3px solid var(--amber); }
.card.status-development { border-left: 3px solid var(--amber); }
.card.status-idea { border-left: 3px solid var(--blue); }
.card.status-unknown { border-left: 3px solid var(--grey); }
.card.status-idle { border-left: 3px solid var(--green); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

a.agent-name:hover {
  text-decoration: underline;
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.status-badge.running {
  background: var(--green-dim);
  color: var(--green);
}

.status-badge.idle {
  background: var(--green-dim);
  color: var(--green);
}

.status-badge.errored {
  background: var(--red-dim);
  color: var(--red);
}

.status-badge.stopped {
  background: var(--grey-dim);
  color: var(--grey);
}

.status-badge.starting {
  background: var(--amber-dim);
  color: var(--amber);
}

.status-badge.development {
  background: var(--amber-dim);
  color: var(--amber);
}

.status-badge.idea {
  background: var(--blue-dim);
  color: var(--blue);
}

.status-badge.unknown {
  background: var(--grey-dim);
  color: var(--grey);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.running .status-dot,
.status-badge.idle .status-dot {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Card Body */
.agent-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
  font-family: var(--font-sans);
}

.agent-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-label {
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
}

.meta-value {
  color: var(--text-secondary);
}

.meta-value.heartbeat-fresh {
  color: var(--green);
}

.meta-value.heartbeat-stale {
  color: var(--amber);
}

.meta-value.heartbeat-dead {
  color: var(--red);
}

/* Tech Tags */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.tech-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Agent Message */
.agent-message {
  margin-top: 12px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  border-left: 2px solid var(--border);
  font-family: var(--font-sans);
}

/* Skeleton Loading */
.card.skeleton {
  min-height: 180px;
}

.skeleton-line {
  height: 14px;
  background: var(--bg-secondary);
  border-radius: 4px;
  margin-bottom: 12px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-line.wide { width: 70%; }
.skeleton-line.narrow { width: 40%; }
.skeleton-line:not(.wide):not(.narrow) { width: 90%; }

@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Error State */
.error-banner {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  color: var(--red);
  font-size: 13px;
}

/* Footer */
footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

footer a:hover {
  color: var(--text-primary);
}

.separator {
  margin: 0 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  header { flex-direction: column; }
  .summary { gap: 16px; }
  .agent-grid { grid-template-columns: 1fr; }
  h1 { font-size: 18px; }
}

@media (max-width: 480px) {
  .summary { gap: 12px; }
  .summary-count { font-size: 18px; }
  .card { padding: 16px; }
}
