/* ===== 电小团对话宠物样式 ===== */
/* 适配双主题：深色科技风（#000） + 浅色小清新（#F8F9FC） */
/* ================================= */

/* --- 右下角触发按钮 --- */
#dxt-pet-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  cursor: pointer;
  transition: transform 0.2s;
}
#dxt-pet-btn:hover {
  transform: scale(1.08);
}
.dxt-pet-body {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 0 0 2px var(--accent, #5E8B7E);
  transition: box-shadow 0.3s;
}
.dxt-pet-body:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,0.2), 0 0 0 2px var(--accent, #5E8B7E);
}
.dxt-pet-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: var(--accent, #5E8B7E);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  box-shadow: 0 0 0 2px var(--bg-body, #FFFFFF);
  animation: dxt-pulse 2s infinite;
}
@keyframes dxt-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* --- 对话浮层 --- */
#dxt-pet-overlay {
  position: fixed;
  bottom: 106px;
  right: 24px;
  z-index: 9998;
  width: 360px;
  max-height: 520px;
  background: var(--bg-card, #FFFFFF);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px var(--border-card, rgba(0,0,0,0.04));
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dxt-overlay-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.theme-dark #dxt-pet-overlay {
  background: #1A1B1E;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
}

#dxt-pet-overlay.open {
  display: flex;
}

@keyframes dxt-overlay-in {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- 对话浮层头部 --- */
.dxt-overlay-head {
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, var(--accent, #5E8B7E) 0%, #4A7A6E 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dxt-overlay-head .pet-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.dxt-overlay-head .head-text {
  flex: 1;
}

.dxt-overlay-head .head-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.dxt-overlay-head .head-text p {
  font-size: 12px;
  opacity: 0.8;
  margin: 2px 0 0;
  line-height: 1.4;
}

.dxt-overlay-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition, 0.3s);
  flex-shrink: 0;
}

.dxt-overlay-close:hover {
  background: rgba(255,255,255,0.25);
}

/* --- 对话消息区 --- */
.dxt-msg-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 340px;
  scroll-behavior: smooth;
  background: var(--bg-body, #F8F9FC);
}

.theme-dark .dxt-msg-area {
  background: #1A1B1E;
}

.dxt-msg-area::-webkit-scrollbar {
  width: 4px;
}

.dxt-msg-area::-webkit-scrollbar-thumb {
  background: var(--text-muted, #9CA3AF);
  border-radius: 4px;
}

.dxt-msg-area::-webkit-scrollbar-track {
  background: transparent;
}

/* 消息气泡 */
.dxt-msg {
  max-width: 85%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 16px;
  animation: dxt-msg-in 0.25s ease;
}

@keyframes dxt-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* bot 消息气泡 - 浅色主题 */
.theme-light .dxt-msg.bot {
  align-self: flex-start;
  background: #F0EDE8;
  color: #1F2937;
  border-bottom-left-radius: 4px;
}

/* bot 消息气泡 - 深色主题 */
.theme-dark .dxt-msg.bot {
  align-self: flex-start;
  background: #2A2D35;
  color: #E5E7EB;
  border-bottom-left-radius: 4px;
}

/* user 消息气泡 - 浅色主题 */
.theme-light .dxt-msg.user {
  align-self: flex-end;
  background: var(--accent, #5E8B7E);
  color: white;
  border-bottom-right-radius: 4px;
}

/* user 消息气泡 - 深色主题 */
.theme-dark .dxt-msg.user {
  align-self: flex-end;
  background: #4A7A6E;
  color: white;
  border-bottom-right-radius: 4px;
}

/* 发送时间戳 */
.dxt-msg-time {
  font-size: 10px;
  color: var(--text-muted, #9CA3AF);
  align-self: flex-start;
  padding: 0 4px;
  margin-top: -4px;
}

.dxt-msg.user + .dxt-msg-time {
  align-self: flex-end;
}

/* 快速回复按钮区域 */
.dxt-quick-replies {
  padding: 4px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-body, #F8F9FC);
}

.theme-dark .dxt-quick-replies {
  background: #1A1B1E;
}

.dxt-quick-btn {
  background: #F5F3EF;
  border: 1px solid #E8E0D6;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12px;
  color: #6B7280;
  cursor: pointer;
  transition: all var(--transition, 0.3s);
  font-family: inherit;
  white-space: nowrap;
}

.theme-dark .dxt-quick-btn {
  background: #2A2D35;
  border-color: #3A3D45;
  color: #9CA3AF;
}

.dxt-quick-btn:hover {
  background: var(--accent, #5E8B7E);
  color: white;
  border-color: var(--accent, #5E8B7E);
}

/* --- 输入框 --- */
.dxt-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-card, rgba(0,0,0,0.05));
  background: var(--bg-card, #FFFFFF);
}

.theme-dark .dxt-input-area {
  background: #1A1B1E;
  border-top-color: rgba(255,255,255,0.06);
}

.dxt-input-area input {
  flex: 1;
  border: 1px solid var(--border-card, #E8E0D6);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition, 0.3s);
  color: var(--text, #1F2937);
  background: var(--bg-body, #F8F7F4);
}

.theme-dark .dxt-input-area input {
  background: #2A2D35;
  border-color: #3A3D45;
  color: #E5E7EB;
}

.dxt-input-area input:focus {
  border-color: var(--accent, #5E8B7E);
  background: var(--bg-card, #FFFFFF);
}

.theme-dark .dxt-input-area input:focus {
  background: #2A2D35;
  border-color: #6BB5A6;
}

.dxt-input-area input::placeholder {
  color: var(--text-muted, #B0AFA8);
}

.theme-dark .dxt-input-area input::placeholder {
  color: #6B7280;
}

.dxt-send-btn {
  background: var(--accent, #5E8B7E);
  color: white;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition, 0.3s);
  flex-shrink: 0;
}

.dxt-send-btn:hover {
  background: #4A7A6E;
}

.dxt-send-btn:disabled {
  background: #CFCBC4;
  cursor: not-allowed;
}

/* 正在输入指示器 */
.dxt-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 18px;
  background: #F0EDE8;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.theme-dark .dxt-typing {
  background: #2A2D35;
}

.dxt-typing span {
  width: 7px;
  height: 7px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: dxt-bounce 1.2s infinite;
}

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

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

.dxt-typing-text {
  font-size: 12px;
  color: #6B7280;
  margin-left: 6px;
  align-self: center;
  white-space: nowrap;
  transition: opacity 0.4s;
}

.theme-dark .dxt-typing-text {
  color: #9CA3AF;
}

@keyframes dxt-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* --- 响应式 --- */
@media (max-width: 480px) {
  #dxt-pet-overlay {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 100px;
    max-height: 60vh;
  }

  #dxt-pet-btn {
    bottom: 16px;
    right: 16px;
  }

  .dxt-pet-body {
    width: 58px;
    height: 58px;
  }
}
