/* ============================================================
   囍事台 · AI 杜肖肖样式
   与主应用一致：深酒红 / 金 / 奶油 / 墨
   ============================================================ */

.wa-root {
  --wa-wine: #8B2635;
  --wa-wine-deep: #5C1622;
  --wa-gold: #C49A5B;
  --wa-gold-light: #E8D5A8;
  --wa-gold-deep: #9A7539;
  --wa-cream: #FBF5EF;
  --wa-cream-card: #FFFDF8;
  --wa-ink: #2E1A20;
  --wa-ink-soft: #7A5560;
  --wa-line: rgba(139, 38, 53, 0.14);
  --wa-radius: 20px;
  --wa-radius-sm: 12px;
  --wa-shadow: 0 18px 50px rgba(46, 26, 32, 0.22);
  --wa-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --wa-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;

  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 9990;
  font-family: var(--wa-font);
  font-size: 14px;
  line-height: 1.65;
  color: var(--wa-ink);
  -webkit-font-smoothing: antialiased;
}

.wa-root *,
.wa-root *::before,
.wa-root *::after {
  box-sizing: border-box;
}

/* ---------- 浮动按钮 ---------- */
.wa-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--wa-wine) 0%, var(--wa-wine-deep) 100%);
  box-shadow:
    0 10px 28px rgba(139, 38, 53, 0.38),
    0 0 0 2px rgba(196, 154, 91, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s var(--wa-ease), box-shadow 0.35s var(--wa-ease);
  outline: none;
}

.wa-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 14px 34px rgba(139, 38, 53, 0.45),
    0 0 0 3px rgba(196, 154, 91, 0.55);
}

.wa-fab:active {
  transform: scale(0.97);
}

.wa-fab.is-open {
  background: linear-gradient(145deg, var(--wa-gold) 0%, var(--wa-gold-deep, #9A7539) 100%);
  box-shadow:
    0 8px 24px rgba(196, 154, 91, 0.4),
    0 0 0 2px rgba(255, 253, 248, 0.35);
}

.wa-fab-icon {
  width: 28px;
  height: 28px;
  fill: var(--wa-cream);
  position: relative;
  z-index: 1;
}

.wa-fab.is-open .wa-fab-icon {
  fill: var(--wa-wine-deep);
}

.wa-fab.is-open .wa-fab-icon circle {
  fill: var(--wa-wine-deep);
}

/* 轻微脉冲环 */
.wa-fab-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(196, 154, 91, 0.55);
  animation: wa-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

.wa-fab.is-open .wa-fab-ring {
  animation: none;
  opacity: 0;
}

@keyframes wa-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.28);
    opacity: 0;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

/* ---------- 对话面板 ---------- */
.wa-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--wa-cream);
  border-radius: var(--wa-radius);
  box-shadow: var(--wa-shadow);
  border: 1px solid rgba(196, 154, 91, 0.35);
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.88) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s var(--wa-ease),
    opacity 0.28s var(--wa-ease);
}

.wa-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- 标题栏 ---------- */
.wa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--wa-wine) 0%, var(--wa-wine-deep) 100%);
  color: var(--wa-cream);
  flex-shrink: 0;
}

.wa-header-text {
  min-width: 0;
}

.wa-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.wa-sub {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

.wa-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.wa-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 253, 248, 0.1);
  color: var(--wa-cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.wa-icon-btn:hover {
  background: rgba(255, 253, 248, 0.22);
}

.wa-icon-btn:active {
  transform: scale(0.94);
}

.wa-icon-btn svg {
  width: 18px;
  height: 18px;
}

.wa-icon-btn svg path {
  fill: currentColor;
}

.wa-icon-btn svg path[fill="none"] {
  fill: none;
  stroke: currentColor;
}

/* ---------- 快捷问题 ---------- */
.wa-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 4px;
  flex-shrink: 0;
  max-height: 110px;
  overflow-y: auto;
}

.wa-quick[hidden] {
  display: none !important;
}

.wa-chip {
  border: 1px solid rgba(196, 154, 91, 0.55);
  background: var(--wa-cream-card);
  color: var(--wa-wine);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.wa-chip:hover {
  background: var(--wa-wine);
  color: var(--wa-cream);
  border-color: var(--wa-wine);
}

.wa-chip:active {
  transform: scale(0.96);
}

/* ---------- 消息列表 ---------- */
.wa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.wa-messages::-webkit-scrollbar {
  width: 5px;
}

.wa-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 38, 53, 0.18);
  border-radius: 4px;
}

.wa-row {
  display: flex;
  width: 100%;
}

.wa-row-user {
  justify-content: flex-end;
}

.wa-row-ai {
  justify-content: flex-start;
}

.wa-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: var(--wa-radius);
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.7;
  box-shadow: 0 2px 10px rgba(46, 26, 32, 0.06);
}

.wa-bubble-user {
  background: var(--wa-wine);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.wa-bubble-ai {
  background: var(--wa-cream-card);
  color: var(--wa-ink);
  border: 1px solid rgba(196, 154, 91, 0.28);
  border-bottom-left-radius: 6px;
}

.wa-bubble p {
  margin: 0 0 0.5em;
}

.wa-bubble p:last-child {
  margin-bottom: 0;
}

.wa-bubble ul,
.wa-bubble ol {
  margin: 0.3em 0 0.5em;
  padding-left: 1.25em;
}

.wa-bubble ul {
  list-style: disc;
}

.wa-bubble ol {
  list-style: decimal;
}

.wa-bubble li {
  margin: 0.15em 0;
}

.wa-bubble strong {
  font-weight: 700;
  color: inherit;
}

.wa-bubble-user strong {
  color: var(--wa-gold-light);
}

/* ---------- 空状态 ---------- */
.wa-empty {
  text-align: center;
  padding: 28px 16px 16px;
  color: var(--wa-ink-soft);
  font-size: 13px;
}

.wa-empty-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--wa-wine), var(--wa-wine-deep));
  color: var(--wa-gold-light);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  box-shadow: 0 6px 18px rgba(139, 38, 53, 0.25);
}

/* ---------- 打字中 ---------- */
.wa-loading {
  padding: 0 14px 8px;
  flex-shrink: 0;
}

.wa-loading[hidden] {
  display: none !important;
}

.wa-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 86%;
}

.wa-thinking-label {
  font-size: 12px;
  color: var(--wa-ink-soft);
}

.wa-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.wa-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wa-gold);
  display: block;
  animation: wa-bounce 1.1s ease-in-out infinite;
}

.wa-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.wa-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes wa-bounce {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  35% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---------- 引导卡片 ---------- */
.wa-guide {
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.wa-guide[hidden] {
  display: none !important;
}

.wa-guide-card {
  background: linear-gradient(145deg, rgba(196, 154, 91, 0.14), rgba(139, 38, 53, 0.06));
  border: 1px dashed rgba(196, 154, 91, 0.65);
  border-radius: var(--wa-radius-sm);
  padding: 12px 14px;
}

.wa-guide-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--wa-wine);
  margin-bottom: 4px;
}

.wa-guide-text {
  font-size: 12px;
  color: var(--wa-ink-soft);
  margin: 0 0 10px;
  line-height: 1.6;
}

/* ---------- 输入区 ---------- */
.wa-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--wa-line);
  background: var(--wa-cream-card);
  flex-shrink: 0;
}

.wa-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(139, 38, 53, 0.16);
  border-radius: 14px;
  background: var(--wa-cream);
  color: var(--wa-ink);
  padding: 10px 12px;
  font-family: var(--wa-font);
  font-size: 13.5px;
  line-height: 1.55;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-input:focus {
  border-color: var(--wa-gold);
  box-shadow: 0 0 0 3px rgba(196, 154, 91, 0.22);
}

.wa-input::placeholder {
  color: rgba(122, 85, 96, 0.55);
}

.wa-input:disabled {
  opacity: 0.65;
}

.wa-send {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(145deg, var(--wa-wine), var(--wa-wine-deep));
  color: var(--wa-cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 16px rgba(139, 38, 53, 0.28);
}

.wa-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.wa-send:hover {
  transform: translateY(-1px);
}

.wa-send:active {
  transform: scale(0.95);
}

.wa-send:disabled,
.wa-send.is-busy {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 按钮 ---------- */
.wa-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-family: var(--wa-font);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  line-height: 1.4;
}

.wa-btn:active {
  transform: scale(0.97);
}

.wa-btn-primary {
  background: linear-gradient(145deg, var(--wa-wine), var(--wa-wine-deep));
  color: var(--wa-cream);
  box-shadow: 0 6px 16px rgba(139, 38, 53, 0.25);
}

.wa-btn-primary:hover {
  filter: brightness(1.06);
}

.wa-btn-ghost {
  background: transparent;
  color: var(--wa-ink-soft);
  border: 1px solid var(--wa-line);
}

.wa-btn-ghost:hover {
  background: rgba(139, 38, 53, 0.06);
  color: var(--wa-ink);
}

/* ---------- 设置弹层 ---------- */
.wa-settings-mask {
  position: fixed;
  inset: 0;
  background: rgba(46, 26, 32, 0.42);
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wa-settings-mask[hidden] {
  display: none !important;
}

.wa-settings-mask.is-open {
  opacity: 1;
}

.wa-settings {
  width: min(360px, 100%);
  background: var(--wa-cream);
  border-radius: var(--wa-radius);
  padding: 18px 18px 16px;
  box-shadow: var(--wa-shadow);
  border: 1px solid rgba(196, 154, 91, 0.4);
  transform: translateY(10px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s var(--wa-ease), opacity 0.24s ease;
}

.wa-settings-mask.is-open .wa-settings {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.wa-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.wa-settings-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--wa-wine);
  letter-spacing: 0.04em;
}

.wa-settings-head .wa-icon-btn {
  background: rgba(139, 38, 53, 0.08);
  color: var(--wa-ink-soft);
}

.wa-settings-head .wa-icon-btn:hover {
  background: rgba(139, 38, 53, 0.14);
  color: var(--wa-ink);
}

.wa-field {
  display: block;
  margin-bottom: 12px;
}

.wa-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--wa-ink);
  margin-bottom: 5px;
}

.wa-text {
  width: 100%;
  border: 1px solid rgba(139, 38, 53, 0.18);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--wa-font);
  background: var(--wa-cream-card);
  color: var(--wa-ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-text:focus {
  border-color: var(--wa-gold);
  box-shadow: 0 0 0 3px rgba(196, 154, 91, 0.2);
}

.wa-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--wa-ink-soft);
  line-height: 1.5;
}

.wa-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- 移动端全屏 ---------- */
@media (max-width: 520px) {
  .wa-root {
    right: 14px;
    bottom: 88px;
  }

  .wa-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    bottom: 0;
    right: 0;
    transform: translateY(16px) scale(1);
  }

  .wa-panel.is-open {
    transform: translateY(0) scale(1);
  }

  .wa-fab {
    width: 54px;
    height: 54px;
  }

  .wa-fab-icon {
    width: 24px;
    height: 24px;
  }

  .wa-bubble {
    max-width: 90%;
  }
}

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .wa-fab-ring,
  .wa-dots i {
    animation: none;
  }

  .wa-panel,
  .wa-fab,
  .wa-settings,
  .wa-settings-mask {
    transition: none;
  }
}

/* ==== 样式修复：快问按钮与消息区分离 ==== */
.wa-quick-questions,
[class*="quick"],
[class*="Quick"] {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  margin: 0 0 12px 0 !important;
  overflow: visible !important;
  flex-shrink: 0 !important;
  max-height: none !important;
}

.wa-messages,
[class*="messages"],
[class*="msg-list"] {
  flex: 1 !important;
  overflow-y: auto !important;
  min-height: 0 !important;
  scrollbar-width: none !important;
}
.wa-messages::-webkit-scrollbar,
[class*="messages"]::-webkit-scrollbar { display: none !important; }

.wa-msg,
[class*="msg-row"],
[class*="message-item"] {
  margin-bottom: 12px !important;
  flex-shrink: 0 !important;
}

.wa-msg-content,
[class*="msg-content"] {
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
}

/* 确保按钮和内容不重叠 */
.wa-quick-btn,
[class*="quick-btn"],
[class*="QuickBtn"] {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  z-index: 1 !important;
  position: relative !important;
}





/* ==== 快问：输入框上方，横向滚动 ==== */
.wa-quick {
  display: block !important;
  padding: 8px 12px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  border-bottom: 1px solid rgba(196,154,91,0.12) !important;
  max-height: 48px !important;
  -webkit-overflow-scrolling: touch !important;
}
.wa-quick::-webkit-scrollbar { display: none !important; height: 0 !important; }




.wa-icon-btn {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(232,213,168,0.15) !important;
  border: 1px solid rgba(232,213,168,0.25) !important;
  color: #E8D5A8 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
}
.wa-icon-btn:hover {
  background: rgba(232,213,168,0.3) !important;
}
.wa-icon-btn svg {
  width: 16px !important;
  height: 16px !important;
}

.wa-quick .wa-chip {
  display: inline-block !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  margin-right: 8px !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(139,38,53,0.18) !important;
  background: rgba(139,38,53,0.05) !important;
  color: #8B2635 !important;
  font-size: 12px !important;
  cursor: pointer !important;
}
.wa-quick .wa-chip:hover {
  background: #8B2635 !important;
  color: #FFFDF8 !important;
}

/* 防止滚轮穿透到主页面 */
.wa-panel, .wa-messages, .wa-quick {
  overscroll-behavior: contain !important;
}
.wa-messages {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* ============================================================
   杜肖肖面板：滚轮在面板内到底后不再带动背景页面
   ============================================================ */
.wa-panel,
.wa-messages,
.wa-settings,
.wa-quick,
.wa-history {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.wa-messages {
  overscroll-behavior-y: contain;
}

/* 杜肖肖推荐的照片卡片 */
.wa-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 10px;
}
.wa-photo {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(196, 154, 91, 0.35);
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.wa-photo:hover {
  transform: translateY(-2px);
}
.wa-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.wa-photo figcaption {
  padding: 6px 8px;
  font-size: 10.5px;
  color: var(--ink-mute, #A88A92);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-goto-gallery {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(196, 154, 91, 0.5);
  background: rgba(139, 38, 53, 0.06);
  color: var(--wine, #8B2635);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s ease;
}
.wa-goto-gallery:hover {
  background: rgba(139, 38, 53, 0.12);
}
