/* OPC圈子 · AI 助手（PC） */

.ai-layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 28px;
  padding: 30px 0 64px;
  align-items: start;
}

/* 侧栏 */
.ai-side {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-side-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.ai-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef3ff, #f3eeff);
  border: 1px solid #e2e9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.ai-side-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.ai-side-card h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.ai-side-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.8;
}

.ai-tags {
  margin-top: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-tags span {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

.ai-link {
  display: block;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: all 0.15s ease;
}

.ai-link:hover {
  background: #f6f9ff;
  color: var(--brand);
  transform: translateX(2px);
}

.ai-side-note {
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.7;
  padding: 0 4px;
}

/* 对话区 */
.ai-main {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 190px);
  overflow: hidden;
}

.ai-thread {
  flex: 1;
  padding: 26px 28px 10px;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}

.ai-msg {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: ai-in 0.24s ease;
}

@keyframes ai-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg .ai-bubble-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: linear-gradient(135deg, #eef3ff, #f3eeff);
  border: 1px solid #e5ebff;
}

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

.ai-msg.user .ai-bubble-avatar {
  background: linear-gradient(135deg, #2f6bff, #5b3ce0);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ai-bubble {
  max-width: 76%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
  background: #f7f9fe;
  border: 1px solid #eef2fa;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-msg.user .ai-bubble {
  background: linear-gradient(135deg, #2f6bff, #1e5eff 60%, #1246d4);
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(30, 94, 255, 0.24);
}

.ai-links {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-links a {
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--brand-soft-2);
  color: var(--brand);
  transition: all 0.15s ease;
}

.ai-links a:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* 打字指示 */
.ai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
}

.ai-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b9c6dd;
  animation: ai-dot 1.2s infinite;
}

.ai-typing i:nth-child(2) { animation-delay: 0.15s; }
.ai-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 快捷问题 */
.ai-suggest {
  padding: 10px 28px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-suggest button {
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.16s ease;
}

.ai-suggest button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #f7faff;
}

/* 输入区 */
.ai-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.9);
}

.ai-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font);
  line-height: 1.6;
  max-height: 120px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ai-composer textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 94, 255, 0.12);
}

.ai-composer .btn {
  height: 42px;
  padding: 0 22px;
}

@media (max-width: 960px) {
  .ai-layout {
    grid-template-columns: 1fr;
    padding: 16px 0 40px;
  }

  .ai-side {
    position: static;
    order: 2;
  }

  .ai-main {
    min-height: 68vh;
  }

  .ai-thread {
    max-height: none;
    padding: 18px 16px 8px;
  }

  .ai-bubble {
    max-width: 88%;
  }

  .ai-suggest {
    padding: 8px 16px 0;
  }

  .ai-composer {
    padding: 10px 14px 14px;
  }
}
