@charset "UTF-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[v-cloak] { display: none !important; }
a { text-decoration: none; color: inherit; }
:root {
  --c-bg: #ffffff;
  --c-fg: #1a1a1a;
  --c-border: #e5e7eb;
  --c-sidebar-bg: #f9fafb;
  --c-msg-user-bg: #f3f4f6;
  --c-msg-ai-bg: #ffffff;
  --c-input-bg: #ffffff;
  --c-btn-bg: #ffffff;
  --c-scroll: #d1d5db;
  --c-scroll-hover: #9ca3af;
  --c-accent: #409eff;
  --c-accent-hover: #1d4ed8;
  --c-new: #67c23a;
  --c-new-hover: #56af29;
  --c-text-secondary: #6b7280;
  --c-code-bg: #1f2937;
  --c-code-fg: #f9fafb;
}

.dark {
  --c-bg: #111827;
  --c-fg: #f9fafb;
  --c-border: #374151;
  --c-sidebar-bg: #1f2937;
  --c-msg-user-bg: #374151;
  --c-msg-ai-bg: #1f2937;
  --c-input-bg: #374151;
  --c-btn-bg: #374151;
  --c-scroll: #4b5563;
  --c-scroll-hover: #6b7280;
  --c-accent: #2360c2;
  --c-accent-hover: #174286;
  --c-new: #4b9427;
  --c-new-hover: #38741b;
  --c-text-secondary: #9ca3af;
  --c-code-bg: #030712;
  --c-code-fg: #f9fafb;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background-color: var(--c-bg);
  color: var(--c-fg);
  transition: background-color 0.3s, color 0.3s;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.dialog { position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; z-index: 9999; background: rgba(0, 0, 0, 0.5); text-align: center; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.dialog-cont { min-width: 40vw; max-width: min(1400px, 90vw); min-height: 40vh; max-height: 92vh; overflow: auto;  background: #fff; border-radius: 12px; padding: 10px; }
.line1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }    

#chat-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  width: 260px;
  background-color: var(--c-sidebar-bg);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, border-color 0.3s;
  position: relative;
}

.sidebar-header {
  padding: 10px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-header select,
.sidebar-header button {
  width: 100%;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background-color: var(--c-input-bg);
  color: var(--c-fg);
  font-size: 14px;
  transition: all 0.2s ease-in-out;
}

.sidebar-header select:focus,
.sidebar-header button:focus {
  border-color: var(--c-new);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}

.sidebar-header button {
  background-color: var(--c-new);
  color: white;
  font-weight: 600;
  cursor: pointer;
  border-color: var(--c-new);
}

.sidebar-header button:hover {
  background-color: var(--c-new-hover);
}

.history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 8px;
  margin-bottom: 26px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 5px 8px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-size: 14px;
}

.history-item:hover {
  background-color: var(--c-accent);
  color: white;
}

.history-item.active {
  background-color: var(--c-accent);
  color: white;
}

.history-item.active .delete-chat,
.history-item:hover .delete-chat {
  color: white;
  opacity: 0.8;
}

.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-chat {
  background: none;
  border: none;
  color: var(--c-text-secondary);
  cursor: pointer;
  opacity: 0.6;
  font-size: 16px;
  transition: opacity 0.2s;
  padding: 0 4px;
  user-select: none;
}

.delete-chat:hover {
  opacity: 1;
}

.chat-container {
  flex: 1;
  width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--c-bg);
}
.side-setting {
  position: fixed;
  bottom: 4px;
  left: 6px;
  font-size: 20px;
  color: var(--c-text-secondary);
  display: flex;
  gap: 6px;
}
.theme-toggle {
  cursor: pointer;
  transition: color 0.2s, transform 0.3s;
}

.theme-toggle:hover {
  color: var(--c-fg);
  transform: scale(1.1) rotate(15deg);
}
.setting-icon {
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0px 20px 24px 20px;
}

.message-wrapper {
  /* margin-bottom: 20px; */
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding-top: 20px;
}

.message-wrapper .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--c-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.message-wrapper.user {
  justify-content: flex-end;
}

.message-wrapper.user .avatar {
  background-color: var(--c-text-secondary);
}

.message-wrapper .content {
  max-width: 100%;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background-color: var(--c-msg-ai-bg);
}

.message-wrapper.user .content {
  background-color: var(--c-msg-user-bg);
}

.message-wrapper .prose {
  max-width: max(800px, 46vw);
  line-height: 1.7;
  font-size: 16px;
}
.message-wrapper .prose.user {
  max-height: 300px;
  line-height: 1.4;
  overflow: auto;
  white-space: pre-wrap; 
}

.message-wrapper .prose p,
.message-wrapper .prose ul,
.message-wrapper .prose ol,
.message-wrapper .prose pre {
  margin-bottom: 0.4em;
}

.message-wrapper .prose pre {
  /* background-color: var(--c-code-bg); */
  color: var(--c-code-fg);
  /* padding: 1em; */
  border-radius: 0.5em;
  position: relative;
  /* border: 1px solid var(--c-border); */
}

.copy-code-btn, .run-btn, .down-code-btn, .expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgb(90 90 90 / 50%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s;
}
.down-code-btn {
  right: 8px;
  top: 38px;
}
.run-btn {
  right: 70px;
}
.btn-btm {
  top: auto;
  bottom: 8px;
}
.expand-btn {
  top: auto;
  bottom: 8px;
  border: none;
  background: #66b1ff;
}
.run-btn:hover, .copy-code-btn:hover, .down-code-btn:hover, .expand-btn:hover {
  opacity: 1;
}
pre.over-code {
  max-height: 400px;
  overflow: auto;
  box-shadow: inset 0px -33px 18px -14px rgba(40, 44, 52, 0.3);
}

.message-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--c-text-secondary);
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-secondary);
  opacity: 0.8;
  font-size: 13px;
  transition: all 0.2s;
}

.action-btn:hover {
  opacity: 1;
  color: var(--c-accent);
}

.chat-input-area {
  border-top: 1px solid var(--c-border);
  padding: 14px 14px 14px 28px;
  background-color: var(--c-bg);
  transition: border-color 0.3s;
  position: relative;
}

.chat-input-wrapper {
  position: relative;
  flex-grow: 1;
}

.chat-input {
  width: 100%;
  padding: 14px 120px 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--c-border);
  background-color: var(--c-input-bg);
  color: var(--c-fg);
  font-size: 16px;
  box-sizing: border-box;
  resize: none;
  line-height: 1.5;
  transition: all 0.2s ease-in-out;
  font-family: inherit;
  max-height: 40dvh;
}

.chat-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  outline: none;
}
.input-before {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
}

.send-btn-wrap {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
}
.send-btn {
  background-color: var(--c-accent);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.2s;
  opacity: .9;
}

.send-btn.stop {
  background-color: #ef4444;
}
.send-btn.file {
  background-color: #67C23A;
}

.send-btn.del {
  background-color: #959595;
  right: 50px;
}

.send-btn:hover {
  opacity: 1;
}

.send-btn+.send-btn {
  margin-left: 6px;
}


.token-count {
  font-size: 12px;
  color: var(--c-text-secondary);
  margin-left: auto;
  padding-left: 10px;
}

.retry-btn {
  margin-left: 10px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background-color: var(--c-btn-bg);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.retry-btn:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.toggle-side {
  display: none;
  position: absolute; 
  left: 8px;
  top: 8px;
}
.to-top {
  position: absolute;
  top: -42px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #d5d5d5;
  color: #8f8f8f;
  border-radius: 50%;
  cursor: pointer;
  filter: hue-rotate(165deg);
  opacity: .8;
  user-select: none;
  font-weight: bold;
}
.to-top.auto-scroll {
  top: -82px;
  opacity: .3;
}
.to-top.auto-scroll.opacity {
  opacity: .8;
}


::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--c-scroll);
  border-radius: 6px;
  border: 2px solid var(--c-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c-scroll-hover);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  font-size: 14px;
  border: 1px solid var(--c-border);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

th,
td {
  border: 1px solid var(--c-border);
  padding: 12px 15px;
  text-align: left;
}

th {
  background-color: var(--c-sidebar-bg);
  font-weight: 600;
}

tr:nth-child(even) {
  background-color: var(--c-sidebar-bg);
}

.dark tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

.chat-nav {
  width: 180px;
  max-height: 78vh;
  overflow: auto;
  padding: 10px 6px 10px 12px;
  border-left: 1px solid #ccc;
  margin-left: 10px;
}
.nav-item {
  font-size: 13px;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item i {
  color: #409eff;
  margin-right: 4px;
}
.nav-item b {
  font-weight: normal;
  margin-left: 10px;
  display: block;
  line-height: 1.3;
  font-size: 0.8em;
}
.nav-item b i {
  color: #b4dda0;
}

/* loading animation */
.pulse-dots{display:flex;gap:8px}
.pulse-dots i {width:12px;height:12px;background:#667eea;border-radius:50%;animation:pulse 1.4s infinite ease-in-out both}
.pulse-dots i:nth-child(1) { animation-delay: -0.32s; }
.pulse-dots i:nth-child(2) { animation-delay: -0.16s; }
@keyframes pulse {
    0%,80%,100%{transform:scale(0);opacity:.5}
    40%{transform:scale(1);opacity:1}
}


.rotating {
  animation: rotate 1.5s infinite;
  transform-origin: center center;
}
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message-wrapper p code:not(pre code), .message-wrapper ul code:not(pre code), .message-wrapper ol code:not(pre code) {
    padding: 0.2em 0.4em;
    vertical-align: middle;
    background: rgba(175, 184, 193, .2);
    border-radius: 6px;
    font-size: 0.85em;
    font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
}
.message-wrapper ol, .message-wrapper ul { 
  margin-left: 1em; 
}
.message-wrapper pre {
  position: relative;
}
code[class*=language-], pre[class*=language-] {
  text-shadow: none !important;
}
.message-wrapper .token.operator {
  background: none !important;
}
.theme-prism {
  :not(pre)>code[class*=language-], pre[class*=language-] {
    background: #f7f7f7;
  }
}

@media screen and (min-width: 1590px) {
  .chat-nav {
    width: 280px;
  }
  .message-wrapper .prose {
    max-width: max(900px, 49vw);
  }
}

@media screen and (max-width: 770px) {
  .chat-nav {
    display: none;
  }
  .toggle-side {
    display: block;
  }
  .sidebar {
    width: 260px;
    overflow: auto;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 9;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    transition: all .3s;
  }
  .sidebar.hidebar {
    width: 0px;
    overflow: hidden;
  }
  .hidebar .side-setting {
    display: none;
  }
  .chat-messages {
    padding: 12px 8px;
  }
  .message-wrapper {
    gap: 6px;
    margin-bottom: 12px;
  }
  .message-wrapper .content {
    font-size: 15px;
    padding: 8px 10px;
    max-width: calc(100% - 40px);
  }
  .chat-input {
    padding: 10px 80px 10px 10px;
    font-size: 14px;
  }
  .send-btn {
    font-size: 17px;
    width: 26px;
    height: 26px;
    margin-right: -4px;
  }
}
