/* 优化后的CSS */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: 15px;
  letter-spacing: 1px;
}

body {
  font-family: "FZLanTingHei-L-GB", "方正兰亭黑长简体", "Microsoft YaHei", "微软雅黑", "heiti tc", "Roboto Sans", Helvetica, Arial, sans-serif;
  /*            background: #f7f7f7;*/
  background: #F9F9F9;
  height: 100vh;
  display: flex;
  font-size: 1em;
  touch-action: none
}

/* 历史记录侧边栏 */
.history-sidebar {
  font-size: 14px;
  width: 100%;
  max-width: 270px;
  background: white;
  /*            background: #f7f7f7;*/
  padding: 16px;
  border-right: 1px solid #eee;
  overflow-y: auto;
  user-select: none;
  height: 90%;
}
.sidebar-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh; /* 或100%，根據你的需求 */
}

.history-sidebar {
  flex: 0 0 90%;
  max-height: 90%;
  /* 其他原有樣式保留 */
}

.sidebar-bottom {
  flex: 0 0 10%;
  max-height: 10%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-item {
  padding: 12px;
  margin: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  position: relative;
}

.item-content {
  overflow: hidden;
  text-overflow: ellipsis;
  mask-image: linear-gradient(90deg, #000, #000 67%, transparent 95%, transparent);
}

.history-item:hover {
  /*            background:rgba(56, 116, 255, 0.05);*/
  background: #F4CF3E;
  z-index: 2;
}

.history-item.active {
  background: #F4CF3E;
  /*            color: rgb(38 38 38);*/
  color: black;
  font-weight: bold;
}

.item-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.history-item:hover .item-actions {
  display: block;
}

.history-item:hover .item-actions .action-menu {
  display: none;
}

.history-item:hover .item-actions:hover .action-menu {
  display: block;
}

.action-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  /*            color: #666;*/
  color: black;
}

.action-btn:hover {
  /*            color: #3874ff;*/
  color: #666;
}

.action-menu {
  position: absolute;
  right: 0;
  top: 24px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 1;
  color: rgb(38 38 38);
}

.item-actions.show {
  display: block;
}

.menu-item {
  padding: 8px 16px;
  font-size: 13px;
  line-height: 19px;
  cursor: pointer;
  white-space: nowrap;
  background: white;
  border-radius: 5px;
}

.action-menu> :nth-child(2) {
  color: red;
}

.menu-item:hover {
  background: #f5f5f5;
}

.chat-container {
  flex: 1;
  /*            max-width: 1200px;*/
  min-width: 547px;
  margin: 20px auto;
  background: #F9F9F9 ;
  border-radius: 12px;
  /*            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);*/
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 40px);
  /*            height: 100vh;*/
  justify-content: center;
}

.messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px 20%;
  display: none;
  flex-direction: column;
  width: 100%;
  margin: 0 auto;
  /*            gap: 24px;*/
}

/*        .messages::-webkit-scrollbar {
          width: 0;
          height: 0;
          background: transparent;
      }*/

.message {
  max-width: 100%;
  padding: 12px 12px;
  border-radius: 18px;
  line-height: 1.6;
  text-align: justify;
  word-break: break-all;
}

.user-message {
  background: #D9D9D9;
  color:black;
  align-self: flex-end;
  border-radius: 18px 18px 4px 18px;
  margin-bottom: 12px;
}

.ai-message {
  /*background: #f0f0f0;
          color: #333;
          align-self: flex-start;
          border-radius: 18px 18px 18px 4px;*/
  background: rgba(56, 116, 255, 0.05);
  border: 1px solid rgba(56, 116, 255, 0.1);
  border-radius: 12px;
  margin: 0 0 12px 0;
  font-size: 0.9em;
  border: 1px solid #F4CF3E;
  background: linear-gradient(to bottom, #F4CF3E 5%, #ffffff 20%, #ffffff 100%);
}

/* Markdown样式优化 */
.ai-message p {
  line-height: 1.8;
  /*            margin: 12px 0;*/
}

.ai-message pre {
  background: white;
  /*            padding: 10px;*/
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid #ddd;
}

.ai-message code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  padding: 2px 4px;
  background: rgba(175, 184, 193, 0.2);
  border-radius: 4px;
  font-size: 0.8em;
}

.ai-message ul,
.ai-message ol {
  margin: 12px 0;
  padding-left: 24px;
}

/* 思考内容样式 */
.thinking-container {
  background: rgba(56, 116, 255, 0.05);
  border: 1px solid rgba(56, 116, 255, 0.1);
  border-radius: 12px;
  margin: 12px 0;
  transition: all 0.3s ease;
  max-width: 100%;

}

.thinking-header {
  padding: 5px 5px;
  color: black;
  font-weight: 500;
  display: flex;
  align-items: center;
  user-select: none;
  cursor: pointer;
  margin-bottom: 3px;
}

.thinking-content {
  padding: 8px 8px;
  background: white;
  border-radius: 0 0 12px 12px;
  /*            max-height: 300px;*/
  /*            overflow-y: auto;*/
  font-size: 0.8em;
  line-height: 1.5;
  color: #8b8b8b;
  text-align: justify;
  border-radius: 10px;
}
.thinking-content p{
  font-size: 14px;
}

.thinking-content pre {
  background: #f8f9fa !important;
  padding: 12px !important;
  border-radius: 8px !important;
  border: 1px solid #eee !important;
}

.thinking-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  padding: 2px 4px;
  background: rgba(56, 116, 255, 0.1);
  border-radius: 4px;
  color: #3874ff;
}

.arrow {
  margin-right: 8px;
  transform: rotate(90deg);
  transition: transform 0.2s;
  user-select: none;
}

.expanded .arrow {
  transform: rotate(-90deg);
}

.input-container {
  padding: 0px 20% 0;
  /* border-top: 1px solid #eee; */
  display: flex;
  gap: 12px;
  flex-direction: column;
}

/* 其他样式保持不变 */

textarea {
  flex-grow: 1;
  padding: 10px 7px 60px 7px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  resize: none;
  margin: 0;
  max-height: 390px;
  box-sizing: border-box;
  word-break: break-word;
  white-space: pre-wrap;
  overflow: auto;
  transition: border-color 0.3s;

}

textarea:focus {
  border-color: #F4CF3E;
  outline: none;
  box-shadow: none;
  /*            border: 2px solid #007bff;*/
}

.send {
  background: black;
  color: #F4CF3E;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  transition: opacity 0.2s;
  max-width: 250px;
  min-width: 150px;
  margin: 0 auto;
  text-align: center;
  user-select: none;
}

.send:hover {
  opacity: 0.9;
}

.new_chat {
  align-items: center;
  margin-bottom: 34px;
  display: flex;
  color: #F4CF3E;
  background-color: black;
  cursor: pointer;
  height: 44px;
  border-radius: 8px;
  padding: 0 10px;
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  overflow: hidden;
  transition: background 0.2s;
}

.new_chat:hover {
  background-color: rgba(244, 207, 62, 0.15); /* 金色透明 */
  color: #F4CF3E; /* 保持字体色 */
}

.icon {
  width: 100%;
  text-align: center;
}

.topnav {
  display: none;
}

.top {
  display: none;
}

.bottomnode {
  display: none;
}
.mobile-login{
  display: none;
}
/* 在原有样式后追加移动端适配 */
@media screen and (max-width: 768px) {
  body {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    position: relative;
  }
  .sidebar-wrapper{
    height: 0;
  }
  .pc-login{
    display: none;
  }
  .mobile-login{
    display: flex;
  }
  .messages::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
  }

  .topnav {
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    display: flex;
    background: rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(10px);
    flex-grow: 0;
    flex-shrink: 0;
    height: 56px;
    /*                padding-top: 10px;*/
    position: fixed;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #eee;

  }

  .topnav,
  .topnav * {
    z-index: 10;
  }

  .mobile-menu {
    position: relative;
  }

  .mobile-menu::after {
    position: absolute;
    left: -10px;
    content: '';
    width: 24px;
    height: calc(100vh - 200px);
    display: block;
  }

  .bottomnode {
    width: 100%;
    height: 153.5px;
    display: block;
  }

  .top {
    height: 56px;
    width: 100%;
    padding: 10px 16px 0px;
    display: block;
    z-index: 9;
  }

  .history-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s;
    padding-top: 50px;
    backdrop-filter: blur(10px);
    overflow-x: hidden;
  }

  .history-sidebar.active {
    left: 0;
  }

  .chat-container {
    min-width: 100%;
    margin: 0;
    height: 100vh;
  }

  .messages {
    padding: 10px 2% 0px;
  }

  .input-container {
    padding: 15px 3% 15px;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: white;
    /*                background: rgba(255,255,255, 0.52);*/
    /*                backdrop-filter: blur(10px);*/
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  }

  /* 移动端菜单按钮 */
  /*.mobile-menu {
              display: block;
              position: fixed;
              left: 10px;
              top: 10px;
              z-index: 1001;
              padding: 8px;
              background: rgba(56, 116, 255, 0.1);
              border-radius: 8px;
          }*/

  /* 消息字体调整 */
  .message {
    font-size: 16px;
    line-height: 1.5;
    border-radius: 12px;
  }

  /* 输入框优化 */
  textarea {
    font-size: 16px;
    padding: 10px 10px;
    max-height: 150px;
  }

  button.send {
    padding: 8px 20px;
    min-width: auto;
    width: 100%;
    border-radius: 12px;
  }

  /* 隐藏PC版新对话按钮 */
  .new_chat {
    /* display: none; */
  }

  pre.screenshot_fix,
  code.screenshot_fix {
    white-space: break-spaces;
    text-align: left;
    word-break: break-all;
  }

  /*            .top.screenshot_fix,.topnav.screenshot_fix,.input-container.screenshot_fix,.bottomnode.screenshot_fix{
              display: none;
          }*/
}


/* 增加触摸反馈 */
button:active {
  transform: scale(0.98);
  opacity: 0.8;
}

/* 优化点击区域 */
/*        .message, button {
          min-height: 44px;
      }*/
/* 启用GPU加速 */
.message,
.history-item {
  will-change: transform;
}

/* 减少重绘区域。该项打开会导致在移动端下，无法手动控制滚动条 */
.messages {
  contain: strict;
}

/* 安全区域适配 */
/*        @supports (padding: max(0px)) {
          .input-container {
              padding-bottom: max(30px, env(safe-area-inset-bottom));
          }

          .messages {
              padding-top: max(15px, env(safe-area-inset-top));
          }
      }*/

/* 移动端加载优化 */
@media (prefers-reduced-motion: no-preference) {
  .message {
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
}


/*loading动画*/
.container {
  --uib-size: 45px;
  --uib-color: #5286FF;
  --uib-speed: 1s;
  --uib-bg-opacity: .1;
  height: 31.25px;
  width: 50px;
  transform-origin: center;
  overflow: visible;
}

.car {
  stroke: var(--uib-color);
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation:
          travel var(--uib-speed) ease-in-out infinite,
          fade var(--uib-speed) ease-out infinite;
  will-change: stroke-dasharray, stroke-dashoffset;
  transition: stroke 0.5s ease;
}

.track {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: var(--uib-color);
  opacity: var(--uib-bg-opacity);
}

@keyframes travel {
  0% {
    stroke-dashoffset: 100;
  }

  75% {
    stroke-dashoffset: 0;
  }
}

@keyframes fade {
  0% {
    opacity: 0;
  }

  20%,
  55% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/*        模态输入框部分*/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: fadeIn 0.6s forwards;
  z-index: 101;
}

.modal-content {
  display: flex;
  flex-direction: column;
  background: white;
  padding: 29px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-50px);
  /*            animation: slideIn 0.6s forwards;*/
  min-width: 300px;
  gap: 20px;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  to {
    transform: translateY(0);
  }
}

.modal-exit {
  animation: fadeOut 0.4s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.modal-message {
  text-align: center;
  font-size: 18px;
}


.modal-input {
  /*            width: 94%;*/
  padding: 8px;
  /*            margin: 10px 0;*/
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.3s;
  font-size: 14px;
  color: #393939;
}

.modal-buttons {
  display: flex;
  justify-content: space-evenly;
  gap: 5px;
  margin-top: 5px;
}

.modal-button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.confirm-btn {
  background: #007bff;
  color: white;
}

.confirm-btn:hover {
  background: #0056b3;
}

.cancel-btn {
  background: #6c757d;
  color: white;
}

.cancel-btn:hover {
  background: #5a6268;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}
.tab-btn {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  cursor: pointer;
  font-weight: 600;
  color: black;
  background: white;
  /* border-radius: 8px 8px 0 0; */
  /* margin-right: 2px; */
  transition: background 0.2s, color 0.2s;
}
.tab-btn.active {
  background: #fff;
  color: black;
  border-bottom: 4px solid #F4CF3E;
}
.tab-content {
  width: 100%;
}
.tab-panel {
  display: block;
}
#tab-quick {
  /* 可根据需要自定义样式 */
}
.quick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.quick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  /* font-size: 15px; */
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.quick-item img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.chat-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
  margin-top: 24px;
  user-select: none;
  padding: 0px 20%;
}
.mascot {
   width: 150px;
   height: 150px;
  margin-bottom: 12px;
}
.chat-title {
  font-size: 1.8em;
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
  white-space: nowrap;
}
.chat-subtitle {
  display: flex;
  background: linear-gradient(to right, transparent 0%, #F4CF3E 50%, transparent 100%);
  align-items: center;
  color: black;
  line-height: 2;
  font-size: 1.1em;
  margin-bottom: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.chat-subtitle .line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, #fff, #ffe066, #fff);
  margin: 0 10px;
  border-radius: 1px;
}
.chat-subtitle .highlight {
  color: #ffb300;
  font-weight: bold;
  margin: 0 2px;
}
.chat-source {
  color: #888;
  font-size: 1em;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
}
.chat-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  width: 100%;
  justify-content: flex-start;
}
.chat-tab {
  white-space: nowrap;
  background: #E8E8E8;
  border: none;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 1.1em;
  color: black;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.chat-tab.active,
.chat-tab:hover {
  background: #ffe066;
  color: black;
}
.quick-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  width: 100%;
  margin: 0 auto 10px auto;
  justify-content: flex-start;
}
.quick-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* 修改为黑色阴影 */
  padding: 30px 20px;
  font-size: 1.1em;
  color: #222;
  margin-bottom: 8px;
  /* min-width: 260px; */
  flex: 1 1 40%;
  cursor: pointer;
  border: 1px solid #fff; /* 改为白色边框 */
  transition: box-shadow 0.2s, border 0.2s;
}
.quick-cards-panel{
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  width: 100%;
  margin: 0 auto 10px auto;
  justify-content: flex-start;
}
.quick-card:hover {
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.18);
  border: 1.5px solid #F4CF3E;
}
@media (max-width: 1400px) {
  .chat-header{
    padding: 0px 5%;
  }

}
@media (max-width: 768px) {
  .quick-card{margin-bottom: 0;}
  .chat-header {padding: 0px 10px;margin-top: 10px;overflow-y: auto;overflow-x: hidden; }
  .mascot { width: 100px; height: 100px; }
  .chat-title { font-size: 1.2em; }
  .chat-tabs {
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 一行两个 */
    gap: 8px; /* 按钮间距可自调 */
  }
  .chat-tab {
    width: 100%;         /* 让按钮填满格子 */
    box-sizing: border-box;
    text-align: center;
  }
  .chat-source { margin-left: 0; }
  .quick-cards { width: 100%; gap: 10px; }
  .quick-card { min-width: 120px; padding: 10px 8px; font-size: 1em; }

}
@media (max-width: 480px) {
  .quick-card{
    font-size: 14px;
  }
  .chat-subtitle {
    font-size: 14px;
  }
}
