/* ═══════════════════════════════════════════
   AI 页面悬浮助手 — 样式
   通用组件，所有教研页面共用
   ═══════════════════════════════════════════ */

.ai-assistant-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #F18D24;
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(241, 141, 36, 0.35);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all 0.25s ease;
}
.ai-assistant-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(241, 141, 36, 0.5);
}
.ai-assistant-toggle:active {
  transform: scale(0.95);
}
.ai-assistant-toggle.ai-open {
  background: #666;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ── 面板 ── */
.ai-assistant-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
}
.ai-assistant-panel.ai-visible {
  display: flex;
}

/* ── 头部 ── */
.ai-panel-header {
  background: linear-gradient(135deg, #F18D24, #e07d16);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ai-panel-header .ai-title {
  font-weight: 600;
  font-size: 14px;
}
.ai-panel-header .ai-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-panel-header .ai-close:hover {
  background: rgba(255,255,255,0.35);
}

/* ── 操作列表 ── */
.ai-actions {
  padding: 12px 16px;
  flex-shrink: 0;
}
.ai-actions-label {
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ai-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-action-btn {
  background: #f5f5f5;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-action-btn:hover {
  background: #fff2e0;
  border-color: #F18D24;
  color: #F18D24;
}
.ai-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 对话区 ── */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 12px;
  min-height: 120px;
  max-height: 260px;
}
.ai-message {
  margin-bottom: 10px;
  display: flex;
}
.ai-message.user {
  justify-content: flex-end;
}
.ai-message .bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}
.ai-message.assistant .bubble {
  background: #f0f4ff;
  color: #333;
  border-bottom-left-radius: 4px;
}
.ai-message.user .bubble {
  background: #F18D24;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-message .bubble pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 12px;
}

/* ── 底部操作栏 ── */
.ai-panel-footer {
  border-top: 1px solid #eee;
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ai-panel-footer .ai-fill-btn {
  background: #F18D24;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
}
.ai-panel-footer .ai-fill-btn:hover {
  background: #d4791a;
}
.ai-panel-footer .ai-retry-btn {
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
}
.ai-panel-footer .ai-retry-btn:hover {
  background: #e5e5e5;
}
.ai-panel-footer .ai-status {
  font-size: 11px;
  color: #aaa;
  align-self: center;
  flex: 1;
  text-align: right;
}

/* ── 加载动画 ── */
.ai-loading {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.ai-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  animation: ai-bounce 1.2s infinite;
}
.ai-loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}
