﻿/* ai对话弹窗 独立样式（含基础重置，不依赖 base.css） */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
li {
  list-style: none;
}
a {
  text-decoration: none;
}

/* 页面背景：限高一屏，不产生整页滚动 */
.box {
  width: 100%;
  min-height: 100vh;
  background-color: #ecf0fb;
  position: relative;
}
.box::after {
  content: '';
  width: 100%;
  height: 100vh;
  background: url(../img/Bg.jpg) top center no-repeat;
  background-size: cover;
  position: absolute;
  top: 0;
  left: 0;
}

@media screen and (min-width: 769px) {
  .box .popup {
    width: 1000px;
    height: 700px;
    background-color: #ddecfe;
    box-shadow: 0px 0px 27px 0px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: fixed;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding-bottom: 27px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 995;
  }
  /* 对话区纵向滚动条 */
  .box .popup .Dialog::-webkit-scrollbar {
    width: 6px;
  }
  .box .popup .Dialog::-webkit-scrollbar-track {
    background-color: transparent;
  }
  .box .popup .Dialog::-webkit-scrollbar-thumb {
    background-color: #a9c1e0;
    border-radius: 3px;
  }
  .box .popup .Dialog::-webkit-scrollbar-thumb:hover {
    background-color: #8fadd4;
  }
  .box .popup .title {
    width: 100%;
    height: 49px;
    background-color: #ffffff;
    box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .box .popup .title img {
    width: auto;
    height: 27px;
  }
  .box .popup .title a {
    position: absolute;
    top: 50%;
    right: 17px;
    transform: translate(0, -50%);
  }
  .box .popup .title a img {
    width: 14px;
    height: 14px;
    object-fit: cover;
  }
  .box .popup .Dialog {
    width: 100%;
    flex: 1;
    min-height: 0;
    margin: 21px 0;
    overflow-y: auto;
    padding: 0px 15px;
  }
  .box .popup .Dialog li {
    display: flex;
    align-items: flex-start;
    padding-right: 20px;
    margin-top: 22px;
  }
  .box .popup .Dialog li .head {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
  }
  .box .popup .Dialog li .head img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .box .popup .Dialog li .content {
    margin-left: 17px;
    height: auto;
    min-height: 48px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 0px 10px 10px 10px;
    border: solid 1px #ffffff;
    padding: 11px 18px;
  }
  .box .popup .Dialog li .content .text p {
    width: 100%;
    font-size: 16px;
    line-height: 24px;
    color: #1b1b1b;
  }
  .box .popup .Dialog li .content .As {
    margin-top: 11px;
    display: flex;
    flex-direction: column;
  }
  .box .popup .Dialog li .content .As a {
    width: fit-content;
    height: 35px;
    background-color: #d3e0f1;
    border-radius: 10px;
    font-size: 14px;
    line-height: 30px;
    color: #1b1b1b;
    display: flex;
    align-items: center;
    padding: 0 10px;
    margin-top: 10px;
  }
  .box .popup .Dialog li .content .As a img {
    margin-left: 7px;
  }
  .box .popup .Dialog li.tip {
    flex: 1;
    min-width: 0;
    margin-top: 0;
  }
  .box .popup .Dialog li.tip .content {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0px;
  }
  .box .popup .Dialog li.tip .content .text {
    min-height: 48px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 0px 10px 10px 10px;
    border: solid 1px #ffffff;
    padding: 11px 18px;
  }
  .box .popup .Dialog li.user {
    padding-right: 0;
    padding-left: 20px;
    justify-content: flex-end;
  }
  .box .popup .Dialog li.user .content {
    margin-left: 0;
    margin-right: 17px;
    width: auto;
    min-height: 48px;
    background-color: #1c50a9;
    border-radius: 10px 0px 10px 10px;
    border: solid 1px #ffffff;
    text-align: right;
    padding: 11px 18px;
  }
  .box .popup .Dialog li.user .content p {
    font-size: 15px;
    line-height: 24px;
    color: #ffffff;
  }
  .box .popup .Input {
    width: 95%;
    height: 52px;
    background-color: #ffffff;
    border-radius: 25px 26px 26px 26px;
    border: solid 1px #d5dee8;
    padding: 5px 6px 5px 18px;
    display: flex;
    align-items: center;
  }
  .box .popup .Input input {
    flex: 1;
    margin-right: 12px;
    height: 100%;
    font-size: 16px;
    line-height: 16px;
    color: #333;
    border: none;
    outline: none;
  }
  .box .popup .Input input::placeholder {
    color: #a7aeb5;
  }
  .box .popup .Input button {
    width: 67px;
    height: 42px;
    background-color: #1c50a9;
    border-radius: 21px 21px 21px 21px;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .box .popup .Input button:hover {
    filter: brightness(1.1);
  }
}
@media screen and (max-width: 769px) {
  .box .popup {
    width: 95%;
    height: 85%;
    background-color: #ddecfe;
    box-shadow: 0vw 0vw 7.2vw 0vw rgba(0, 0, 0, 0.2);
    border-radius: 2.13333333vw;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding-bottom: 5.33333333vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 995;
  }
  /* 对话区纵向滚动条（移动端） */
  .box .popup .Dialog::-webkit-scrollbar {
    width: 1.6vw;
  }
  .box .popup .Dialog::-webkit-scrollbar-track {
    background-color: transparent;
  }
  .box .popup .Dialog::-webkit-scrollbar-thumb {
    background-color: #a9c1e0;
    border-radius: 0.8vw;
  }
  .box .popup .title {
    width: 100%;
    height: 13.06666667vw;
    background-color: #ffffff;
    box-shadow: 0vw 0vw 2.13333333vw 0vw rgba(0, 0, 0, 0.2);
    border-radius: 2.13333333vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .box .popup .title img {
    width: auto;
    height: 7.2vw;
  }
  .box .popup .title a {
    position: absolute;
    top: 50%;
    right: 4.53333333vw;
    transform: translate(0, -50%);
  }
  .box .popup .title a img {
    width: 3.73333333vw;
    height: 3.73333333vw;
    object-fit: cover;
  }
  .box .popup .Dialog {
    width: 100%;
    flex: 1;
    min-height: 0;
    margin: 4.53333333vw 0;
    overflow-y: auto;
    padding: 0px 4vw;
  }
  .box .popup .Dialog li {
    display: flex;
    align-items: flex-start;
    margin-top: 5.86666667vw;
  }
  .box .popup .Dialog li .head {
    width: 10.93333333vw;
    height: 10.93333333vw;
    min-width: 10.93333333vw;
    min-height: 10.93333333vw;
    background-color: #ffffff;
    border-radius: 2.13333333vw;
    overflow: hidden;
  }
  .box .popup .Dialog li .head img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .box .popup .Dialog li .content {
    margin-left: 2.66666667vw;
    height: auto;
    min-height: 10.93333333vw;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 0vw 2.66666667vw 2.66666667vw 2.66666667vw;
    border: solid 0.26666667vw #ffffff;
    padding: 2.13333333vw 2.66666667vw;
  }
  .box .popup .Dialog li .content .text p {
    width: 100%;
    font-size: 3.73333333vw;
    line-height: 6.4vw;
    color: #1b1b1b;
  }
  .box .popup .Dialog li .content .As {
    margin-top: 1.33333333vw;
    display: flex;
    flex-direction: column;
  }
  .box .popup .Dialog li .content .As a {
    width: fit-content;
    height: 8.53333333vw;
    background-color: #d3e0f1;
    border-radius: 2.66666667vw;
    font-size: 3.2vw;
    line-height: 5.33333333vw;
    color: #1b1b1b;
    display: flex;
    align-items: center;
    padding: 0 2.66666667vw;
    margin-top: 2.4vw;
  }
  .box .popup .Dialog li .content .As a img {
    margin-left: 1.86666667vw;
  }
  .box .popup .Dialog li.tip {
    flex: 1;
    min-width: 0;
    margin-top: 0;
  }
  .box .popup .Dialog li.tip .content {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0vw;
  }
  .box .popup .Dialog li.tip .content .text {
    min-height: 10.93333333vw;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 0vw 2.66666667vw 2.66666667vw 2.66666667vw;
    border: solid 0.26666667vw #ffffff;
    padding: 2.13333333vw 2.66666667vw;
  }
  .box .popup .Dialog li.user {
    padding-right: 0;
    justify-content: flex-end;
  }
  .box .popup .Dialog li.user .content {
    margin-left: 0;
    margin-right: 2.66666667vw;
    width: auto;
    min-height: 10.93333333vw;
    background-color: #1c50a9;
    border-radius: 2.66666667vw 0vw 2.66666667vw 2.66666667vw;
    border: solid 0.26666667vw #ffffff;
    text-align: right;
    padding: 2.13333333vw 2.66666667vw;
  }
  .box .popup .Dialog li.user .content p {
    font-size: 4vw;
    line-height: 6.4vw;
    color: #ffffff;
  }
  .box .popup .Input {
    width: 95%;
    height: 12vw;
    background-color: #ffffff;
    border-radius: 5.33333333vw;
    border: solid 0.26666667vw #d5dee8;
    padding: 1.33333333vw 1.06666667vw 1.33333333vw 3.2vw;
    display: flex;
    align-items: center;
  }
  .box .popup .Input input {
    flex: 1;
    margin-right: 3.2vw;
    height: 100%;
    font-size: 3.73333333vw;
    line-height: 3.73333333vw;
    color: #333;
    border: none;
    outline: none;
  }
  .box .popup .Input input::placeholder {
    color: #a7aeb5;
  }
  .box .popup .Input button {
    width: 14.93333333vw;
    height: 9.33333333vw;
    background-color: #1c50a9;
    border-radius: 5.6vw 5.6vw 5.6vw 5.6vw;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .box .popup .Input button img {
    height: 45%;
  }
  .box .popup .Input button:hover {
    filter: brightness(1.1);
  }
}


/* ===== AI 对话增强样式（原页面内联样式，迁移至此） ===== */

/* AI 思考中动效 */
.status {
  color: #7a8ba3;
  font-size: 14px;
  margin-right: 8px;
}
.thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}
.thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #5b9bd5;
  animation: thinkBlink 1.2s infinite ease-in-out;
}
.thinking span:nth-child(2) {
  animation-delay: 0.2s;
}
.thinking span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes thinkBlink {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* 发送/停止按钮图标 */
.Input button svg {
  height: 45%;
  display: none;
}
.Input button .icon-send {
  display: block;
}
.Input button.stopping .icon-send {
  display: none;
}
.Input button.stopping .icon-stop {
  display: block;
}
/* 停止状态按钮微呼吸提示 */
.Input button.stopping {
  animation: btnBreath 1.5s infinite ease-in-out;
}
@keyframes btnBreath {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

/* 流式输出光标 */
.caret {
  display: inline-block;
  width: 2px;
  height: 15px;
  background-color: #1c50a9;
  vertical-align: -2px;
  margin-left: 2px;
  animation: caretBlink 1s steps(1) infinite;
}
@keyframes caretBlink {
  50% { opacity: 0; }
}

/* 轻量 markdown 样式 */
.Dialog li .content .text p code {
  background-color: rgba(28, 80, 169, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 14px;
  font-family: ui-monospace, Consolas, monospace;
}
.Dialog li .content .text p strong {
  color: #1c50a9;
}
.Dialog li .content .text p a {
  color: #1c50a9;
  text-decoration: underline;
  word-break: break-all;
}
.Dialog li .content .text p a:hover {
  color: #0f3a80;
}

/* markdown 表格 */
.Dialog li .content .text p .md-table {
  border-collapse: collapse;
  width: 100%;
  margin: 6px 0;
  font-size: 14px;
  background-color: #ffffff;
}
.Dialog li .content .text p .md-table th,
.Dialog li .content .text p .md-table td {
  border: 1px solid #d5dee8;
  padding: 6px 10px;
  text-align: left;
  line-height: 20px;
}
.Dialog li .content .text p .md-table th {
  background-color: #e8f0fb;
  color: #1c50a9;
  font-weight: 600;
  white-space: nowrap;
}
.Dialog li .content .text p .md-table tr:nth-child(even) td {
  background-color: #f6f9fd;
}

/* markdown 代码块 */
.Dialog li .content .text p .md-code {
  background-color: #f2f6fb;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 13px;
  color: #24406b;
  white-space: pre;
  overflow-x: auto;
  margin: 6px 0;
  line-height: 20px;
}

/* mermaid 图表容器 */
.Dialog li .content .text p .mermaid-src {
  background-color: #ffffff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  overflow-x: auto;
  text-align: center;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 13px;
  color: #24406b;
  white-space: pre;
}
.Dialog li .content .text p .mermaid-src svg {
  max-width: 100%;
  height: auto;
}

/* markdown 删除线 */
.Dialog li .content .text p del {
  color: #8a97a8;
  text-decoration: line-through;
}

/* markdown 图片 */
.Dialog li .content .text p .md-img {
  max-width: 100%;
  border-radius: 6px;
  margin: 6px 0;
  display: block;
}

/* markdown 分隔线 */
.Dialog li .content .text p .md-hr {
  border: none;
  border-top: 1px solid #d5dee8;
  margin: 10px 0;
}

/* markdown 任务列表 */
.Dialog li .content .text p .md-done { color: #2e7d32; }
.Dialog li .content .text p .md-todo { color: #9aa7b5; }

/* markdown 内嵌 svg */
.Dialog li .content .text p .md-svg {
  background-color: #ffffff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  overflow-x: auto;
  text-align: center;
}
.Dialog li .content .text p .md-svg svg {
  max-width: 100%;
  height: auto;
}

/* 数学公式（KaTeX 渲染前的兜底样式） */
.Dialog li .content .text p .md-math {
  color: #24406b;
  font-family: 'Times New Roman', serif;
}
.Dialog li .content .text p .md-math[data-display="true"] {
  display: block;
  text-align: center;
  margin: 6px 0;
}

/* markdown 斜体 */
.Dialog li .content .text p em {
  font-style: normal;
  color: #5a6c82;
}
.Dialog li .content .text p .md-h {
  font-weight: 600;
  color: #1c50a9;
  margin: 8px 0 4px;
}
.Dialog li .content .text p .md-h1 { font-size: 18px; }
.Dialog li .content .text p .md-h2 { font-size: 17px; }
.Dialog li .content .text p .md-h3 { font-size: 16px; }
.Dialog li .content .text p .md-h4 { font-size: 15px; }

/* markdown 引用 */
.Dialog li .content .text p .md-quote {
  border-left: 3px solid #a9c1e0;
  background-color: rgba(255, 255, 255, 0.6);
  padding: 6px 10px;
  margin: 6px 0;
  color: #555;
  font-size: 14px;
}

/* 输入框禁用态 */
.Input input:disabled {
  background-color: transparent;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 回到底部按钮 */
.scrollBtn {
  position: absolute;
  right: 28px;
  bottom: 96px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.scrollBtn.show {
  display: flex;
}
.scrollBtn svg {
  width: 18px;
  height: 18px;
}
.scrollBtn .badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background-color: #e54545;
  color: #ffffff;
  font-size: 11px;
  line-height: 16px;
  padding: 0 4px;
  display: none;
}
.scrollBtn .badge.show {
  display: block;
}
