:root {
  --bg-dark: #0a0e14;
  --bg-panel: #111519;
  --bg-panel-hover: #151a20;
  --border-color: #1e2430;
  --text-primary: #e6e8eb;
  --text-secondary: #7a8290;
  --text-dim: #4a505a;

  --status-healthy: #00ff88;
  --status-healthy-glow: rgba(0, 255, 136, 0.3);
  --status-down: #ff2f5f;
  --status-down-glow: rgba(255, 47, 95, 0.3);
  --status-warning: #ffa500;
  --status-warning-glow: rgba(255, 165, 0, 0.3);
  --status-not-deployed: #505560;

  --grid-color: rgba(255, 255, 255, 0.02);
  --scanline-color: rgba(255, 255, 255, 0.02);
}

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

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
}

/* Grid overlay effect */
.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    repeating-linear-gradient(0deg, var(--grid-color) 0px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, var(--grid-color) 0px, transparent 1px, transparent 40px);
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

/* Scanline effect */
.scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    var(--scanline-color) 1px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 2;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}

/* Main container */
.container {
  position: relative;
  z-index: 3;
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem;
  animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  animation: slideDown 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.logo-symbol {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  color: var(--status-healthy);
  animation: pulse 2s ease-in-out infinite;
}

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

.logo-text {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status-bar {
  display: flex;
  gap: 2rem;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.status-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

.status-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--status-healthy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-healthy);
  box-shadow: 0 0 10px var(--status-healthy-glow);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Main grid */
.main-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.panel:hover {
  border-color: var(--text-dim);
  transform: translateY(-2px);
}

.panel-large {
  grid-column: span 2;
  animation: slideIn 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  animation-delay: 0.1s;
  animation-fill-mode: backwards;
}

.panel-medium {
  grid-column: span 1;
}

#websites-panel {
  animation: slideIn 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  animation-delay: 0.2s;
  animation-fill-mode: backwards;
}

#agents-panel {
  animation: slideIn 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  animation-delay: 0.3s;
  animation-fill-mode: backwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.panel-icon {
  color: var(--status-healthy);
  font-size: 1.2rem;
}

.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  background: var(--border-color);
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.panel-status {
  display: flex;
  gap: 1rem;
}

.stat {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

.stat-healthy {
  color: var(--status-healthy);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid var(--status-healthy);
}

.stat-down {
  color: var(--status-down);
  background: rgba(255, 47, 95, 0.1);
  border: 1px solid var(--status-down);
}

.stat-not-deployed {
  color: var(--status-not-deployed);
  background: rgba(80, 85, 96, 0.1);
  border: 1px solid var(--status-not-deployed);
}

.panel-content {
  padding: 1.5rem;
  max-height: 600px;
  overflow-y: auto;
}

.panel-content::-webkit-scrollbar {
  width: 8px;
}

.panel-content::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Endpoint list */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.endpoint-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.endpoint-item:hover {
  background: var(--bg-panel-hover);
  border-color: var(--text-dim);
}

.endpoint-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.endpoint-status.healthy {
  background: var(--status-healthy);
  box-shadow: 0 0 12px var(--status-healthy-glow);
}

.endpoint-status.down {
  background: var(--status-down);
  box-shadow: 0 0 12px var(--status-down-glow);
}

.endpoint-status.degraded {
  background: var(--status-warning);
  box-shadow: 0 0 12px var(--status-warning-glow);
}

.endpoint-status.not_deployed {
  background: var(--status-not-deployed);
  box-shadow: none;
  animation: none;
}

.endpoint-status.mismatch {
  background: var(--status-warning);
  box-shadow: 0 0 12px var(--status-warning-glow);
}

.endpoint-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.endpoint-domain {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.endpoint-path {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.endpoint-dual-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 3px;
}

.status-label {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}

.status-value {
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.status-value.healthy {
  color: var(--status-healthy);
}

.status-value.down {
  color: var(--status-down);
}

.status-value.degraded {
  color: var(--status-warning);
}

.status-value.not_deployed {
  color: var(--status-not-deployed);
}

.status-value.unreachable {
  color: var(--status-down);
}

.status-value.unknown {
  color: var(--text-dim);
}

.status-separator {
  color: var(--border-color);
  font-weight: 300;
}

.status-match {
  font-size: 0.85rem;
  font-weight: 900;
}

.status-match.match-ok {
  color: var(--status-healthy);
  text-shadow: 0 0 8px var(--status-healthy-glow);
}

.status-match.match-warning {
  color: var(--status-warning);
  text-shadow: 0 0 8px var(--status-warning-glow);
  animation: pulse 2s ease-in-out infinite;
}

.endpoint-message {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.endpoint-latency {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.endpoint-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
}

/* Website grid */
.website-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.website-item {
  padding: 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
}

.website-item:hover {
  background: var(--bg-panel-hover);
  transform: translateX(3px);
}

.website-item.healthy {
  border-left-color: var(--status-healthy);
}

.website-item.down {
  border-left-color: var(--status-down);
}

.website-item.degraded {
  border-left-color: var(--status-warning);
}

.website-item.not_deployed {
  border-left-color: var(--status-not-deployed);
}

.website-domain {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.website-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.website-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.website-item.healthy .website-status-dot {
  background: var(--status-healthy);
  box-shadow: 0 0 8px var(--status-healthy-glow);
}

.website-item.down .website-status-dot {
  background: var(--status-down);
  box-shadow: 0 0 8px var(--status-down-glow);
}

.website-item.degraded .website-status-dot {
  background: var(--status-warning);
  box-shadow: 0 0 8px var(--status-warning-glow);
}

.website-item.not_deployed .website-status-dot {
  background: var(--status-not-deployed);
}

.website-status-text {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Agent list */
.agent-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.agent-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--status-healthy);
  transition: all 0.2s ease;
}

.agent-item:hover {
  background: var(--bg-panel-hover);
  transform: translateX(3px);
}

.agent-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-healthy);
  box-shadow: 0 0 10px var(--status-healthy-glow);
  animation: pulse 2s ease-in-out infinite;
}

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

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

.agent-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.agent-time {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: right;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* Warning stat */
.stat-warning {
  color: var(--status-warning);
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid var(--status-warning);
}

/* Resources Section */
.resource-gauges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.gauge-item.alert {
  border-color: var(--status-down);
  background: rgba(255, 47, 95, 0.05);
}

.gauge-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.gauge-circle {
  width: 100px;
  height: 100px;
}

.circular-chart {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.circle-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 2.8;
}

.circle {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  animation: progress 1s ease-out forwards;
  stroke: var(--status-healthy);
}

.circular-chart.alert .circle {
  stroke: var(--status-down);
}

@keyframes progress {
  0% { stroke-dasharray: 0 100; }
}

.percentage {
  fill: var(--text-primary);
  font-size: 0.5em;
  font-weight: 700;
  text-anchor: middle;
}

.gauge-detail,
.gauge-warning {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

.gauge-warning {
  color: var(--status-down);
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Disk List */
.disk-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.disk-header {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.disk-item {
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.disk-item.alert {
  border-color: var(--status-warning);
  background: rgba(255, 165, 0, 0.05);
}

.disk-mount {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.disk-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.disk-bar-fill {
  height: 100%;
  background: var(--status-healthy);
  transition: width 0.5s ease;
}

.disk-item.alert .disk-bar-fill {
  background: var(--status-warning);
}

.disk-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.disk-percent {
  font-weight: 700;
}

.disk-percent.alert {
  color: var(--status-warning);
}

/* Process Section */
.process-section {
  margin-bottom: 1.5rem;
}

.process-section:last-child {
  margin-bottom: 0;
}

.process-section-header {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.process-table {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.process-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
}

.process-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  align-items: center;
}

.process-table-row.alert {
  border-left: 3px solid var(--status-warning);
  background: rgba(255, 165, 0, 0.05);
}

.process-name {
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.process-status.online {
  color: var(--status-healthy);
}

.process-status.stopped,
.process-status.errored {
  color: var(--status-down);
}

.process-pid,
.process-restarts,
.process-memory,
.process-runtime,
.process-uptime {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.process-restarts.alert,
.process-runtime.alert {
  color: var(--status-warning);
  font-weight: 700;
}

/* Security Grid */
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.security-item {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.security-item.alert {
  border-color: var(--status-warning);
  background: rgba(255, 165, 0, 0.05);
}

.security-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.security-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.security-item.alert .security-value {
  color: var(--status-warning);
}

.security-detail {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.security-footer {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* Alert List */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--text-dim);
}

.alert-item.info {
  border-left-color: var(--text-secondary);
}

.alert-item.warning {
  border-left-color: var(--status-warning);
  background: rgba(255, 165, 0, 0.05);
}

.alert-item.critical {
  border-left-color: var(--status-down);
  background: rgba(255, 47, 95, 0.05);
}

.alert-level {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  border: 1px solid;
}

.alert-level.info {
  color: var(--text-secondary);
  border-color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.alert-level.warning {
  color: var(--status-warning);
  border-color: var(--status-warning);
  background: rgba(255, 165, 0, 0.1);
}

.alert-level.critical {
  color: var(--status-down);
  border-color: var(--status-down);
  background: rgba(255, 47, 95, 0.1);
}

.alert-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.alert-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.alert-message {
  font-size: 0.8rem;
  color: var(--text-primary);
}

.alert-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
}

/* Responsive */
@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .panel-large,
  .panel-medium {
    grid-column: span 1;
  }

  .resource-gauges {
    grid-template-columns: repeat(2, 1fr);
  }

  .security-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .status-bar {
    width: 100%;
    justify-content: space-between;
  }

  .website-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .resource-gauges {
    grid-template-columns: 1fr;
  }

  .security-grid {
    grid-template-columns: 1fr;
  }

  .process-table-header,
  .process-table-row {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .process-table-header div:nth-child(4),
  .process-table-header div:nth-child(5),
  .process-table-row div:nth-child(4),
  .process-table-row div:nth-child(5) {
    display: none;
  }
}
