/* Portal Styles - Agent-Friendly Monospace Design */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
}

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

body {
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 0.9rem;
}

/* Header */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-icon {
  width: 2rem; height: 2rem;
  background: var(--primary);
  border-radius: 0.375rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.125rem;
}

.logo-text { font-weight: 700; font-size: 1.125rem; letter-spacing: 0.1em; }

.portal-nav { display: flex; gap: 0.25rem; }

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.15s;
  font-size: 0.8rem;
}

.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-light); }

.dashboard-link {
  color: var(--primary);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--primary);
  border-radius: 0.375rem;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.dashboard-link:hover { background: var(--primary); color: var(--text); }

/* Main Content */
.portal-main { max-width: 1100px; margin: 0 auto; padding: 2rem; }

/* Hero */
.hero { text-align: center; padding: 3rem 2rem; }
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle { font-size: 1rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 1.5rem; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* System Status Badge */
.system-status-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2rem;
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}
.system-status-badge .health-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.system-status-badge .health-dot.operational { background: var(--success); }
.system-status-badge .health-dot.degraded { background: var(--warning); }
.system-status-badge .health-dot.down { background: var(--error); }

/* Onboarding CTA */
.onboarding-cta {
  display: block; text-align: center;
  padding: 0.75rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.1));
  border: 1px dashed var(--primary);
  border-radius: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: all 0.15s;
}
.onboarding-cta:hover { background: rgba(99,102,241,0.15); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  font-size: 0.85rem;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: var(--text); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-light); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn.copied { background: var(--success) !important; }

/* Task Path Cards */
.task-paths { margin: 2rem 0; }
.task-paths h2 { margin-bottom: 1rem; }
.task-path-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

.task-path-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.task-path-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.task-path-card h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.task-path-card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; }
.tool-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tool-list li code {
  background: var(--surface-light); padding: 0.125rem 0.5rem;
  border-radius: 0.25rem; font-size: 0.75rem;
}

/* Feature Cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 3rem 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: all 0.15s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.feature-icon {
  width: 2.5rem; height: 2.5rem;
  background: var(--primary);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.25rem; margin-bottom: 0.75rem;
}
.feature-card h3 { margin-bottom: 0.375rem; font-size: 0.95rem; }
.feature-card p { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.85rem; }
.feature-link { color: var(--primary); text-decoration: none; font-weight: 500; font-size: 0.85rem; }
.feature-link:hover { text-decoration: underline; }

/* AX Principles */
.ax-principles { margin: 3rem 0; text-align: center; }
.ax-principles h2 { margin-bottom: 0.375rem; }
.section-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.85rem; }
.principles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.principle {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.principle strong { color: var(--secondary); font-size: 0.8rem; }
.principle span { color: var(--text-muted); font-size: 0.8rem; }

/* Quick Start */
.quick-start { margin: 3rem 0; text-align: center; }
.quick-start h2 { margin-bottom: 1rem; }
.code-block {
  background: #0d1117; border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 1.25rem;
  text-align: left; overflow-x: auto;
  max-width: 600px; margin: 0 auto 0.75rem;
  position: relative;
}
.code-block pre { margin: 0; }
.code-block code { font-family: inherit; font-size: 0.8rem; color: #e6edf3; }
.code-caption { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.85rem; }

/* Footer */
.portal-footer {
  text-align: center; padding: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem; color: var(--text-muted);
  font-size: 0.8rem;
}
.footer-links { display: flex; gap: 1.5rem; justify-content: center; margin-top: 0.5rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ====================== Tools Page ====================== */
.tools-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.tools-header h1 { font-size: 1.5rem; }

.search-box { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.search-box input, .search-box select {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
}
.search-box input { width: 240px; }
.search-box input:focus, .search-box select:focus { outline: none; border-color: var(--primary); }

.tools-grid { display: grid; gap: 0.75rem; }

/* Tool Cards */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tool-card:hover { border-color: var(--primary); }
.tool-card.expanded { border-color: var(--primary); }

.tool-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 0.375rem; gap: 0.5rem;
}
.tool-card-meta { display: flex; align-items: center; gap: 0.5rem; }
.tool-name { font-weight: 600; font-size: 1rem; }
.tool-name code { background: none; padding: 0; font-size: inherit; }
.tool-category {
  background: var(--surface-light); padding: 0.125rem 0.5rem;
  border-radius: 0.25rem; font-size: 0.7rem; text-transform: uppercase;
}
.tool-description { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.85rem; }
.tool-card-footer { display: flex; gap: 1rem; align-items: center; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.param-count { background: var(--surface-light); padding: 0.125rem 0.5rem; border-radius: 0.25rem; }
.tool-verified { font-style: italic; }
.tool-tags { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.tool-tag {
  background: rgba(99,102,241,0.2); color: var(--primary);
  padding: 0.0625rem 0.375rem; border-radius: 0.25rem; font-size: 0.7rem;
}

/* Health Badge */
.health-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem; border-radius: 0.25rem;
  font-size: 0.7rem; font-weight: 500;
}
.health-badge.operational { background: rgba(34,197,94,0.15); color: var(--success); }
.health-badge.degraded { background: rgba(234,179,8,0.15); color: var(--warning); }
.health-badge.down { background: rgba(239,68,68,0.15); color: var(--error); }
.health-dot { width: 0.375rem; height: 0.375rem; border-radius: 50%; }
.health-badge.operational .health-dot { background: var(--success); }
.health-badge.degraded .health-dot { background: var(--warning); }
.health-badge.down .health-dot { background: var(--error); }

/* Freshness Warning */
.freshness-warning {
  color: var(--warning); font-size: 0.7rem; font-style: italic;
  padding: 0.125rem 0.375rem;
  background: rgba(234,179,8,0.1);
  border-radius: 0.25rem;
}

/* Tool Detail (inline expand) */
.tool-detail {
  background: var(--surface); border: 1px solid var(--primary);
  border-radius: 0.75rem; padding: 1.5rem; margin-top: 0.75rem;
}
.tool-detail h2 { margin-bottom: 0.75rem; font-size: 1.25rem; }
.tool-section { margin-bottom: 1.25rem; }
.tool-section h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.375rem; }

.params-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.params-table th, .params-table td { text-align: left; padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--border); }
.params-table th { color: var(--text-muted); font-weight: 500; }

/* More tools toggle */
.more-tools-toggle {
  background: none; border: 1px dashed var(--border);
  color: var(--text-muted); padding: 0.75rem;
  border-radius: 0.5rem; width: 100%;
  cursor: pointer; font-family: inherit;
  font-size: 0.8rem; transition: all 0.15s;
}
.more-tools-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ====================== Playground ====================== */
.playground-container {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.playground-input, .playground-output {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 1.25rem;
}
.playground-input h2, .playground-output h2 { margin-bottom: 0.75rem; font-size: 1.1rem; }

.playground-input label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
.playground-input select, .playground-input textarea, .playground-input input[type="text"], .playground-input input[type="number"] {
  width: 100%; padding: 0.5rem 0.75rem;
  background: var(--background); border: 1px solid var(--border);
  border-radius: 0.375rem; color: var(--text);
  margin-bottom: 0.75rem; font-family: inherit; font-size: 0.8rem;
}
.playground-input textarea { min-height: 150px; resize: vertical; }
.playground-input select:focus, .playground-input textarea:focus, .playground-input input:focus { outline: none; border-color: var(--primary); }

.playground-output pre {
  background: #0d1117; border-radius: 0.375rem;
  padding: 1rem; overflow-x: auto; font-size: 0.8rem;
  max-height: 500px; overflow-y: auto;
}

/* Sandbox warning */
.sandbox-warning {
  background: rgba(234,179,8,0.1); border: 1px solid rgba(234,179,8,0.3);
  border-radius: 0.375rem; padding: 0.5rem 0.75rem;
  color: var(--warning); font-size: 0.8rem;
  margin-bottom: 1rem;
}

/* Dynamic param form */
.param-field { margin-bottom: 0.75rem; }
.param-field label { display: flex; align-items: center; gap: 0.375rem; }
.param-field .required-mark { color: var(--error); }
.param-field input[type="checkbox"] { width: auto; margin-right: 0.25rem; }

/* Playground actions bar */
.playground-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* History panel */
.history-panel { margin-top: 1.5rem; }
.history-panel h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.375rem; padding: 0.75rem;
  margin-bottom: 0.5rem; cursor: pointer;
  font-size: 0.8rem; transition: all 0.15s;
}
.history-item:hover { border-color: var(--primary); }
.history-item .history-meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.75rem; }

/* Status badge */
.status-badge {
  display: inline-block; padding: 0.25rem 0.75rem;
  border-radius: 1rem; font-size: 0.75rem;
  font-weight: 500; text-transform: uppercase;
}
.status-badge.ready { background: var(--surface-light); color: var(--text-muted); }
.status-badge.running { background: var(--warning); color: var(--background); }
.status-badge.success { background: var(--success); color: var(--background); }
.status-badge.error { background: var(--error); color: var(--text); }
.status-badge.operational { background: var(--success); color: var(--background); }
.status-badge.degraded { background: var(--warning); color: var(--background); }
.status-badge.down, .status-badge.checking { background: var(--surface-light); color: var(--text-muted); }

/* JSON syntax highlighting */
.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fbbf24; }
.json-boolean { color: #c084fc; }
.json-null { color: #94a3b8; }

/* ====================== Status Page ====================== */
.status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem; margin-bottom: 1.5rem;
}
.status-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 1.25rem;
}
.status-card h3 {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.375rem; font-size: 0.9rem;
}
.status-indicator { width: 0.625rem; height: 0.625rem; border-radius: 50%; flex-shrink: 0; }
.status-indicator.operational { background: var(--success); }
.status-indicator.degraded { background: var(--warning); }
.status-indicator.down { background: var(--error); }
.status-indicator.disabled { background: var(--text-muted); }
.metric-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.metric-label { color: var(--text-muted); font-size: 0.8rem; }

/* Status banner */
.status-banner {
  padding: 0.75rem 1rem; border-radius: 0.5rem;
  margin-bottom: 1.5rem; font-size: 0.85rem;
}
.status-banner.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--error); }
.status-banner.warning { background: rgba(234,179,8,0.15); border: 1px solid rgba(234,179,8,0.3); color: var(--warning); }

/* Tool health rows */
.tool-health-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tool-health-table th, .tool-health-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.tool-health-table th { color: var(--text-muted); font-weight: 500; }

/* ====================== Onboarding ====================== */
.progress-bar-container {
  background: var(--surface); border-radius: 1rem;
  height: 0.5rem; margin-bottom: 2rem; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 1rem; transition: width 0.3s;
}
.progress-steps {
  display: flex; justify-content: space-between;
  margin-bottom: 0.5rem; font-size: 0.75rem; color: var(--text-muted);
}
.progress-steps span.active { color: var(--primary); font-weight: 600; }
.progress-steps span.completed { color: var(--success); }

.onboarding-steps { display: flex; flex-direction: column; gap: 1.5rem; }
.onboarding-step {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 1.5rem;
  display: none;
}
.onboarding-step.active { display: block; }
.onboarding-step.completed { border-color: var(--success); }

.step-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.step-number {
  width: 2.5rem; height: 2.5rem; flex-shrink: 0;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.1rem;
}
.step-number.completed { background: var(--success); }
.step-content h3 { margin-bottom: 0.375rem; }
.step-content p { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.85rem; }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.checkbox-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; background: var(--surface-light);
  border-radius: 0.375rem; cursor: pointer; transition: all 0.15s;
  font-size: 0.85rem;
}
.checkbox-item:hover { border-color: var(--primary); }
.checkbox-item input { margin: 0; }

.step-nav { display: flex; justify-content: space-between; margin-top: 1rem; }

/* Completion section */
.completion-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.1));
  border: 1px solid var(--primary);
  border-radius: 0.75rem;
  padding: 2rem; text-align: center;
}
.completion-card h2 { margin-bottom: 0.5rem; color: var(--success); }
.completion-actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* App info badge */
.app-info {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.1));
  border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem;
}
.app-badge { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.app-icon { font-size: 1.5rem; }
.app-badge .app-name { font-weight: 600; font-size: 1rem; color: var(--primary); }
.app-badge .app-category { font-size: 0.7rem; background: var(--surface); padding: 0.125rem 0.375rem; border-radius: 0.25rem; color: var(--text-muted); }
.app-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.375rem; }

/* Loading */
.loading { color: var(--text-muted); padding: 2rem; text-align: center; }
.error { color: var(--error); }
.no-results { color: var(--text-muted); padding: 2rem; text-align: center; }

/* Responsive */
@media (max-width: 768px) {
  .portal-header { flex-direction: column; gap: 0.75rem; padding: 0.75rem 1rem; }
  .portal-nav { flex-wrap: wrap; justify-content: center; }
  .hero h1 { font-size: 1.75rem; }
  .playground-container { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .search-box { flex-direction: column; }
  .search-box input { width: 100%; }
}
