/* ============================================================
   Pengzu Academy AI Customer Service — ai-support.css v1.0
   国风配色（米金/深棕/朱砂红），与全站视觉统一
   全端自适应：PC / 手机 / 平板；日文长文本自动换行防溢出
   ============================================================ */

/* ---------- 悬浮图标 ---------- */
.pz-ai-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B2500 0%, #B5441E 100%);
  color: #FFF8EE;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(139, 37, 0, 0.38);
  z-index: 9998;
  border: none;
  outline: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pz-ai-fab:hover { transform: scale(1.07); box-shadow: 0 8px 26px rgba(139, 37, 0, 0.48); }
.pz-ai-fab:active { transform: scale(0.96); }
.pz-ai-fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2E8B57;
  border: 2px solid #FFF8EE;
  animation: pz-ai-pulse 2s infinite;
}
@keyframes pz-ai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(46, 139, 87, 0); }
}

/* ---------- 轻弹窗 ---------- */
.pz-ai-pop {
  position: fixed;
  right: 86px;
  bottom: 20px;
  width: 300px;
  max-width: calc(100vw - 120px);
  background: #FFFDF7;
  border: 1px solid #E3D2B0;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(44, 36, 22, 0.18);
  z-index: 9997;
  overflow: hidden;
  animation: pz-ai-pop-in 0.35s ease;
}
@keyframes pz-ai-pop-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.pz-ai-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #8B2500, #B5441E);
  color: #FFF8EE;
  font-size: 14px;
  font-weight: 600;
}
.pz-ai-pop-close {
  background: transparent;
  border: none;
  color: #FFF8EE;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.pz-ai-pop-body {
  padding: 12px 14px;
  font-size: 13.5px;
  color: #2C2416;
  line-height: 1.7;
}
.pz-ai-pop-btn {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  padding: 9px 0;
  background: linear-gradient(135deg, #8B2500, #B5441E);
  color: #FFF8EE;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.pz-ai-pop-btn:hover { opacity: 0.9; }

.pz-ai-window[hidden] { display: none !important; }

/* ---------- 聊天主窗口 ---------- */
.pz-ai-window {
  position: fixed;
  right: 16px;
  bottom: 86px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #FFFDF7;
  border: 1px solid #E3D2B0;
  border-radius: 16px;
  box-shadow: 0 16px 56px rgba(44, 36, 22, 0.28);
  z-index: 9996;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pz-ai-window-in 0.32s ease;
}
@keyframes pz-ai-window-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.pz-ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #8B2500 0%, #A03A14 60%, #C9A96E 160%);
  color: #FFF8EE;
  flex-shrink: 0;
}
.pz-ai-head-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFF8EE;
  color: #8B2500;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 248, 238, 0.55);
}
.pz-ai-head-info { flex: 1; min-width: 0; }
.pz-ai-head-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pz-ai-head-sub {
  font-size: 12px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 5px;
}
.pz-ai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ED9A7;
  display: inline-block;
}
.pz-ai-head-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFF8EE;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.pz-ai-head-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.28); }
.pz-ai-head-close:active { opacity: 1; background: rgba(255, 255, 255, 0.35); }

/* ---------- 消息区 ---------- */
.pz-ai-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #FBF6EA;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.pz-ai-msg { display: flex; }
.pz-ai-msg-user { justify-content: flex-end; }
.pz-ai-msg-bot { justify-content: flex-start; }
.pz-ai-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.75;
  /* 日文长文本防溢出 */
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.pz-ai-msg-user .pz-ai-bubble {
  background: linear-gradient(135deg, #8B2500, #A03A14);
  color: #FFF8EE;
  border-bottom-right-radius: 4px;
}
.pz-ai-msg-bot .pz-ai-bubble {
  background: #FFFFFF;
  color: #2C2416;
  border: 1px solid #EADFC4;
  border-bottom-left-radius: 4px;
}

/* 打字指示 */
.pz-ai-typing { display: inline-flex; gap: 5px; padding: 13px 16px; }
.pz-ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C9A96E;
  animation: pz-ai-blink 1.2s infinite;
}
.pz-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.pz-ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pz-ai-blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* 快捷提问 */
.pz-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px;
}
.pz-ai-quick-btn {
  background: #FFFDF7;
  border: 1px solid #C9A96E;
  color: #8B2500;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.pz-ai-quick-btn:hover { background: #8B2500; color: #FFF8EE; }

/* ---------- 输入区 ---------- */
.pz-ai-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #FFFDF7;
  border-top: 1px solid #EADFC4;
  flex-shrink: 0;
}
.pz-ai-input {
  flex: 1;
  border: 1px solid #D9CBA6;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #2C2416;
  background: #FFFFFF;
  resize: none;
  max-height: 96px;
  min-height: 38px;
  outline: none;
  transition: border-color 0.2s;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pz-ai-input:focus { border-color: #8B2500; }
.pz-ai-input-err { border-color: #D32F2F !important; animation: pz-ai-shake 0.4s; }
@keyframes pz-ai-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.pz-ai-send {
  background: linear-gradient(135deg, #8B2500, #B5441E);
  color: #FFF8EE;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.pz-ai-send:hover { opacity: 0.9; }
/* 建站规范（永久）：发送按钮永远保持激活视觉，不设 disabled 视觉灰色——访客输入文字即可点击发送，零拦截 */
.pz-ai-legal {
  padding: 6px 12px 8px;
  font-size: 10.5px;
  color: #9A8B6C;
  background: #FFFDF7;
  line-height: 1.6;
  flex-shrink: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ---------- 渠道卡片 / 留言表单 ---------- */
.pz-ai-channel-card {
  background: #FFFFFF;
  border: 1px solid #EADFC4;
  border-radius: 12px;
  padding: 12px;
  animation: pz-ai-pop-in 0.3s ease;
}
.pz-ai-channel-title {
  font-size: 13px;
  font-weight: 700;
  color: #2C2416;
  margin-bottom: 10px;
}
.pz-ai-channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FBF6EA;
  border: 1px solid #EADFC4;
  border-radius: 10px;
  padding: 10px;
}
.pz-ai-channel-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E8B57, #3DA56E);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}
.pz-ai-channel-info { flex: 1; min-width: 0; }
.pz-ai-channel-label { font-size: 12px; color: #8A7B5C; }
.pz-ai-channel-value {
  font-size: 15px;
  font-weight: 700;
  color: #2C2416;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.pz-ai-channel-btn {
  background: linear-gradient(135deg, #8B2500, #B5441E);
  color: #FFF8EE;
  border: none;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pz-ai-channel-hint { font-size: 11.5px; color: #9A8B6C; margin-top: 8px; }

.pz-ai-leave { margin-top: 12px; border-top: 1px dashed #EADFC4; padding-top: 12px; }
.pz-ai-leave-title { font-size: 13px; font-weight: 700; color: #2C2416; }
.pz-ai-leave-text { font-size: 12px; color: #8A7B5C; margin: 4px 0 8px; line-height: 1.6; }
.pz-ai-leave-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #D9CBA6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #2C2416;
  margin-bottom: 7px;
  outline: none;
  background: #FFFDF7;
}
.pz-ai-leave-input:focus { border-color: #8B2500; }
.pz-ai-leave-btn {
  width: 100%;
  background: #2C2416;
  color: #FFF8EE;
  border: none;
  border-radius: 8px;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pz-ai-leave-btn:disabled { opacity: 0.55; cursor: default; }
.pz-ai-leave-done { font-size: 12.5px; color: #2E8B57; margin-top: 6px; }
.pz-ai-leave-err .pz-ai-leave-input { border-color: #D32F2F; }

/* ---------- 咨询栏目内按钮 ---------- */
.pz-ai-inquiry-wrap { margin: 10px 0; }
.pz-ai-inquiry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #8B2500, #B5441E);
  color: #FFF8EE;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(139, 37, 0, 0.3);
  transition: transform 0.2s, opacity 0.2s;
}
.pz-ai-inquiry-btn:hover { transform: translateY(-2px); opacity: 0.94; }
.pz-ai-inquiry-ico { font-size: 17px; }

/* ---------- 顶部隐私合规横幅（独立直达日/英页） ---------- */
.pz-ai-privacy-banner{
  padding:10px 14px;
  background:#FBF6EA;
  border-bottom:1px solid #EADFC4;
  font-size:11.5px;
  color:#7A6B4C;
  line-height:1.65;
  word-break:break-word;
  overflow-wrap:anywhere;
  flex-shrink:0;
}
@media (max-width:600px){
  .pz-ai-privacy-banner{font-size:11px;padding:9px 12px;}
}

/* ---------- 滚动条美化 ---------- */
.pz-ai-body::-webkit-scrollbar { width: 5px; }
.pz-ai-body::-webkit-scrollbar-thumb { background: #D9CBA6; border-radius: 3px; }
.pz-ai-body::-webkit-scrollbar-track { background: transparent; }

/* ---------- 移动端适配 ----------
   核心原则：弹窗不全屏，给正文留出可见空间，禁止覆盖正文 */
@media (max-width: 600px) {
  .pz-ai-fab { right: 12px; bottom: 14px; width: 52px; height: 52px; z-index: 9998; }
  /* W-4: 轻弹窗底部锚定，限高可滚动，绝不覆盖首屏 hero 正文 */
  .pz-ai-pop { right: 12px; left: 12px; bottom: 14px; width: auto; max-width: none; max-height: 42vh; overflow-y: auto; z-index: 9997; }
  /* 弹窗自身捕获交互，但留出 hero 顶部空间，且不影响正文滚动阅读 */
  .pz-ai-window { pointer-events: auto; }
  .pz-ai-window {
    /* mobile 缩至底部，仅占据屏幕下半部，留足正文阅读空间 */
    right: 8px;
    left: 8px;
    bottom: 80px;
    top: auto;
    width: auto;
    max-width: none;
    height: 50vh;
    max-height: 380px;
    min-height: 280px;
    border-radius: 14px;
    border: 1px solid #E3D2B0;
    z-index: 9996;
  }
  .pz-ai-head { padding: 10px 12px; }
  .pz-ai-head-close { width: 36px; height: 36px; min-width: 36px; font-size: 24px; position: relative; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .pz-ai-bubble { max-width: 86%; }
  .pz-ai-inputbar { padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .pz-ai-window .pz-ai-head { padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 380px) {
  .pz-ai-pop { width: 230px; right: 68px; }
}
@media (max-width: 380px) {
  .pz-ai-window { right: 6px; left: 6px; bottom: 76px; top: auto; height: 48vh; max-height: 340px; min-height: 260px; }
}
