/**
 * weiguan-ai.css - 超级维管 AI 对话页面样式
 * 深色科技风，流式对话界面
 */

/* ===== 页面容器 ===== */
.ai-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-primary, #0d1117);
  color: var(--text-primary, #e0e6ed);
  font-family: 'Microsoft YaHei', sans-serif;
}

/* ===== 顶部栏 ===== */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-secondary, #161b22);
  border-bottom: 1px solid var(--border-color, #30363d);
  flex-shrink: 0;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ai-back {
  color: var(--text-muted, #8b949e);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.ai-back:hover { color: var(--primary, #58a6ff); }

.ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #e0e6ed);
}

.ai-title > i {
  color: #a371f7;
  font-size: 20px;
}

.ai-badge {
  background: linear-gradient(135deg, #a371f7, #58a6ff);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.ai-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted, #8b949e);
}

.ai-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted, #8b949e);
}

.ai-status.online .status-dot {
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.5);
}

.ai-status.online .status-text { color: #3fb950; }

.ai-status.error .status-dot {
  background: #f85149;
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.5);
}

.ai-btn-clear {
  background: transparent;
  border: 1px solid var(--border-color, #30363d);
  color: var(--text-muted, #8b949e);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.ai-btn-clear:hover {
  border-color: #f85149;
  color: #f85149;
}

/* ===== 主体布局 ===== */
.ai-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.ai-sidebar {
  width: 260px;
  background: var(--bg-secondary, #161b22);
  border-right: 1px solid var(--border-color, #30363d);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.ai-sidebar-title {
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary, #c9d1d9);
  border-bottom: 1px solid var(--border-color, #30363d);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-sidebar-title > i { color: #d29922; }

.ai-quick-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.ai-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary, #c9d1d9);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.ai-quick-item:hover {
  background: rgba(88, 166, 255, 0.08);
  border-color: rgba(88, 166, 255, 0.2);
  color: var(--primary, #58a6ff);
}

.ai-quick-item > i {
  width: 20px;
  text-align: center;
  color: var(--text-muted, #8b949e);
  font-size: 14px;
}

.ai-quick-item:hover > i { color: var(--primary, #58a6ff); }

.ai-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color, #30363d);
}

.ai-api-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted, #8b949e);
}

.ai-api-info > i { color: #a371f7; }

/* ===== 对话区域 ===== */
.ai-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 欢迎消息 */
.ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  text-align: center;
}

.ai-welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(163, 113, 247, 0.15), rgba(88, 166, 255, 0.15));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border: 1px solid rgba(163, 113, 247, 0.2);
}

.ai-welcome-icon > i {
  font-size: 36px;
  color: #a371f7;
}

.ai-welcome h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #a371f7, #58a6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-welcome > p {
  color: var(--text-muted, #8b949e);
  font-size: 14px;
  margin-bottom: 24px;
}

.ai-welcome-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 480px;
}

.ai-welcome-tags span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary, #161b22);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary, #c9d1d9);
  transition: all 0.2s;
  cursor: default;
}

.ai-welcome-tags span:hover {
  border-color: rgba(88, 166, 255, 0.4);
  background: rgba(88, 166, 255, 0.05);
}

.ai-welcome-tags span > i { font-size: 12px; color: var(--primary, #58a6ff); }

/* 消息列表 */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 1024px) {
  .ai-messages { padding: 20px 10%; }
}

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

/* 消息气泡 */
.ai-message {
  display: flex;
  gap: 12px;
  max-width: 100%;
}

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

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ai-message.ai .ai-avatar {
  background: linear-gradient(135deg, rgba(163, 113, 247, 0.2), rgba(88, 166, 255, 0.2));
  color: #a371f7;
  border: 1px solid rgba(163, 113, 247, 0.2);
}

.ai-message.user .ai-avatar {
  background: linear-gradient(135deg, rgba(47, 129, 247, 0.2), rgba(56, 139, 253, 0.2));
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.ai-bubble {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
  max-width: 80%;
  word-break: break-word;
}

.ai-message.ai .ai-bubble {
  background: var(--bg-secondary, #161b22);
  border: 1px solid var(--border-color, #30363d);
  color: var(--text-primary, #e0e6ed);
  border-bottom-left-radius: 4px;
}

.ai-message.user .ai-bubble {
  background: linear-gradient(135deg, rgba(47, 129, 247, 0.15), rgba(88, 166, 255, 0.15));
  border: 1px solid rgba(88, 166, 255, 0.2);
  color: var(--text-primary, #e0e6ed);
  border-bottom-right-radius: 4px;
}

/* 消息内容样式 */
.ai-bubble pre {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 10px 0;
}

.ai-bubble pre code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: #e6edf3;
  line-height: 1.6;
}

.ai-bubble code:not(pre code) {
  background: rgba(110, 118, 129, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #a5d6ff;
}

.ai-bubble p { margin: 8px 0; }
.ai-bubble ul, .ai-bubble ol { margin: 8px 0; padding-left: 20px; }
.ai-bubble li { margin: 4px 0; }
.ai-bubble h1, .ai-bubble h2, .ai-bubble h3 { margin: 16px 0 8px; color: #e6edf3; }
.ai-bubble strong { color: #fff; }
.ai-bubble blockquote {
  border-left: 3px solid #a371f7;
  margin: 10px 0;
  padding: 8px 16px;
  background: rgba(163, 113, 247, 0.05);
  border-radius: 0 8px 8px 0;
}

/* 流式打字光标 */
.ai-typing::after {
  content: '|';
  animation: blink 1s infinite;
  color: #58a6ff;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 思考中状态 */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(163, 113, 247, 0.05);
  border: 1px solid rgba(163, 113, 247, 0.15);
  border-radius: 12px;
  font-size: 13px;
  color: #a371f7;
  margin-bottom: 8px;
}

.ai-thinking i {
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 意图标签 */
.ai-intent-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 16px;
  font-size: 12px;
  color: #58a6ff;
  margin-bottom: 8px;
}

/* ===== 输入区域 ===== */
.ai-input-area {
  padding: 16px 20%;
  border-top: 1px solid var(--border-color, #30363d);
  background: var(--bg-secondary, #161b22);
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .ai-input-area { padding: 16px 10%; }
}

@media (max-width: 768px) {
  .ai-input-area { padding: 12px 16px; }
}

.ai-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-primary, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 12px;
  padding: 4px;
}

.ai-input-wrapper:focus-within {
  border-color: rgba(88, 166, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.08);
}

.ai-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #e0e6ed);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  font-family: inherit;
}

.ai-input-wrapper textarea::placeholder {
  color: var(--text-muted, #6e7681);
}

.ai-input-wrapper button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a371f7, #58a6ff);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin: 4px;
  flex-shrink: 0;
}

.ai-input-wrapper button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}

.ai-input-wrapper button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted, #484f58);
  margin-top: 8px;
}

/* ===== 隐藏状态 ===== */
.hidden { display: none !important; }

/* ===== 滚动条 ===== */
.ai-messages::-webkit-scrollbar { width: 6px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.ai-messages::-webkit-scrollbar-thumb:hover { background: #484f58; }

.ai-quick-list::-webkit-scrollbar { width: 4px; }
.ai-quick-list::-webkit-scrollbar-track { background: transparent; }
.ai-quick-list::-webkit-scrollbar-thumb { background: #21262d; border-radius: 2px; }
