﻿/* 智能查询：三栏对话布局 */
.query-page {
  display: flex;
  height: calc(100vh - 218px);
  min-height: 620px;
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.query-page.is-left-collapsed .q-left {
  width: 0;
  flex-basis: 0;
  border-right: 0;
  overflow: hidden;
}

.query-page.is-right-collapsed .q-right {
  width: 0;
  flex-basis: 0;
  border-left: 0;
  overflow: hidden;
}

/* 左侧会话栏 */
.q-left {
  min-width: 0;
  width: 258px;
  flex: 0 0 258px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-right: 1px solid var(--line);
  transition: width 0.18s ease, flex-basis 0.18s ease;
}

.q-left-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 10px;
}

.q-new-chat {
  flex: 1;
  height: 36px;
  border-radius: 9px;
}

.q-left-search {
  padding: 0 12px 8px;
}

.q-left-search input,
#q-scope-search {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
}

.q-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.q-session {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 9px;
  margin-bottom: 2px;
}

.q-session:hover {
  background: #eef4ff;
}

.q-session.is-active {
  background: #e3edff;
}

.q-session-main {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 9px;
  cursor: pointer;
}

.q-session-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-session-main small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
}

.q-session-del {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
}

.q-session:hover .q-session-del {
  opacity: 1;
}

.q-session-del:hover {
  background: #fee2e2;
  color: var(--red);
}

.q-left-foot,
.q-right-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-3);
}

/* 中间主区 */
.q-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.q-topbar {
  height: 54px;
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.q-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.q-icon-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-600);
}

.q-scope-chip {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid #bcd2f5;
  background: #eef5ff;
  color: var(--brand-700);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.q-model {
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.q-topbar-spacer {
  flex: 1;
}

/* 消息 */
.q-messages {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px 18px;
  scroll-behavior: smooth;
}

.q-welcome {
  max-width: 640px;
  margin: 48px auto;
  text-align: center;
}

.q-welcome-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1c63c4, #4f8df7);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(28, 99, 196, 0.25);
}

.q-welcome h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--text);
}

.q-welcome p {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.8;
}

.q-suggests {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.q-suggest {
  padding: 8px 14px;
  border: 1px solid #cfe0fb;
  background: #f6f9ff;
  color: var(--brand-700);
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
}

.q-suggest:hover {
  background: #eaf2ff;
  border-color: var(--brand-500);
}

.q-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.q-msg.is-user {
  flex-direction: row-reverse;
}

.q-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #e8f1ff;
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 800;
}

.q-msg.is-user .q-avatar {
  background: #1c63c4;
  color: #fff;
}

.q-bubble {
  max-width: min(760px, 82%);
  min-width: 120px;
  padding: 12px 15px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line-2);
  position: relative;
}

.q-msg.is-user .q-bubble {
  background: #eaf2ff;
  border-color: #cfe0fb;
}

.q-msg-body {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}

.q-typing {
  color: var(--text-3);
}

.q-msg-time {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-3);
  text-align: right;
}

.q-cite {
  border: 0;
  background: #e3edff;
  color: var(--brand-700);
  border-radius: 4px;
  padding: 0 3px;
  font-size: 11px;
  cursor: pointer;
  margin: 0 1px;
}

.q-cite:hover {
  background: #cfe0fb;
}

.q-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--line-2);
}

.q-actions button {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
}

.q-actions button:hover {
  color: var(--brand-600);
}

/* 来源卡片 */
.q-sources {
  margin-top: 10px;
  border-top: 1px solid var(--line-2);
  padding-top: 8px;
}

.q-sources-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 6px;
}

.q-source {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  margin-bottom: 5px;
}

.q-source:hover {
  border-color: #bcd2f5;
  background: #f7faff;
}

.q-source-no {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: #e3edff;
  color: var(--brand-700);
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.q-source-main {
  flex: 1;
  min-width: 0;
}

.q-source-main b {
  display: block;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-source-main small {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-source-go {
  color: var(--text-3);
}

/* 输入区 */
.q-composer {
  border-top: 1px solid var(--line);
  padding: 10px 16px 12px;
  background: #fff;
}

.q-scope-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 11.5px;
  color: var(--text-3);
}

.q-scope-line b {
  color: var(--brand-700);
}

.q-link-btn {
  border: 0;
  background: transparent;
  color: var(--brand-600);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
}

.q-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#q-input {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  outline: none;
}

#q-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.1);
}

.q-send {
  height: 42px;
  padding: 0 22px;
  border-radius: 10px;
}

.q-input-hint {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--text-3);
}

/* 右侧来源栏 */
.q-right {
  min-width: 0;
  width: 300px;
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  background: #fbfcfe;
  border-left: 1px solid var(--line);
  transition: width 0.18s ease, flex-basis 0.18s ease;
}

.q-right-head {
  height: 54px;
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.q-right-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.q-right-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.q-right-empty {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.8;
  padding: 20px 8px;
  text-align: center;
}

.q-right-foot {
  font-size: 11px;
}

/* 范围弹窗 */
.q-scope-tip {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.q-scope-all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #bcd2f5;
  background: #f2f7ff;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-700);
  margin-bottom: 10px;
  cursor: pointer;
}

.q-scope-search {
  margin-bottom: 8px;
}

.q-scope-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line-2);
  border-radius: 10px;
}

.q-scope-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}

.q-scope-row:last-child {
  border-bottom: 0;
}

.q-scope-row:hover {
  background: #f7faff;
}

.q-scope-info b {
  display: block;
  font-size: 12.5px;
  color: var(--text);
}

.q-scope-info small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
}

.q-scope-count {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-2);
}

.q-empty-small {
  padding: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .q-left {
    width: 220px;
    flex-basis: 220px;
  }
  .q-right {
    width: 260px;
    flex-basis: 260px;
  }
  .q-messages {
    padding: 20px;
  }
}


.q-session[hidden] {
  display: none;
}

