@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0a0a0f;
  --bg-card: rgba(255,255,255,0.02);
  --border: rgba(0,240,255,0.1);
  --border-hover: rgba(0,240,255,0.3);
  --text: #c8c8d0;
  --text-dim: #666;
  --cyan: #00f0ff;
  --magenta: #ff2d95;
  --green: #00ff88;
  --red: #ff2d55;
  --yellow: #ffd600;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Outfit', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,240,255,0.008) 2px,
    rgba(0,240,255,0.008) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ---- AUTH SCREEN ---- */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
}

.auth-lock {
  font-size: 48px;
  filter: drop-shadow(0 0 20px rgba(0,240,255,0.4));
  animation: float 3s ease-in-out infinite;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 4px;
}

.auth-input {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 24px;
  letter-spacing: 12px;
  text-align: center;
  padding: 12px 24px;
  width: 200px;
  outline: none;
  transition: border-color 0.3s;
}

.auth-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,240,255,0.15);
}

.auth-input.error {
  border-color: var(--red);
  animation: shake 0.4s ease-in-out;
}

.auth-hint {
  color: var(--text-dim);
  font-size: 11px;
}

/* ---- HEADER ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.live-dot.disconnected {
  background: var(--red);
  animation: none;
}

.last-update {
  color: var(--text-dim);
  font-size: 11px;
}

/* ---- DASHBOARD GRID ---- */
#dashboard {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto auto auto;
  gap: 16px;
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- PANELS ---- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.3s;
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--cyan);
}

.panel-header::before {
  content: '>_ ';
  opacity: 0.5;
}

.panel-body {
  padding: 14px;
}

/* Services panel */
.services-panel {
  grid-row: 1 / 3;
}

/* Agents panel */
.agents-panel {
  grid-column: 2;
}

/* Metrics panel */
.metrics-panel {
  grid-column: 1 / -1;
}

/* Bottom row */
.sites-panel {
  grid-column: 1;
}

.claude-panel {
  grid-column: 2;
}

/* Activity & History */
.activity-panel {
  grid-column: 1 / -1;
}

.history-panel {
  grid-column: 1 / -1;
}

/* ---- SERVICE CARD ---- */
.service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.service-item:last-child {
  border-bottom: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active { background: var(--green); box-shadow: 0 0 8px rgba(0,255,136,0.4); animation: pulse 2s infinite; }
.status-dot.inactive { background: var(--text-dim); }
.status-dot.failed { background: var(--red); box-shadow: 0 0 8px rgba(255,45,85,0.4); }

.service-info {
  flex: 1;
  min-width: 0;
}

.service-name {
  font-weight: 600;
  font-size: 13px;
}

.service-meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.service-mem {
  color: var(--cyan);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

/* ---- AGENT CARD ---- */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.agent-card {
  background: rgba(0,240,255,0.02);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  text-align: center;
  transition: all 0.3s;
}

.agent-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,240,255,0.1);
  transform: translateY(-2px);
}

.agent-card.working {
  border-color: rgba(0,255,136,0.3);
  box-shadow: 0 0 15px rgba(0,255,136,0.08);
}

.agent-avatar {
  font-size: 28px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 8px rgba(0,240,255,0.3));
}

.agent-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
}

.agent-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 2px;
  display: inline-block;
}

.agent-status.working { background: rgba(0,255,136,0.15); color: var(--green); }
.agent-status.idle { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.agent-status.offline { background: rgba(255,45,85,0.15); color: var(--red); }

.agent-time {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 6px;
}

/* ---- METRICS ---- */
.metrics-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.metric-item {
  flex: 1;
  min-width: 150px;
}

.metric-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.metric-value {
  color: var(--cyan);
  font-weight: 600;
}

.metric-bar {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.5s;
  background: var(--cyan);
}

.metric-fill.warn { background: var(--yellow); }
.metric-fill.danger { background: var(--magenta); }

.metrics-extra {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 11px;
  flex-wrap: wrap;
}

.metrics-extra span {
  color: var(--text);
}

/* ---- SITES ---- */
.site-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.site-item:last-child { border-bottom: none; }

.site-name { font-size: 12px; }

.site-status {
  font-size: 11px;
  font-weight: 600;
}

.site-status.ok { color: var(--green); }
.site-status.down { color: var(--red); }

.site-time {
  color: var(--text-dim);
  font-size: 10px;
  min-width: 50px;
  text-align: right;
}

/* ---- CLAUDE STATS ---- */
.claude-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.claude-stat {
  display: flex;
  flex-direction: column;
}

.claude-stat-label {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.claude-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--cyan);
  font-family: var(--font-display);
}

.claude-processes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- ACTIVITY LOG ---- */
.activity-list {
  max-height: 240px;
  overflow-y: auto;
}

.activity-list::-webkit-scrollbar { width: 4px; }
.activity-list::-webkit-scrollbar-track { background: transparent; }
.activity-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.activity-item {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  animation: slideIn 0.3s ease;
}

.activity-time {
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 55px;
}

.activity-source {
  color: var(--magenta);
  font-weight: 600;
  min-width: 80px;
}

.activity-msg {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- HISTORY CHART ---- */
.history-svg {
  width: 100%;
  height: 80px;
}

.history-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 20px;
  font-size: 11px;
}

/* ---- ANIMATIONS ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0,240,255,0.2); }
  50% { box-shadow: 0 0 20px rgba(0,240,255,0.4); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .services-panel { grid-row: auto; }
  .agents-panel { grid-column: 1; }
  .metrics-panel { grid-column: 1; }
  .sites-panel { grid-column: 1; }
  .claude-panel { grid-column: 1; }
  .activity-panel { grid-column: 1; }
  .history-panel { grid-column: 1; }

  .metrics-row { flex-direction: column; gap: 12px; }
  .agents-grid { grid-template-columns: repeat(2, 1fr); }

  .header { padding: 12px 16px; }
  .header-title { font-size: 13px; letter-spacing: 2px; }
}

@media (max-width: 480px) {
  .agents-grid { grid-template-columns: 1fr 1fr; }
  .claude-grid { grid-template-columns: 1fr 1fr; }
}
