/**
 * 数字人 · 知识问答交互样式
 */

/* 问答页 · 主内容 + 右侧数字人 */
.qa-page-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
}

.qa-main {
  min-width: 0;
}

.qa-aside {
  position: sticky;
  top: 80px;
}

.dh-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 115, 92, 0.1);
  min-height: 520px;
  max-height: calc(100vh - 96px);
}

.dh-panel--sidebar {
  margin-bottom: 0;
}

.dh-visual {
  background: linear-gradient(180deg, var(--green-deep) 0%, #004d3d 100%);
  padding: 16px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-align: left;
  color: #fff;
  flex-shrink: 0;
}

.dh-avatar-wrap {
  position: relative;
  margin-bottom: 0;
  flex-shrink: 0;
}

.dh-avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(201, 169, 97, 0.5);
  animation: dh-pulse 2.5s ease-in-out infinite;
}

.dh-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.dh-avatar svg {
  width: 58px;
  height: 58px;
}

.dh-live-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: var(--green-deep);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dh-live-badge i {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: dh-blink 1.5s infinite;
}

.dh-info strong {
  display: block;
  font-size: 17px;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.dh-info span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 1px;
}

.dh-info p {
  margin-top: 6px;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
}

.dh-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #fafbfa;
}

.dh-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #eee;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.dh-clear-btn {
  border: none;
  background: none;
  color: #999;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.dh-clear-btn:hover {
  color: var(--green-deep);
  background: var(--green-soft);
}

.dh-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
}

.dh-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.dh-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.dh-msg.bot {
  align-self: flex-start;
}

.dh-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.dh-msg.user .dh-bubble {
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.dh-msg.bot .dh-bubble {
  background: #fff;
  color: #444;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dh-msg-link {
  font-size: 12px;
  color: var(--green-deep);
  margin-top: 6px;
  text-decoration: none;
}

.dh-msg-link:hover {
  text-decoration: underline;
}

.dh-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px !important;
}

.dh-typing span {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: dh-dot 1.2s infinite;
}

.dh-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.dh-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

.dh-quick {
  padding: 8px 20px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #eee;
  background: #fff;
}

.dh-quick-label {
  font-size: 12px;
  color: #999;
  margin-right: 4px;
}

.dh-quick-chip {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #555;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.dh-quick-chip:hover {
  border-color: var(--green);
  color: var(--green-deep);
  background: var(--green-soft);
}

.dh-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid #eee;
}

.dh-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.dh-input:focus {
  border-color: var(--green);
}

.dh-send-btn {
  flex-shrink: 0;
  border: none;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #fff;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.dh-send-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.dh-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 浮动入口（详情页） */
.dh-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 300;
}

.dh-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #fff;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(0, 115, 92, 0.4);
  transition: transform 0.2s;
}

.dh-fab-btn:hover {
  transform: scale(1.08);
}

.dh-fab-panel {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: min(420px, calc(100vw - 48px));
  z-index: 299;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.dh-fab-panel.open {
  display: block;
}

.dh-fab-panel .dh-panel {
  margin: 0;
  grid-template-columns: 1fr;
  min-height: 480px;
}

.dh-fab-panel .dh-visual {
  flex-direction: row;
  gap: 16px;
  padding: 16px 20px;
  text-align: left;
}

.dh-fab-panel .dh-avatar-wrap {
  margin-bottom: 0;
}

.dh-fab-panel .dh-avatar {
  width: 64px;
  height: 64px;
}

.dh-fab-panel .dh-avatar svg {
  width: 52px;
  height: 52px;
}

.dh-fab-panel .dh-info p {
  margin-top: 4px;
}

@keyframes dh-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes dh-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

@keyframes dh-dot {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .qa-page-layout {
    grid-template-columns: 1fr;
  }

  .qa-aside {
    position: static;
    max-height: none;
  }

  .dh-panel {
    max-height: 560px;
    min-height: 420px;
  }

  .dh-messages {
    max-height: 220px;
  }
}
