:root {
  --red: #ff4d4f;
  --red-light: #fff1f0;
  --red-dark: #cf1322;
  --sidebar-width: 240px;
  --text-primary: #1f1f1f;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #f0f0f0;
  --bg-sidebar: #fafafa;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #fff;
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.app-layout {
  display: flex;
  height: 100vh;
}

.app-layout .third-panel {
  width: 0;
  flex-shrink: 0;
  transition: width 0.25s ease;
  border-left: 1px solid #f0f0f0;
}

.app-layout.with-third .third-panel {
  width: 420px;
}

.app-layout.with-third .third-panel.hidden {
  display: flex;
}

.third-panel.tp-open {
  width: 420px;
}

@media (max-width: 960px) {
  .app-layout.with-third .third-panel {
    width: 100%;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
  }
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 600;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.2s;
}

.new-chat-btn:hover {
  background: var(--red-dark);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  transition: background 0.2s;
}

.nav-item:hover {
  background: #f0f0f0;
}

.nav-item.active {
  background: var(--red-light);
  color: var(--red);
}

.nav-item.sub {
  padding-left: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-icon {
  font-size: 16px;
}

.sidebar-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.section-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 12px;
}

.recent-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item:hover {
  background: #f0f0f0;
}

.back-to-search {
  margin-top: auto;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.back-to-search:hover {
  background: #f0f0f0;
  color: var(--red);
}

/* ===== 主聊天区 ===== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
}

.chat-welcome {
  text-align: center;
  margin-bottom: 40px;
}

.welcome-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 12px;
}

.welcome-title .highlight {
  color: var(--red);
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

.suggested-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 32px;
  max-width: 700px;
}

.query-pill {
  padding: 8px 16px;
  background: #f5f5f5;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.query-pill:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

.query-refresh {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

/* 消息区 */
.chat-messages {
  flex: 1;
  width: 100%;
  max-width: 800px;
  overflow-y: auto;
  padding: 20px 0;
  margin-bottom: 20px;
}

.message {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

.message > div:not(.message-avatar) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 70%;
}

.message.user > div:not(.message-avatar) {
  align-items: flex-end;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.message.assistant .message-avatar {
  background: var(--red-light);
  color: var(--red);
}

.message.user .message-avatar {
  background: #e6f4ff;
  color: #1677ff;
}

.message-content {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
}

.message.assistant .message-content {
  background: #f5f5f5;
}

.message.user .message-content {
  background: var(--red);
  color: #fff;
}

/* ===== 输入区 ===== */
.chat-input-area {
  width: 100%;
  max-width: 800px;
  margin-top: auto;
}

.input-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.input-box textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
}

.input-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.input-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.tool-btn.mode-btn.active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.send-btn:hover {
  background: var(--red-dark);
}

/* 智能体快捷入口 */
.agent-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
}

.agent-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 72px;
}

.agent-shortcut:hover {
  background: var(--red-light);
  color: var(--red);
}

.shortcut-icon {
  font-size: 24px;
}

.agent-shortcut.more .shortcut-icon {
  font-size: 20px;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .chat-main {
    padding: 20px;
  }

  .welcome-title {
    font-size: 24px;
  }
}
