/* =============================================
   COMPONENT-LEVEL CSS
   Extracted from index.html inline styles
   ============================================= */

/* ── Workspace (Claude Code chat) ── */
#tab-workspace { display: flex; flex-direction: column; height: calc(100vh - 90px); padding: 0; }
.ws-topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--surface);
}
.ws-topbar h2 { margin: 0; font-size: 15px; flex: 1; }
.ws-cost-badge { font-size: 11px; color: var(--text-muted); background: var(--surface-2); padding: 2px 8px; border-radius: 10px; }
.ws-messages {
  flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--bg);
}
.ws-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6;
  word-break: break-word;
}
.ws-bubble.user {
  align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 3px;
}
.ws-bubble.assistant {
  align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 3px;
}
.ws-bubble.assistant.streaming { border-color: var(--accent); }
.ws-tool-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-family: 'Cascadia Code','Consolas',monospace;
  padding: 2px 8px; border-radius: 4px; margin: 2px 2px 6px 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
.ws-tool-edit { background: #1e3a2f; color: #4ade80; border: 1px solid #166534; }
.ws-tool-write { background: #1e2d3a; color: #60a5fa; border: 1px solid #1d4ed8; }
.ws-tool-bash { background: #2d1e3a; color: #c084fc; border: 1px solid #7c3aed; }
.ws-tool-read { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.ws-tool-badges { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
.ws-text { white-space: pre-wrap; }
.ws-cursor { display: inline-block; width: 8px; height: 14px; background: var(--accent); animation: blink 1s step-end infinite; vertical-align: text-bottom; margin-left: 1px; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.ws-meta { font-size: 10px; color: var(--text-muted); margin-top: 5px; }
.ws-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 8px; }
.ws-empty .ws-empty-icon { font-size: 40px; }
.ws-empty p { font-size: 13px; text-align: center; max-width: 320px; line-height: 1.6; }
.ws-input-bar {
  display: flex; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0; align-items: flex-end;
}
.ws-input-bar textarea {
  flex: 1; resize: none; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 13px; line-height: 1.5; font-family: inherit; max-height: 140px; min-height: 38px;
}
.ws-input-bar textarea:focus { outline: none; border-color: var(--accent); }
.ws-send-btn { flex-shrink: 0; height: 38px; padding: 0 16px; }
.ws-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Model selector ────────────────────────── */
.ws-model-select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 3px 6px;
  font-size: 11px; cursor: pointer; flex-shrink: 0;
}
.ws-model-select:focus { outline: none; border-color: var(--accent); }

/* ── Action buttons (quick replies) ─────────── */
.ws-action-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.ws-action-btn {
  padding: 4px 14px; border-radius: 20px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}
.ws-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.ws-action-btn.primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.ws-action-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ws-action-btn.danger {
  border-color: var(--red); color: var(--red);
}
.ws-action-btn.danger:hover { background: rgba(248,113,113,0.1); }

/* ── Phase Bar ──────────────────────────────── */
.ws-phase-bar { display:none; align-items:center; gap:0; padding:8px 18px;
  background:var(--surface); border-top:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; gap:12px; }
.ws-phase-bar.visible { display:flex; }
.ws-phase-step { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-muted);
  padding:4px 10px; border-radius:12px; border:1px solid transparent; transition:all 0.2s; }
.ws-phase-step.active { color:var(--accent); background:rgba(99,102,241,0.1);
  border-color:rgba(99,102,241,0.3); font-weight:600; }
.ws-phase-step.done { color:var(--text-muted); text-decoration:line-through; opacity:0.5; }
.ws-phase-arrow { font-size:11px; color:var(--text-muted); opacity:0.4; }
.ws-approve-btn { font-size:11px; padding:5px 14px; background:#10b981; color:#fff;
  border:none; border-radius:6px; cursor:pointer; font-weight:600; transition:all 0.2s; }
.ws-approve-btn:hover { background:#059669; }
.ws-approve-btn:disabled { opacity:0.5; cursor:not-allowed; }

/* ── Preview Status Bar ─────────────────────── */
.ws-preview-bar { display:none; align-items:center; gap:10px; padding:8px 18px;
  background:var(--surface); border-top:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; }
.ws-preview-bar.visible { display:flex; }
.ws-preview-state { font-size:12px; color:var(--text-muted); flex:1; min-width:0; }
.ws-preview-state .state-label { font-weight:600; color:var(--text); }
.ws-preview-state.state-building .state-label { color:#f59e0b; }
.ws-preview-state.state-ready   .state-label { color:#3b82f6; }
.ws-preview-state.state-seen    .state-label { color:#10b981; }
.ws-preview-state.state-deploying .state-label { color:#f97316; }
.ws-preview-state.state-cancelling .state-label { color:#ef4444; }

/* ── Chat/Agent styles ─────────────────────── */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, rgba(124, 106, 239, 0.13), var(--surface));
  cursor: pointer;
  user-select: none;
  transition: background 0.18s;
}

.chat-header:hover {
  background: linear-gradient(to right, rgba(124, 106, 239, 0.2), var(--surface));
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.chat-header .chat-cost {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 12px;
}

.chat-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.18s;
  line-height: 1;
  margin-left: 8px;
}

.chat-toggle-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.chat-container.collapsed .chat-messages,
.chat-container.collapsed .chat-input-area {
  display: none;
}

.chat-container.collapsed {
  flex: none;
}

.chat-container.collapsed .chat-header {
  border-bottom: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-message .msg-meta {
  font-size: 10px;
  margin-top: 8px;
  opacity: 0.6;
}

.chat-message.assistant .msg-meta {
  color: var(--text-muted);
}

.chat-spinner {
  align-self: flex-start;
  padding: 14px 18px;
  background: var(--surface2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.chat-spinner .dots {
  display: inline-flex;
  gap: 4px;
}

.chat-spinner .dots span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: chatBounce 1.4s ease-in-out infinite;
}

.chat-spinner .dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-spinner .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  background: var(--surface);
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.chat-input-area input:focus {
  border-color: var(--accent);
}

.chat-input-area button {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-input-area button:hover { background: var(--accent-hover); }

.chat-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Refresh button ────────────────────────── */
.refresh-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-btn.spinning {
  animation: spin 0.8s linear infinite;
}

/* ── System Prompts Panel ────────────────────── */
.prompts-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.prompts-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.prompts-nav-item {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
}

.prompts-nav-item:hover {
  background: var(--surface2);
}

.prompts-nav-item.active {
  background: var(--accent);
  color: white;
}

.prompts-nav-item .prompt-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.prompts-nav-item.active .prompt-subtitle {
  color: rgba(255,255,255,0.7);
}

.prompts-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  line-height: 1.7;
  font-size: 14px;
}

/* Markdown rendering in prompts */
.prompts-content h1 { font-size: 22px; margin: 0 0 8px 0; color: var(--accent); }
.prompts-content h2 { font-size: 17px; margin: 24px 0 10px 0; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.prompts-content h3 { font-size: 15px; margin: 18px 0 8px 0; }
.prompts-content p { margin: 8px 0; }
.prompts-content ul, .prompts-content ol { padding-left: 22px; margin: 8px 0; }
.prompts-content li { margin: 4px 0; }
.prompts-content code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}
.prompts-content pre {
  background: var(--surface2);
  padding: 14px 18px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
}
.prompts-content pre code { background: none; padding: 0; }
.prompts-content strong { color: var(--accent); }
.prompts-content table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 13px;
}
.prompts-content th, .prompts-content td {
  border: 1px solid var(--border);
  padding: 8px 14px;
  text-align: left;
}
.prompts-content th { background: var(--surface); font-weight: 600; }
.prompts-content tr:hover td { background: rgba(124, 106, 239, 0.04); }
.prompts-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.prompts-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.prompts-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 20px;
}

.prompts-empty .icon { font-size: 48px; margin-bottom: 16px; }

.prompts-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
}

.prompt-used-by {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.prompt-used-by .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.prompt-used-by .job-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.job-chip {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.job-chip.enabled {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.job-chip.disabled {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Rating styles ─────────────────────────── */
.rating-select { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-option {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.rating-option:hover { border-color: var(--accent); color: var(--accent); }
.rating-option.selected { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Empty/loading states ──────────────────── */
.team-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

.team-empty {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.team-empty .icon { font-size: 36px; margin-bottom: 12px; }
