/*
 * 问小新聊天窗口样式 —— 采用「广慈新医知」主题的演示窗视觉风格。
 * 仅调整外观，所有 .gcxx-ai__* 类结构与交互逻辑保持不变。
 */
.gcxx-ai,
.gcxx-ai * {
  box-sizing: border-box;
}

.gcxx-ai {
  --gcxx-green-950: #053f29;
  --gcxx-green-800: #096641;
  --gcxx-green-700: #0a7b4b;
  --gcxx-green-600: #169458;
  --gcxx-soft: #f6f9f6;
  --gcxx-line: rgba(16, 72, 49, .13);
  --gcxx-ink: #16352a;
  --gcxx-muted: #66746d;
  color: var(--gcxx-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}

.gcxx-ai button,
.gcxx-ai input,
.gcxx-ai textarea {
  font: inherit;
}

/* 悬浮容器 */
.gcxx-ai--floating {
  bottom: 24px;
  position: fixed;
  right: 24px;
  z-index: 999999;
}

/* 浮标（白色胶囊 + 品牌图 + 在线绿点） */
.gcxx-ai__launcher {
  position: relative;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(16, 72, 49, .12);
  border-radius: 31px;
  box-shadow: 0 12px 40px rgba(8, 67, 43, .2);
  color: var(--gcxx-ink);
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-width: 150px;
  height: 58px;
  padding: 5px 16px 5px 7px;
  transition: transform .25s ease, box-shadow .25s ease;
}

.gcxx-ai__launcher:hover {
  transform: translateY(-3px);
}

.gcxx-ai__launcher[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(.8);
}

.gcxx-ai__launcher-avatar {
  align-items: center;
  background: transparent;
  border-radius: 12px;
  color: var(--gcxx-green-800);
  display: grid;
  flex: 0 0 44px;
  font-size: 16px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  place-items: center;
  position: relative;
  width: 44px;
}

.gcxx-ai__launcher-avatar img,
.gcxx-ai__avatar img {
  height: calc(100% - 6px);
  object-fit: contain;
  width: calc(100% - 6px);
}

.gcxx-ai__launcher-avatar::after {
  background: #35bc6c;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
  height: 8px;
  position: absolute;
  right: -2px;
  top: -2px;
  width: 8px;
}

.gcxx-ai__launcher-label {
  color: var(--gcxx-green-800);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.gcxx-ai__launcher-label::after {
  color: #86958d;
  content: "AI知识助手";
  display: block;
  font-size: 9px;
  font-weight: 400;
}

/* 面板（白卡） */
.gcxx-ai__panel {
  background: #fff;
  border: 1px solid var(--gcxx-line);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(4, 48, 32, .26);
  display: flex;
  flex-direction: column;
  height: min(650px, calc(100vh - 48px));
  max-height: 650px;
  overflow: hidden;
  position: relative;
  width: min(390px, calc(100vw - 32px));
}

.gcxx-ai__panel[hidden] {
  display: none;
}

.gcxx-ai--floating .gcxx-ai__panel {
  bottom: 76px;
  position: absolute;
  right: 0;
}

.gcxx-ai--inline {
  margin: 24px auto;
  max-width: 760px;
  position: static;
}

.gcxx-ai--inline .gcxx-ai__panel {
  height: min(720px, 80vh);
  max-height: none;
  position: static;
  width: 100%;
}

/* 顶栏（深绿） */
.gcxx-ai__header {
  align-items: center;
  background: var(--gcxx-green-950);
  color: #fff;
  display: flex;
  gap: 10px;
  min-height: 64px;
  padding: 10px 15px;
}

.gcxx-ai__avatar {
  align-items: center;
  background: transparent;
  border-radius: 12px;
  color: var(--gcxx-green-800);
  display: grid;
  flex: 0 0 44px;
  font-size: 15px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  place-items: center;
  width: 44px;
}

.gcxx-ai__header > div {
  flex: 1 1 auto;
}

.gcxx-ai__header strong,
.gcxx-ai__header span {
  display: block;
}

.gcxx-ai__header strong {
  color: #fff;
  font-size: 16px;
}

.gcxx-ai__header span {
  color: rgba(255, 255, 255, .6);
  font-size: 10px;
}

/* 顶栏上的「清空」按钮（深绿底上的浅色胶囊） */
.gcxx-ai__clear {
  background: rgba(255, 255, 255, .14);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  padding: 5px 11px;
  transition: background .2s ease;
}

.gcxx-ai__clear:hover {
  background: rgba(255, 255, 255, .26);
}

/* 顶栏关闭按钮（白 ×，位于深绿顶栏上） */
.gcxx-ai__close {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  margin-left: 8px;
  padding: 6px 8px;
}

/* 弹窗关闭按钮（位于白卡片上，改用深绿 + 圆形底色，避免白底白字看不见） */
.gcxx-ai__lead-close {
  background: var(--gcxx-soft);
  border: 0;
  border-radius: 50%;
  color: var(--gcxx-green-800);
  cursor: pointer;
  font-size: 22px;
  height: 32px;
  line-height: 1;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 32px;
  transition: background .2s ease;
}

.gcxx-ai__lead-close:hover {
  background: rgba(10, 123, 75, .14);
}

/* 状态条（浅色） */
.gcxx-ai__status {
  align-items: center;
  background: var(--gcxx-soft);
  border-bottom: 1px solid var(--gcxx-line);
  color: var(--gcxx-muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  padding: 7px 15px;
}

.gcxx-ai__status span {
  background: #35bc6c;
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

/* 消息区 */
.gcxx-ai__messages {
  background: var(--gcxx-soft);
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  padding: 15px;
  scroll-behavior: smooth;
}

/* 自定义滚动条（细圆角 + 主题绿色调） */
.gcxx-ai__messages::-webkit-scrollbar {
  width: 5px;
}

.gcxx-ai__messages::-webkit-scrollbar-track {
  background: transparent;
}

.gcxx-ai__messages::-webkit-scrollbar-thumb {
  background: rgba(10, 123, 75, .22);
  border-radius: 10px;
}

.gcxx-ai__messages::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 123, 75, .38);
}

.gcxx-ai__lead-card::-webkit-scrollbar {
  width: 5px;
}

.gcxx-ai__lead-card::-webkit-scrollbar-track {
  background: transparent;
}

.gcxx-ai__lead-card::-webkit-scrollbar-thumb {
  background: rgba(10, 123, 75, .22);
  border-radius: 10px;
}

/* Firefox 滚动条 */
.gcxx-ai__messages,
.gcxx-ai__lead-card {
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 123, 75, .22) transparent;
}

.gcxx-ai__message {
  display: flex;
  flex-direction: column;
  margin-bottom: 13px;
}

.gcxx-ai__message--user {
  align-items: flex-end;
}

.gcxx-ai__bubble {
  background: #fff;
  border-radius: 5px 15px 15px 15px;
  box-shadow: 0 3px 12px rgba(12, 70, 47, .05);
  color: #36473f;
  font-size: 13px;
  line-height: 1.65;
  max-width: 84%;
  padding: 11px 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.gcxx-ai__message--assistant .gcxx-ai__bubble {
  white-space: normal;
}

.gcxx-ai__message--assistant .gcxx-ai__bubble strong {
  color: var(--gcxx-green-800);
  font-weight: 700;
}

.gcxx-ai__message--assistant .gcxx-ai__bubble ul,
.gcxx-ai__message--assistant .gcxx-ai__bubble ol {
  margin: 6px 0;
  padding-left: 20px;
}

.gcxx-ai__message--assistant .gcxx-ai__bubble li {
  margin: 3px 0;
}

.gcxx-ai__message--assistant .gcxx-ai__bubble code {
  background: rgba(10, 123, 75, .1);
  border-radius: 4px;
  font-size: .92em;
  padding: 1px 5px;
}

.gcxx-ai__message--user .gcxx-ai__bubble {
  background: var(--gcxx-green-700);
  border-color: var(--gcxx-green-700);
  border-radius: 15px 5px 15px 15px;
  color: #fff;
}

.gcxx-ai__message--safety .gcxx-ai__bubble {
  background: #fff3f0;
  border: 1px solid rgba(204, 84, 65, .25);
}

/* 来源引用 */
.gcxx-ai__sources {
  border-top: 1px solid var(--gcxx-line);
  margin-top: 10px;
  padding-top: 9px;
  white-space: normal;
}

.gcxx-ai__sources > strong {
  color: var(--gcxx-muted);
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
}

.gcxx-ai__source {
  background: #f3f8f2;
  border: 1px solid var(--gcxx-line);
  border-radius: 9px;
  color: var(--gcxx-ink);
  display: block;
  margin-top: 6px;
  padding: 8px 9px;
  text-decoration: none !important;
  transition: border-color .2s ease, background .2s ease;
}

.gcxx-ai__source:hover {
  border-color: var(--gcxx-green-600);
  background: #eaf4ec;
}

.gcxx-ai__source span,
.gcxx-ai__source small {
  display: block;
}

.gcxx-ai__source span {
  font-size: 12px;
  font-weight: 650;
}

.gcxx-ai__source small {
  color: var(--gcxx-muted);
  font-size: 10px;
  margin-top: 2px;
}

/* 反馈 */
.gcxx-ai__feedback {
  align-items: center;
  color: var(--gcxx-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 10px;
  gap: 6px;
  margin: 5px 0 0 2px;
}

.gcxx-ai__feedback button {
  background: #fff;
  border: 1px solid var(--gcxx-line);
  border-radius: 99px;
  color: var(--gcxx-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 2px 7px;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.gcxx-ai__feedback button:hover {
  border-color: var(--gcxx-green-600);
  color: var(--gcxx-green-700);
}

/* 打字中 */
.gcxx-ai__typing .gcxx-ai__bubble {
  display: flex;
  gap: 4px;
  padding: 14px;
}

.gcxx-ai__typing span {
  animation: gcxx-bounce 1.2s infinite ease-in-out;
  background: #95a59d;
  border-radius: 50%;
  height: 6px;
  width: 6px;
}

.gcxx-ai__typing span:nth-child(2) {
  animation-delay: .15s;
}

.gcxx-ai__typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes gcxx-bounce {

  0%,
  70%,
  100% {
    transform: translateY(0);
  }

  35% {
    transform: translateY(-5px);
  }
}

/* 快捷问题（胶囊，演示风格：白底绿边绿字） */
.gcxx-ai__quick {
  background: #fff;
  border-top: 1px solid var(--gcxx-line);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
}

.gcxx-ai__quick[hidden] {
  display: none;
}

.gcxx-ai__quick button,
.gcxx-ai__lead-open {
  background: #fff;
  border: 1px solid var(--gcxx-line);
  border-radius: 14px;
  color: var(--gcxx-green-700);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 11px;
  padding: 6px 11px;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.gcxx-ai__quick button:hover,
.gcxx-ai__lead-open:hover {
  background: var(--gcxx-soft);
  border-color: var(--gcxx-green-600);
  color: var(--gcxx-green-800);
}

/* 输入区 */
.gcxx-ai__composer {
  background: #fff;
  border-top: 1px solid var(--gcxx-line);
  padding: 8px 12px 12px;
}

.gcxx-ai__tools {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gcxx-ai__tools span {
  color: var(--gcxx-muted);
  font-size: 10px;
}

.gcxx-ai__form {
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--gcxx-line);
  border-radius: 14px;
  display: flex;
  gap: 8px;
  padding: 7px;
}

.gcxx-ai__form:focus-within {
  border-color: var(--gcxx-green-600);
  box-shadow: 0 0 0 3px rgba(22, 148, 88, .12);
}

.gcxx-ai__form textarea {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--gcxx-ink);
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  max-height: 112px;
  min-height: 38px;
  outline: 0;
  padding: 7px;
  resize: none;
}

/* 主发送按钮：演示深绿 + hover */
.gcxx-ai__form button[type="submit"] {
  background: var(--gcxx-green-800);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  min-height: 38px;
  padding: 7px 15px;
  transition: background .2s ease;
}

.gcxx-ai__form button[type="submit"]:hover {
  background: var(--gcxx-green-950);
}

.gcxx-ai button:disabled {
  cursor: wait;
  opacity: .55;
}

.gcxx-ai__disclaimer {
  color: var(--gcxx-muted);
  font-size: 9px;
  line-height: 1.45;
  margin: 6px 4px 0;
  text-align: center;
}

/* 资料领取弹窗 */
.gcxx-ai__honeypot {
  height: 1px !important;
  left: -9999px !important;
  opacity: 0 !important;
  position: absolute !important;
  width: 1px !important;
}

.gcxx-ai__lead {
  align-items: center;
  background: rgba(5, 63, 41, .55);
  backdrop-filter: blur(2px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: absolute;
  z-index: 4;
}

.gcxx-ai__lead[hidden] {
  display: none;
}

.gcxx-ai__lead-card {
  background: #fff;
  border: 1px solid var(--gcxx-line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  max-height: 92%;
  overflow-y: auto;
  padding: 22px 20px 20px;
  position: relative;
  width: 100%;
}

.gcxx-ai__lead-card h3 {
  color: var(--gcxx-green-950);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  padding-right: 28px;
}

.gcxx-ai__lead-card > p {
  color: var(--gcxx-muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 14px;
}

.gcxx-ai__lead-card label {
  color: var(--gcxx-ink);
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 12px 0 0;
}

.gcxx-ai__lead-card input[type="text"] {
  border: 1px solid var(--gcxx-line);
  border-radius: 10px;
  display: block;
  font-size: 13px;
  margin-top: 5px;
  min-height: 42px;
  padding: 8px 11px;
  width: 100%;
}

.gcxx-ai__lead-card input[type="text"]:focus {
  border-color: var(--gcxx-green-600);
  box-shadow: 0 0 0 3px rgba(22, 148, 88, .12);
  outline: 0;
}

.gcxx-ai__consent {
  align-items: flex-start;
  display: flex !important;
  gap: 7px;
  line-height: 1.5;
  margin-top: 14px !important;
}

.gcxx-ai__consent input {
  margin-top: 3px;
}

/* 弹窗主按钮（确认提交）：演示深绿、整行、hover */
.gcxx-ai__lead-card button[type="submit"] {
  background: var(--gcxx-green-800);
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
  min-height: 44px;
  width: 100%;
  transition: background .2s ease;
}

.gcxx-ai__lead-card button[type="submit"]:hover {
  background: var(--gcxx-green-950);
}

.gcxx-ai__lead-result {
  color: var(--gcxx-green-700);
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
}

@media (max-width: 600px) {
  .gcxx-ai--floating {
    bottom: 15px;
    right: 15px;
  }

  .gcxx-ai__launcher {
    justify-content: center;
    min-width: 58px;
    padding: 5px;
    width: 58px;
  }

  .gcxx-ai__launcher-label {
    display: none;
  }

  .gcxx-ai__launcher-avatar::after {
    left: auto;
    right: 0;
    top: 0;
  }

  .gcxx-ai--floating .gcxx-ai__panel {
    bottom: 0;
    height: 100dvh;
    left: 0;
    max-height: none;
    position: fixed;
    right: 0;
    top: 0;
    width: auto;
  }

  .gcxx-ai__header {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .gcxx-ai__composer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .gcxx-ai *,
  .gcxx-ai *::before,
  .gcxx-ai *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
