/* Shared dark-theme styles for Pi-Mono agent UIs */
:root { --bg: #0f1117; --surface: #1a1d27; --border: #2a2d3a; --text: #e4e4e7; --muted: #71717a; --accent: #6366f1; --user-bg: #312e81; --agent-bg: #1e293b; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; }
header { padding: 16px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
header h1 { font-size: 18px; font-weight: 600; }
header p { font-size: 13px; color: var(--muted); margin-top: 2px; }
#chat { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 80%; padding: 12px 16px; border-radius: 12px; line-height: 1.6; font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--user-bg); border-bottom-right-radius: 4px; }
.msg.agent { align-self: flex-start; background: var(--agent-bg); border-bottom-left-radius: 4px; }
.msg.agent pre { background: #0d1117; padding: 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; font-size: 13px; }
.msg.agent code { font-size: 13px; }
.msg.agent table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.msg.agent th, .msg.agent td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.msg.agent th { background: var(--surface); }
.msg.error { align-self: center; background: #7f1d1d; color: #fca5a5; font-size: 13px; }
.status { align-self: center; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.status .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
/* Step list styles */
.step-list { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; min-width: 360px; max-width: 60%; }
.step-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--muted); }
.step-row .icon { width: 14px; text-align: center; flex-shrink: 0; }
.step-row .label { flex: 1; }
.step-row .timer { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.step-row .summary { color: #6366f1; margin-left: 4px; }
.step-row.active { color: var(--text); }
.step-row.active .icon { color: var(--accent); animation: spin 1.2s linear infinite; display: inline-block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.step-row.done .icon { color: #22c55e; }
.step-summary { display: flex; align-items: center; gap: 8px; padding: 6px 0 2px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--muted); font-size: 11px; }
.step-collapsed { align-self: flex-start; font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.step-collapsed:hover { color: var(--text); background: var(--surface); }
/* Chip buttons */
#chips { display: flex; gap: 8px; padding: 8px 24px; flex-wrap: wrap; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: border-color 0.2s; }
.chip:hover { border-color: var(--accent); }
/* Input bar */
#input-bar { display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface); }
#input-bar textarea { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 8px; font-size: 14px; font-family: inherit; resize: none; height: 44px; outline: none; }
#input-bar textarea:focus { border-color: var(--accent); }
#input-bar button { background: var(--accent); color: white; border: none; padding: 0 20px; border-radius: 8px; font-size: 14px; cursor: pointer; }
#input-bar button:disabled { opacity: 0.5; cursor: not-allowed; }
/* Login overlay */
#login-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 340px; text-align: center; }
.login-box h2 { margin-bottom: 8px; font-size: 20px; }
.login-box p { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-box input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 12px; }
.login-box input:focus { border-color: var(--accent); }
.login-box button { width: 100%; background: var(--accent); color: white; border: none; padding: 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.login-error { color: #fca5a5; font-size: 13px; margin-bottom: 12px; display: none; }

/* Feedback widget */
.feedback-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 0;
  font-size: 13px;
  opacity: 0.7;
}
.feedback-row:hover { opacity: 1; }
.feedback-stars { display: flex; gap: 2px; cursor: pointer; }
.feedback-stars span {
  font-size: 18px;
  color: #ccc;
  transition: color 0.1s;
  user-select: none;
}
.feedback-stars span:hover,
.feedback-stars span.hover,
.feedback-stars span.active { color: #f5a623; }
.feedback-input {
  display: none;
  flex: 1;
  align-items: center;
  gap: 4px;
}
.feedback-input.visible { display: flex; }
.feedback-input input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}
.feedback-input button {
  padding: 4px 10px;
  border: none;
  background: #4a9eff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.feedback-row.submitted { opacity: 0.5; pointer-events: none; }
.feedback-row.submitted .feedback-stars span.active { color: #f5a623; }
.feedback-thanks { font-size: 12px; color: #4a9eff; margin-left: 8px; }

/* Debug panel (dev mode only) */
.debug-panel {
  margin-top: 10px;
  padding: 8px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #a0a0b0;
  line-height: 1.6;
}
.debug-title {
  font-weight: bold;
  color: #6a6aff;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.debug-row { margin: 2px 0; }
.debug-label { color: #888; }
.debug-value { color: #e0e0e0; }
.debug-sql {
  color: #7ec8e3;
  word-break: break-all;
  font-size: 11px;
}
.debug-expand {
  color: #6a6aff;
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
}
.debug-expand:hover { text-decoration: underline; }
.debug-sql-full {
  color: #7ec8e3;
  font-size: 11px;
  background: #0d0d1a;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #2a2a3e;
  max-height: 200px;
  overflow-y: auto;
}

/* Ontology sidebar (dev mode) */
.step-row.clickable { cursor: pointer; }
.step-row.clickable:hover { color: var(--text); background: rgba(99, 102, 241, 0.08); border-radius: 4px; }
.step-row .ontology-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ont-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 45vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  box-shadow: -2px 0 12px rgba(0,0,0,0.3);
}
.ont-sidebar.open { transform: translateX(0); }
.ont-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.ont-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ont-sidebar-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ont-sidebar-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.ont-sidebar-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.ont-sidebar-path {
  padding: 6px 16px;
  font-size: 10px;
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ont-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.ont-sidebar-body pre {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: #e4e4e7;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
