/* Vektor API - Infrastructure Node Dashboard */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-hover: #252525;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: #27272a;
  --border-light: #3f3f46;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
  --cyan: #06b6d4;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Loading */
#loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Auth Gate */
#auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.login-logo { font-size: 3rem; margin-bottom: 1rem; }

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, #06b6d4 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: #fff;
  color: #1f1f1f;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.google-btn:hover { background: #f3f4f6; transform: translateY(-2px); }
.login-note { margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-muted); }

/* Header */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.125rem; font-weight: 700; }

/* Health Status */
.health-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.health-status.online { color: var(--success); }
.health-status.offline { color: var(--error); }

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.health-dot.online {
  background: var(--success);
  animation: pulse 2s infinite;
}

.health-dot.offline { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.signout-btn {
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.signout-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Main Content */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Flow Visualization */
.flow-section {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a2e 100%);
  border: 1px solid var(--accent);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.flow-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.flow-node {
  text-align: center;
  padding: 1rem 1.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  min-width: 120px;
  transition: all 0.3s;
}

.flow-node:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.flow-icon { font-size: 1.75rem; margin-bottom: 0.25rem; }
.flow-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.flow-count { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }

.flow-api { border-color: var(--accent); }
.flow-api .flow-label { color: var(--accent); }

.flow-arrow {
  color: var(--accent);
  opacity: 0.6;
}

.flow-arrow svg {
  width: 24px;
  height: 24px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyan);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kns-card .stat-value { color: var(--accent); }

/* Endpoint Section */
.endpoint-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.endpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.endpoint-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.endpoint-badge {
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border-radius: 0.25rem;
  font-weight: 600;
}

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.endpoint-url {
  flex: 1;
  background: var(--bg-primary);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--success);
  word-break: break-all;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* Sites Section */
.sites-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sites-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s;
}

.site-icon:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.site-emoji { font-size: 1.25rem; }

/* Activity Section */
.activity-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
}

.activity-section .section-header {
  padding: 1rem 1.25rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.7rem;
  color: var(--success);
}

.live-badge .pulse {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.table-container {
  overflow-x: auto;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.activity-table th,
.activity-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.activity-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.activity-table tr:hover td { background: var(--bg-hover); }

.activity-table td {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.time-cell { color: var(--text-muted); font-size: 0.8rem; }
.site-cell { color: var(--accent); font-weight: 500; }
.model-cell { color: var(--cyan); }
.tokens-cell { color: var(--warning); }
.cost-cell { color: var(--text-muted); }

.empty-state {
  padding: 2rem !important;
  text-align: center;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif !important;
}

/* Tips Section */
.tips-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.tip-icon { font-size: 1rem; opacity: 0.8; }

.tip-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.footer-brand {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

/* Mobile Responsive */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .flow-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .flow-node {
    width: 100%;
    max-width: 200px;
  }

  .header-content {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .health-status {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

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

  .stat-value { font-size: 1.25rem; }

  .main-content { padding: 1rem; }

  .endpoint-row {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-btn {
    width: 100%;
    height: auto;
    padding: 0.75rem;
  }
}
