/* Command Center - Styles */
:root {
  --bg: #0d0d0d;
  --bg-card: #161616;
  --bg-card-hover: #1e1e1e;
  --border: #2a2a2a;
  --border-light: #333;
  --text: #e0e0e0;
  --text-muted: #888;
  --text-dim: #555;
  --accent: #4fc3f7;
  --accent-glow: rgba(79, 195, 247, 0.15);
  --green: #66bb6a;
  --green-dim: #2e7d32;
  --yellow: #ffd54f;
  --red: #ef5350;
  --orange: #ff8a65;
  --purple: #ba68c8;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  max-width: 1440px;
  margin: 0 auto;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.logo svg { width: 24px; height: 24px; }
.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 2s infinite;
}
.status-dot.online { background: var(--green); animation: none; }
.status-dot.error { background: var(--red); animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--bg-card-hover); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Main */
main {
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 { font-size: 20px; font-weight: 600; }

/* Agents Grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}
.agent-card:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.agent-card .agent-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.agent-card .agent-name { font-size: 18px; font-weight: 700; }
.agent-card .agent-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.agent-status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-online { background: rgba(102, 187, 106, 0.15); color: var(--green); }
.status-idle { background: rgba(255, 213, 79, 0.15); color: var(--yellow); }
.status-offline { background: rgba(239, 83, 80, 0.15); color: var(--red); }

.agent-meta { font-size: 12px; color: var(--text-muted); line-height: 1.8; }
.agent-meta .label { color: var(--text-dim); }
.agent-model {
  font-family: var(--font);
  font-size: 11px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.overview-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Resource bars */
.resource-bars { display: flex; flex-direction: column; gap: 16px; }
.resource-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.resource-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.resource-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.bar-cpu { background: linear-gradient(90deg, var(--accent), var(--purple)); }
.bar-ram { background: linear-gradient(90deg, var(--green), var(--green-dim)); }
.bar-disk { background: linear-gradient(90deg, var(--orange), #c62828); }

/* Cost summary */
.cost-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.cost-item {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.cost-item .cost-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.cost-item .cost-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Activity */
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-group label { font-size: 12px; color: var(--text-muted); }
.filter-group select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 8px;
}
.activity-entry {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.activity-time {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 140px;
}
.activity-agent {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 60px;
}
.activity-action { font-size: 13px; flex: 1; }

/* Costs */
.cost-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cost-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.cost-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 16px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }

/* System */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.system-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.system-stat .stat-value {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 4px;
}
.system-stat .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.system-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.system-chart-container h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Wiki */
.wiki-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.wiki-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.wiki-card .wiki-name { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.wiki-card .wiki-count { font-size: 13px; color: var(--text-muted); }
.wiki-card .wiki-count span { color: var(--accent); font-weight: 700; font-size: 20px; }
.wiki-graph-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wiki-files { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.wiki-file-tag {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { filter: brightness(1.1); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* Footer */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: auto;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Agent modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: rgba(26, 32, 44, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.3s ease-out;
}

.modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(45, 55, 72, 0.6);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 30px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-section {
  margin-bottom: 30px;
}

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

.modal-section h3 {
  margin: 0 0 15px 0;
  color: var(--accent-primary);
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.model-selector {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.model-selector select {
  background: rgba(45, 55, 72, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  min-width: 200px;
}

.btn-primary {
  background: var(--accent-primary);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
}

.skills-list,
.chats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-item,
.chat-item {
  background: rgba(45, 55, 72, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  transition: all 0.2s ease;
}

.skill-item:hover,
.chat-item:hover {
  border-color: var(--accent-primary);
  background: rgba(45, 55, 72, 0.8);
}

.skill-name,
.chat-title {
  color: var(--text-primary);
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

.skill-category,
.chat-meta {
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skills-count {
  margin-top: 15px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
}

.loading,
.no-data,
.error {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-style: italic;
}

.error {
  color: var(--error-color);
}

/* Notification styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  z-index: 1100;
  animation: slideInRight 0.3s ease-out;
  max-width: 300px;
}

.notification-success {
  background: var(--success-color);
}

.notification-error {
  background: var(--error-color);
}

.notification-info {
  background: var(--accent-primary);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mobile responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
    max-height: 90vh;
  }
  
  .modal-header,
  .modal-body {
    padding: 20px;
  }
  
  .model-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .model-selector select {
    min-width: 0;
  }
}
  main { padding: 16px; }
  .agents-grid { grid-template-columns: 1fr; }
  .overview-bottom { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: 1fr; }
}

/* Muted text */
.muted { color: var(--text-dim); text-align: center; }

/* Status colors for stat cards */
.stat-green { color: var(--green); }
.stat-yellow { color: var(--yellow); }
.stat-red { color: var(--red); }
.stat-accent { color: var(--accent); }
