/* ================================================================
   Agent 角色平台 - 通用组件样式
   Toast / Modal / Spinner / Markdown 内容 / Loading
   ================================================================ */

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 28px;
  width: 460px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal h3 { font-size: 18px; margin-bottom: 20px; color: var(--text-primary); }
.modal .form-group { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---- Toast ---- */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  animation: slideIn 0.3s ease; max-width: 380px;
}
.toast.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.toast.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.toast.info { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Spinner ---- */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
.spinner.lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px; gap: 12px; color: var(--text-muted);
}

/* ---- Markdown 内容样式（聊天消息内） ---- */
.chat-msg.markdown-body h1,
.chat-msg.markdown-body h2,
.chat-msg.markdown-body h3,
.chat-msg.markdown-body h4 { margin: 14px 0 8px; line-height: 1.3; color: var(--text-primary); }
.chat-msg.markdown-body h1 { font-size: 18px; border-bottom: 2px solid var(--border); padding-bottom: 4px; }
.chat-msg.markdown-body h2 { font-size: 16px; border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.chat-msg.markdown-body h3 { font-size: 14px; }
.chat-msg.markdown-body h4 { font-size: 13px; opacity: 0.9; }
.chat-msg.markdown-body h1:first-child,
.chat-msg.markdown-body h2:first-child,
.chat-msg.markdown-body h3:first-child { margin-top: 0; }
.chat-msg.markdown-body p { margin: 6px 0; }
.chat-msg.markdown-body ul,
.chat-msg.markdown-body ol { margin: 6px 0; padding-left: 20px; }
.chat-msg.markdown-body li { margin: 3px 0; }
.chat-msg.markdown-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12px; overflow-x: auto; display: block; }
.chat-msg.markdown-body th,
.chat-msg.markdown-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; white-space: nowrap; }
.chat-msg.markdown-body th { background: var(--bg-hover); font-weight: 600; color: var(--text-primary); }
.chat-msg.markdown-body td { color: var(--text-secondary); }
.chat-msg.markdown-body pre {
  background: #1e1e2e; color: #cdd6f4; border-radius: 8px;
  padding: 12px 16px; margin: 8px 0; overflow-x: auto; font-size: 12px; line-height: 1.5;
}
.chat-msg.markdown-body code {
  background: var(--bg-hover); color: var(--accent); padding: 2px 6px;
  border-radius: 4px; font-size: 12px; font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}
.chat-msg.markdown-body pre code { background: none; color: inherit; padding: 0; border-radius: 0; font-size: inherit; }
.chat-msg.markdown-body blockquote {
  border-left: 3px solid var(--accent); margin: 8px 0; padding: 6px 12px;
  background: var(--accent-bg); border-radius: 0 4px 4px 0; color: var(--text-secondary);
}
.chat-msg.markdown-body blockquote p { margin: 4px 0; }
.chat-msg.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.chat-msg.markdown-body a { color: var(--accent); text-decoration: underline; }
.chat-msg.markdown-body strong { color: var(--text-primary); font-weight: 600; }
.chat-msg.markdown-body img { max-width: 100%; border-radius: 4px; }
