/* ═══════════════════════════════════════
   AI 助教抽屉
   ═══════════════════════════════════════ */

.assistant-root {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 90;
  pointer-events: none;
}

/* 抽屉打开时，整个页面右侧让出空间（避免遮挡） */
body {
  transition: padding-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
body.assistant-open {
  padding-right: 420px;
}
/* 顶栏是 sticky，自动跟随 body 宽度；但需要确保 backdrop 的模糊层也正确 */
body.assistant-open .topbar,
body.assistant-open .step-bar {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 悬浮按钮 */
.assistant-toggle {
  position: fixed;
  right: 20px; bottom: 32px;
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 14px;
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #fff; border: none;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.4);
  font-weight: 700; font-size: 14px;
  transition: all 0.25s;
  cursor: pointer;
}
.assistant-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(15, 118, 110, 0.5);
}
.assistant-root.open .assistant-toggle { display: none; }

.at-icon { font-size: 22px; line-height: 1; }
.at-text { letter-spacing: 0.02em; }
.at-dot {
  width: 8px; height: 8px;
  background: #14e8c3; border-radius: 50%;
  box-shadow: 0 0 8px #14e8c3;
  animation: atDot 1.5s infinite;
}
@keyframes atDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 抽屉 */
.assistant-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: #fff;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  pointer-events: auto;
}
.assistant-root.open .assistant-drawer {
  transform: translateX(0);
}

.ad-head {
  padding: 16px 18px;
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.ad-title { font-size: 17px; font-weight: 800; }
.ad-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.ad-close {
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border: none; color: #fff;
  border-radius: 8px; cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}
.ad-close:hover { background: rgba(255, 255, 255, 0.28); }

/* 快捷问题 */
.ad-quicks {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none;
  background: #f8fafc;
}
.ad-quicks::-webkit-scrollbar { display: none; }
.ad-quick {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px; font-weight: 600;
  color: #0f766e; background: #fff;
  border: 1.5px solid #ccfbf1;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ad-quick:hover {
  background: #f0fdfa;
  border-color: #0f766e;
  transform: translateY(-1px);
}

/* 消息列表 */
.ad-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 4px;
  background: #fafbfc;
}
.ad-msg {
  display: flex;
  margin-bottom: 10px;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ad-msg-user { justify-content: flex-end; }
.ad-msg-assistant { justify-content: flex-start; }

.ad-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.6;
  color: #1e293b;
  word-wrap: break-word;
}
.ad-msg-user .ad-bubble {
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ad-msg-assistant .ad-bubble {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.ad-bubble b { font-weight: 800; }
.ad-bubble code {
  padding: 1px 6px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.ad-msg-user .ad-bubble code {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* thinking dots */
.ad-dots { display: inline-flex; gap: 3px; }
.ad-dots span {
  width: 6px; height: 6px;
  background: #64748b; border-radius: 50%;
  animation: adDot 1.2s infinite;
}
.ad-dots span:nth-child(2) { animation-delay: 0.2s; }
.ad-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes adDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 输入区 */
.ad-foot {
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.ad-foot textarea {
  width: 100%;
  min-height: 50px; max-height: 120px;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px; font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.ad-foot textarea:focus {
  border-color: #0f766e;
}
.ad-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px;
}
.ad-clear, .ad-send {
  padding: 7px 16px;
  font-size: 13px; font-weight: 700;
  border-radius: 8px;
  border: none; cursor: pointer;
  transition: all 0.15s;
}
.ad-clear {
  background: #f1f5f9; color: #64748b;
}
.ad-clear:hover { background: #e2e8f0; color: #1e293b; }
.ad-send {
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #fff;
}
.ad-send:hover {
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35);
  transform: translateY(-1px);
}

/* 响应式：小屏抽屉全覆盖，不挤压主内容（否则挤没了） */
@media (max-width: 900px) {
  body.assistant-open { padding-right: 0; }
}
@media (max-width: 640px) {
  .assistant-drawer { width: 100vw; }
  .assistant-toggle { right: 14px; bottom: 20px; padding: 10px 16px 10px 12px; }
  .at-text { display: none; }
}
