/* /home/jason/.openclaw/dashboard/index.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-color: #0f1115;
  --bg-accent: #16181d;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;

  --glass-bg: rgba(22, 24, 29, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);

  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;

  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-border: rgba(255, 255, 255, 0.1);
  --btn-hover: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(0, 0, 0, 0.2);
  --input-border: rgba(255, 255, 255, 0.1);
}

body.light-mode {
  --bg-color: #f8fafc;
  --bg-accent: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);

  --btn-bg: rgba(0, 0, 0, 0.05);
  --btn-border: rgba(0, 0, 0, 0.15);
  --btn-hover: rgba(0, 0, 0, 0.08);
  --input-bg: rgba(255, 255, 255, 0.6);
  --input-border: rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  /* subtle radial gradient for depth */
  background-image: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Layout */
.dashboard-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1800px;
  margin: 0 auto;
  height: 100vh;
}

.header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-radius: 20px;
}

.title-area h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-area h1 i {
  color: var(--accent-blue);
  -webkit-text-fill-color: initial;
}

/* System Monitor Grid */
.sys-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.metric-value {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* 进度条动画 */
.progress-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-blue {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.fill-green {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.fill-purple {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

/* Sidebar (Controls & LLM config) */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  padding-right: 8px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Command Center */
.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 20px;
}

.cmd-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
}

.cmd-btn:hover {
  background: var(--btn-hover);
  transform: translateY(-2px);
}

.cmd-btn.restart:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.cmd-btn.upgrade:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.cmd-btn.shutdown:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: visible;
  min-width: 0;
}

/* Agent Matrix */
.agent-matrix {
  padding: 24px;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}

.agent-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 200px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.agent-card:hover {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent-name {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Agent Status Indicators */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-idle {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-working {
  background-color: var(--accent-blue);
  box-shadow: 0 0 12px var(--accent-blue);
  animation: pulse 1.5s infinite alternate;
}

.status-error {
  background-color: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

@keyframes pulse {
  from {
    opacity: 0.6;
    transform: scale(0.95);
    box-shadow: 0 0 8px var(--accent-blue);
  }

  to {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 16px var(--accent-blue);
  }
}

/* Subagent status orb */
.status-orb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: inline-block;
  margin-right: 6px;
  transition: all 0.3s;
}

.status-orb.active {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: orb-pulse 1.2s infinite alternate;
}

@keyframes orb-pulse {
  from {
    opacity: 0.6;
    transform: scale(1);
  }

  to {
    opacity: 1;
    transform: scale(1.3);
  }
}

.model-selector {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 0.85rem;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.model-selector:focus {
  border-color: var(--accent-blue);
}

.model-selector option {
  background: var(--bg-accent);
  color: var(--text-primary);
}

/* Terminal Zone */
.terminal-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  min-height: 300px;
  overflow: visible;
  min-width: 0;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 0;
}

.terminal-tabs {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}

.terminal-tabs::-webkit-scrollbar {
  display: none;
}

.terminal-tab {
  cursor: pointer;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-blue);
}

.terminal-output {
  flex: 1;
  background: var(--input-bg);
  border-radius: 12px;
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.05);
  max-height: 380px;
  scroll-behavior: smooth;
}

.terminal-output .log-line {
  margin-bottom: 4px;
  display: flex;
  gap: 10px;
}

.log-time {
  color: #5c6370;
}

.log-info {
  color: #61afef;
}

.log-warn {
  color: #e5c07b;
}

.log-error {
  color: #e06c75;
}

.log-success {
  color: #98c379;
}

.log-agent {
  color: #c678dd;
}

/* Light Mode Overrides for Logs */
body.light-mode .log-time {
  color: #64748b;
}

body.light-mode .log-info {
  color: #2563eb;
}

body.light-mode .log-warn {
  color: #d97706;
}

body.light-mode .log-error {
  color: #dc2626;
}

body.light-mode .log-success {
  color: #16a34a;
}

body.light-mode .log-agent {
  color: #9333ea;
}

body.light-mode .terminal-output {
  background: rgba(255, 255, 255, 0.9);
}

/* LLM Config Area */
.llm-config {
  padding: 24px;
}

.provider-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

.config-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.2s;
}

.config-input:focus {
  border-color: var(--accent-purple);
}

.discovery-btn {
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.discovery-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.save-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.save-btn:hover {
  background: var(--accent-green);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-up {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Accordion */
.accordion-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.light-mode .accordion-item {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(0, 0, 0, 0.1);
}

.accordion-header {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.light-mode .accordion-header {
  background: rgba(0, 0, 0, 0.02);
}

.light-mode .accordion-header:hover {
  background: rgba(0, 0, 0, 0.06);
}

.accordion-body {
  padding: 12px;
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-direction: column;
  gap: 12px;
}

.light-mode .accordion-body {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.accordion-item.active .accordion-body {
  display: flex;
}

.accordion-item.active .fa-chevron-down {
  transform: rotate(180deg);
}