/* ========================================
   AGENT HEALTH MONITORING DASHBOARD
   Modern ops dashboard for monitoring infrastructure agents
   ======================================== */

/* Overall health indicator - hero status */
.health-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.health-hero.is-healthy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.health-hero.is-degraded {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.health-hero.is-critical {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

[data-theme="dark"] .health-hero {
  background: linear-gradient(135deg, #4c5fd5 0%, #5e3d8a 100%);
}

[data-theme="dark"] .health-hero.is-healthy {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

[data-theme="dark"] .health-hero.is-degraded {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

[data-theme="dark"] .health-hero.is-critical {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.health-hero-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.health-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.health-hero-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: white;
}

.health-hero-text p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.health-hero-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.health-hero-actions .button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.health-hero-actions .button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Stats row with enhanced cards */
.agent-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.agent-stat-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  border: 1px solid #e5e7eb;
}

[data-theme="dark"] .agent-stat-card {
  background: #1f2937;
  border-color: #374151;
}

.agent-stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.agent-stat-card.is-total .stat-icon {
  background: #eff6ff;
  color: #3b82f6;
}

.agent-stat-card.is-healthy .stat-icon {
  background: #ecfdf5;
  color: #10b981;
}

.agent-stat-card.is-unhealthy .stat-icon {
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .agent-stat-card.is-total .stat-icon {
  background: #1e3a5f;
  color: #60a5fa;
}

[data-theme="dark"] .agent-stat-card.is-healthy .stat-icon {
  background: #064e3b;
  color: #34d399;
}

[data-theme="dark"] .agent-stat-card.is-unhealthy .stat-icon {
  background: #450a0a;
  color: #f87171;
}

.agent-stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.agent-stat-card.is-total .stat-value { color: #3b82f6; }
.agent-stat-card.is-healthy .stat-value { color: #10b981; }
.agent-stat-card.is-unhealthy .stat-value { color: #ef4444; }

[data-theme="dark"] .agent-stat-card.is-total .stat-value { color: #60a5fa; }
[data-theme="dark"] .agent-stat-card.is-healthy .stat-value { color: #34d399; }
[data-theme="dark"] .agent-stat-card.is-unhealthy .stat-value { color: #f87171; }

.agent-stat-card .stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .agent-stat-card .stat-label {
  color: #9ca3af;
}

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

/* Individual agent card */
.agent-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .agent-card {
  background: #1f2937;
  border-color: #374151;
}

.agent-card-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f3f4f6;
}

[data-theme="dark"] .agent-card-header {
  border-color: #374151;
}

.agent-card-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agent-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: #1f2937;
}

[data-theme="dark"] .agent-card-name {
  color: #f3f4f6;
}

/* Status indicator with pulse animation */
.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.status-indicator.is-healthy {
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse-healthy 2s infinite;
}

.status-indicator.is-unhealthy {
  background: #ef4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
  animation: pulse-unhealthy 1.5s infinite;
}

@keyframes pulse-healthy {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-unhealthy {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge.is-healthy {
  background: #ecfdf5;
  color: #059669;
}

.status-badge.is-unhealthy {
  background: #fef2f2;
  color: #dc2626;
}

[data-theme="dark"] .status-badge.is-healthy {
  background: #064e3b;
  color: #34d399;
}

[data-theme="dark"] .status-badge.is-unhealthy {
  background: #450a0a;
  color: #f87171;
}

/* Agent card body */
.agent-card-body {
  padding: 1rem 1.25rem;
}

.agent-card-details {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

.agent-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.agent-detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  font-weight: 500;
}

[data-theme="dark"] .agent-detail-label {
  color: #6b7280;
}

.agent-detail-value {
  font-size: 0.875rem;
  color: #374151;
}

[data-theme="dark"] .agent-detail-value {
  color: #d1d5db;
}

.agent-detail-value code {
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .agent-detail-value code {
  background: #374151;
}

/* Version badge */
.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: #6b7280;
}

[data-theme="dark"] .version-badge {
  background: #374151;
  color: #9ca3af;
}

/* Agent type badge - inline type indicator */
.agent-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.agent-type-badge.is-backup {
  background: #ecfeff;
  color: #0891b2;
}

.agent-type-badge.is-console {
  background: #f3e8ff;
  color: #7c3aed;
}

.agent-type-badge.is-network {
  background: #fef3c7;
  color: #d97706;
}

[data-theme="dark"] .agent-type-badge.is-backup {
  background: #164e63;
  color: #22d3ee;
}

[data-theme="dark"] .agent-type-badge.is-console {
  background: #4c1d95;
  color: #c4b5fd;
}

[data-theme="dark"] .agent-type-badge.is-network {
  background: #78350f;
  color: #fcd34d;
}

/* Agent card footer */
.agent-card-footer {
  padding: 0.625rem 1.25rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  margin-top: auto;
}

[data-theme="dark"] .agent-card-footer {
  border-color: #374151;
  background: #1a1f2e;
}

.agent-checked-at {
  font-size: 0.75rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.agent-checked-at i {
  font-size: 0.7rem;
}

[data-theme="dark"] .agent-checked-at {
  color: #6b7280;
}

/* Error panel for unhealthy agents */
.agent-card-error {
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

[data-theme="dark"] .agent-card-error {
  background: #450a0a;
  border-color: #7f1d1d;
}

.agent-card-error .error-icon {
  color: #dc2626;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

[data-theme="dark"] .agent-card-error .error-icon {
  color: #f87171;
}

.agent-card-error .error-message {
  font-size: 0.8rem;
  color: #991b1b;
  word-break: break-word;
}

[data-theme="dark"] .agent-card-error .error-message {
  color: #fca5a5;
}

/* Refresh button spinner */
.refresh-btn .icon {
  transition: transform 0.3s ease;
}

.refresh-btn.is-loading .icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Last updated timestamp - white text for hero banner visibility */
.last-updated {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.last-updated .icon {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Auto-refresh toggle */
.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}

[data-theme="dark"] .auto-refresh-toggle {
  color: #9ca3af;
}

.auto-refresh-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

/* Empty state enhancement */
.agents-empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.agents-empty-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #6366f1;
}

[data-theme="dark"] .agents-empty-icon {
  background: linear-gradient(135deg, #312e81 0%, #4338ca 100%);
  color: #a5b4fc;
}

.agents-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .agents-empty-title {
  color: #f3f4f6;
}

.agents-empty-description {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .agents-empty-description {
  color: #9ca3af;
}

.agents-empty-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #4b5563;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .agents-empty-hint {
  background: #374151;
  color: #d1d5db;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .health-hero {
    flex-direction: column;
    text-align: center;
  }

  .health-hero-content {
    flex-direction: column;
  }

  .health-hero-actions {
    width: 100%;
    justify-content: center;
  }

  .agent-cards {
    grid-template-columns: 1fr;
  }

  .agent-card-details {
    grid-template-columns: 1fr;
  }
}
