/* ============================================================================
   gtf-chatbar.css — 艺学堂教研 · GTF 统一对话条样式（小批8）
   悬浮toggle + 面板，仿 ai-page-assistant 风格，走 /api/template/:scope/*
   ============================================================================ */

.gtf-chatbar-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #5a8bff);
  box-shadow: 0 6px 18px rgba(92, 120, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gtf-chatbar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(92, 120, 255, 0.55);
}
.gtf-chatbar-toggle.gtf-open {
  transform: rotate(90deg);
}

.gtf-chatbar-panel {
  position: fixed;
  right: 90px;
  bottom: 24px;
  z-index: 99998;
  width: 380px;
  max-width: calc(100vw - 120px);
  height: 520px;
  max-height: calc(100vh - 90px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  font-size: 13px;
  color: #333;
  border: 1px solid #eceef5;
}
.gtf-chatbar-panel.gtf-visible {
  display: flex;
}

.gtf-chatbar-head {
  padding: 12px 14px;
  background: linear-gradient(135deg, #7c5cff, #5a8bff);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gtf-chatbar-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.gtf-chatbar-title small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.85;
}
.gtf-chatbar-head-actions {
  display: flex;
  gap: 6px;
}
.gtf-chatbar-icon-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gtf-chatbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.gtf-chatbar-actions {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f1f5;
  max-height: 110px;
  overflow-y: auto;
}
.gtf-chatbar-actions-label {
  font-size: 11px;
  color: #999;
  margin-bottom: 6px;
}
.gtf-chatbar-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gtf-chatbar-action-btn {
  border: 1px solid #e2e5ef;
  background: #f7f8fc;
  color: #5a5f7a;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gtf-chatbar-action-btn:hover {
  border-color: #7c5cff;
  color: #7c5cff;
  background: #f3f0ff;
}

.gtf-chatbar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fafbff;
}
.gtf-chatbar-msg {
  display: flex;
  max-width: 88%;
}
.gtf-chatbar-msg.user {
  align-self: flex-end;
  justify-content: flex-end;
}
.gtf-chatbar-msg.assistant {
  align-self: flex-start;
}
.gtf-chatbar-msg.system {
  align-self: center;
  max-width: 100%;
}
.gtf-chatbar-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.gtf-chatbar-msg.user .gtf-chatbar-bubble {
  background: linear-gradient(135deg, #7c5cff, #5a8bff);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.gtf-chatbar-msg.assistant .gtf-chatbar-bubble {
  background: #fff;
  border: 1px solid #eceef5;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.gtf-chatbar-msg.system .gtf-chatbar-bubble {
  background: #f0efff;
  color: #6a5acd;
  font-size: 12px;
  border-radius: 16px;
}
.gtf-chatbar-bubble pre {
  background: #f4f6fb;
  border-radius: 8px;
  padding: 8px;
  margin: 6px 0;
  overflow-x: auto;
  font-size: 12px;
}
.gtf-chatbar-bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}
.gtf-chatbar-bubble a { color: #5a8bff; }
.gtf-chatbar-bubble p { margin: 4px 0; }
.gtf-chatbar-loading span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: #7c5cff;
  animation: gtf-bounce 1.2s infinite ease-in-out;
}
.gtf-chatbar-loading span:nth-child(2) { animation-delay: 0.15s; }
.gtf-chatbar-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gtf-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.gtf-chatbar-foot {
  padding: 10px 12px;
  border-top: 1px solid #f0f1f5;
  background: #fff;
}
.gtf-chatbar-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.gtf-chatbar-input {
  flex: 1;
  border: 1px solid #e2e5ef;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 96px;
  line-height: 1.5;
  background: #fafbff;
}
.gtf-chatbar-input:focus {
  border-color: #7c5cff;
  background: #fff;
}
.gtf-chatbar-send {
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c5cff, #5a8bff);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.gtf-chatbar-send:hover { opacity: 0.9; }
.gtf-chatbar-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.gtf-chatbar-status {
  margin-top: 6px;
  font-size: 11px;
  color: #a0a5b5;
  min-height: 14px;
}
