/* ==================== 智囊模块全部自定义样式 ==================== */
/* 以下类名与 HTML 严格对应，无 Tailwind 视觉类干扰 */

/* ==================== 桌面端布局网格 ==================== */
.thinktank-desktop-layout {
  gap: 24px;
  align-items: start;
}

@media (min-width: 1024px) {
  .thinktank-desktop-layout.hidden.md\:grid,
  .thinktank-desktop-layout {
    display: grid !important;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr) !important;
    column-gap: 32px;
    align-items: start;
  }

  .thinktank-desktop-layout > aside {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .thinktank-desktop-layout > :not(aside) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
}

/* 左侧聊天工作区 */
.thinktank-chat-shell {
  min-width: 0;
}

/* 右侧辅助信息栏 */
.thinktank-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ----- 桌面端主卡片 ----- */
.thinktank-chat-card {
  background-color: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: clamp(620px, calc(100dvh - 170px), 820px);
  min-height: 620px;
  border: 1px solid rgba(226, 232, 240, 0.3);
}

/* ----- 对话头部 ----- */
.thinktank-chat-header {
  padding: 12px 20px;
  background-color: #F8FAFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.3);
  flex: 0 0 auto;
}

.thinktank-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.thinktank-end-session-btn {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #64748b;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.thinktank-end-session-btn:hover {
  border-color: #94a3b8;
  color: #334155;
  background: #f1f5f9;
}
.thinktank-end-session-btn:active {
  transform: scale(0.97);
}

.thinktank-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background-color: #0052CC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.thinktank-chat-title {
  font-weight: 700;
  color: #0F172A;
  font-size: 0.9375rem;
  margin: 0;
}

.thinktank-chat-status {
  font-size: 0.6875rem;
  color: rgba(71, 85, 105, 0.8);
  margin: 0;
}

.thinktank-status-badge {
  padding: 0.2rem 0.6rem;
  background-color: #ECFDF5;
  color: #065F46;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
}

/* 消息容器 */
.thinktank-messages-container {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 24px 28px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(to bottom, rgba(249, 250, 251, 0.3), white);
}

/* 底部输入区 */
.thinktank-chat-composer,
.thinktank-chat-footer {
  padding: 16px 20px;
  background-color: #FFFFFF;
  border-top: 1px solid rgba(226, 232, 240, 0.3);
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
}

.thinktank-chat-input {
  width: 100%;
  background-color: #F1F5F9;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 48px 12px 16px;
  font-size: 0.875rem;
  min-height: 48px;
  max-height: 140px;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.thinktank-chat-input:focus {
  border-color: #0052CC;
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.1);
}

.thinktank-send-btn {
  position: absolute;
  bottom: 28px;
  right: 32px;
  background-color: #0052CC;
  color: white;
  padding: 8px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thinktank-send-btn:hover {
  background-color: #003d9b;
}
.thinktank-send-btn:active {
  transform: scale(0.92);
}
.thinktank-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.thinktank-input-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.625rem;
  color: rgba(71, 85, 105, 0.7);
  margin-top: 8px;
}

/* ----- 右侧边栏卡片 ----- */
.thinktank-sidebar-card {
  background-color: #F8FAFC;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(226, 232, 240, 0.3);
}

.thinktank-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.thinktank-card-title {
  font-weight: 700;
  color: #0F172A;
  font-size: 0.9375rem;
  margin: 0;
}

.thinktank-hot-question {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.thinktank-question-item-simple {
  padding: 8px 12px;
  background-color: #FFFFFF;
  border-radius: 10px;
  transition: background-color 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}
.thinktank-question-item-simple:hover {
  background-color: rgba(0, 82, 204, 0.04);
  border-color: rgba(0, 82, 204, 0.15);
}
.thinktank-question-item-simple p {
  font-size: 0.8125rem;
  color: #1E293B;
  line-height: 1.4;
  margin: 0;
}

/* 定制智囊团卡片 */
.thinktank-custom-card {
  background: linear-gradient(135deg, #003D9B 0%, #0052CC 100%);
  border-radius: 16px;
  padding: 20px;
  color: white;
  position: relative;
  overflow: hidden;
}

.thinktank-custom-card-watermark {
  position: absolute;
  top: -4px;
  right: -4px;
  opacity: 0.08;
}
.thinktank-custom-card-watermark span {
  font-size: 4rem;
}

.thinktank-custom-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  position: relative;
}

.thinktank-custom-card-desc {
  font-size: 0.8125rem;
  opacity: 0.85;
  margin-bottom: 16px;
  line-height: 1.6;
  position: relative;
}

.thinktank-custom-card-btn {
  display: block;
  width: 100%;
  background-color: #FFFFFF;
  color: #0052CC;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.8125rem;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s;
  position: relative;
}
.thinktank-custom-card-btn:hover {
  background-color: rgba(255, 255, 255, 0.92);
}

/* ----- 移动端入口 ----- */
.thinktank-mobile-entry-card {
  background-color: #FFFFFF;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.3);
}

.thinktank-mobile-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background-color: #0052CC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.thinktank-mobile-title {
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}

.thinktank-mobile-subtitle {
  font-size: 0.75rem;
  color: rgba(71, 85, 105, 0.8);
  margin: 0;
}

.thinktank-mobile-question {
  background: #F1F5F9;
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: #1E293B;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.thinktank-mobile-question:hover {
  border-color: rgba(0, 82, 204, 0.15);
  background: rgba(0, 82, 204, 0.04);
}
.thinktank-mobile-question:active {
  transform: scale(0.98);
}

.thinktank-mobile-start-btn {
  width: 100%;
  background-color: #0052CC;
  color: white;
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  min-height: 48px;
  transition: background-color 0.2s;
}
.thinktank-mobile-start-btn:hover {
  background-color: #003d9b;
}
.thinktank-mobile-start-btn:active {
  transform: scale(0.98);
}

/* ==================== 移动端全屏聊天 ==================== */
.thinktank-mobile-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
}
.thinktank-mobile-chat-overlay.hidden {
  display: none;
}

.thinktank-mobile-chat-header {
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(226, 232, 240, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #F8FAFC;
  flex: 0 0 auto;
}

.thinktank-mobile-chat-title {
  font-weight: 700;
  color: #0F172A;
  font-size: 0.9375rem;
}

.thinktank-mobile-close-btn {
  padding: 6px;
  color: rgba(71, 85, 105, 0.8);
  background: none;
  border: none;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}
.thinktank-mobile-close-btn:hover {
  background: rgba(0, 61, 155, 0.06);
}

.thinktank-mobile-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.thinktank-mobile-chat-footer {
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background-color: #FFFFFF;
  border-top: 1px solid rgba(226, 232, 240, 0.3);
  flex: 0 0 auto;
}

.thinktank-mobile-chat-input {
  width: 100%;
  background-color: #F1F5F9;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 48px 12px 16px;
  font-size: 0.875rem;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.thinktank-mobile-chat-input:focus {
  border-color: #0052CC;
}

.thinktank-mobile-send-btn {
  position: absolute;
  bottom: 24px;
  right: 28px;
  background-color: #0052CC;
  color: white;
  padding: 8px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thinktank-mobile-input-hint {
  font-size: 0.625rem;
  color: rgba(71, 85, 105, 0.7);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* ==================== 消息气泡 ==================== */
.message-user {
  display: flex;
  justify-content: flex-end;
}
.message-user .message-bubble {
  background: linear-gradient(135deg, #0052CC 0%, #2B4F8E 100%);
  color: white;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  font-size: 14px;
  max-width: 70%;
  box-shadow: 0 2px 8px rgba(0, 82, 204, 0.15);
  line-height: 1.5;
}

.message-ai {
  display: flex;
  justify-content: flex-start;
}
.message-ai .message-bubble {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 18px 18px 18px 4px;
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  max-width: 85%;
}

.message-animate {
  animation: fadeInUp 0.25s ease-out forwards;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 滚动条 */
.custom-scroll::-webkit-scrollbar { width: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #A0AEC0; }

/* ==================== 回应卡片 ==================== */
.thinktank-response {
  width: min(560px, 100%);
  overflow-wrap: anywhere;
}

.thinktank-response:not(.thinktank-mode-direct) {
  border-left: 3px solid #0052cc;
}

.thinktank-response-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.thinktank-response-summary,
.thinktank-response-copy {
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.thinktank-response-summary {
  margin-bottom: 12px;
}

.thinktank-response-section {
  border-top: 1px solid #e2e8f0;
  margin-top: 12px;
  padding-top: 12px;
}

.thinktank-response-section-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.thinktank-response-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.thinktank-response-actions button {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  transition: all 0.2s;
  min-height: 36px;
}
.thinktank-response-actions button:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}
.thinktank-response-actions button:active {
  transform: scale(0.97);
}
.thinktank-response-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== 会话级反馈卡片 ==================== */
.thinktank-session-feedback {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
  max-width: min(480px, 100%);
}

.thinktank-session-feedback-title {
  font-size: 14px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 16px 0;
}

.thinktank-session-feedback-group {
  margin-bottom: 16px;
}

.thinktank-session-feedback-label {
  font-size: 13px;
  color: #475569;
  margin-bottom: 8px;
  font-weight: 500;
}

.thinktank-session-feedback-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thinktank-session-feedback-options button {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 8px 16px;
  transition: all 0.2s;
  min-height: 40px;
}
.thinktank-session-feedback-options button:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}
.thinktank-session-feedback-options button:active {
  transform: scale(0.97);
}
.thinktank-session-feedback-options button.selected {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 600;
}

.thinktank-session-feedback-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thinktank-session-feedback-reasons button {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  transition: all 0.2s;
  min-height: 36px;
}
.thinktank-session-feedback-reasons button:hover {
  border-color: #94a3b8;
  color: #334155;
}

.thinktank-session-feedback-submit {
  display: block;
  width: 100%;
  background: #0052CC;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.2s;
  min-height: 44px;
}
.thinktank-session-feedback-submit:hover {
  background: #003d9b;
}
.thinktank-session-feedback-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.thinktank-session-feedback-done {
  text-align: center;
  color: #059669;
  font-size: 14px;
  font-weight: 500;
  padding: 12px;
}

.thinktank-session-feedback-error {
  color: #dc2626;
  font-size: 13px;
  text-align: center;
  padding: 6px 0;
}

/* 关闭确认弹层 */
.thinktank-close-confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 24, 72, 0.4);
  padding: 24px;
}
.thinktank-close-confirm-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
}
.thinktank-close-confirm-card p {
  font-size: 15px;
  color: #0F172A;
  margin: 0 0 20px 0;
  font-weight: 500;
}
.thinktank-close-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.thinktank-close-confirm-actions button {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s;
}
.thinktank-close-confirm-continue {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.thinktank-close-confirm-continue:hover {
  background: #e2e8f0;
}
.thinktank-close-confirm-end {
  background: #0052CC;
  border: none;
  color: white;
}
.thinktank-close-confirm-end:hover {
  background: #003d9b;
}

/* ==================== 旧版 per-message feedback（保留兼容但不再主动使用） ==================== */
.thinktank-feedback {
  display: none;
}

.thinktank-feedback-state {
  color: #64748b;
  font-size: 12px;
}

/* ==================== handoff 表单 ==================== */
.thinktank-handoff-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
.thinktank-handoff-form .thinktank-handoff-row {
  display: flex;
  gap: 8px;
}
.thinktank-handoff-form input,
.thinktank-handoff-form select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.2s;
}
.thinktank-handoff-form input:focus,
.thinktank-handoff-form select:focus {
  border-color: #0052CC;
  outline: none;
}
.thinktank-handoff-form button {
  background: #0052CC;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.2s;
}
.thinktank-handoff-form button:hover {
  background: #003d9b;
}


/* ==================== Tablet (768px-1023px) 显式控制 ==================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .thinktank-mobile-entry {
    display: block !important;
  }
  .thinktank-desktop-layout {
    display: none !important;
  }
}
/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
  /* Pad 和手机：全屏聊天模式 */
  body.thinktank-chat-open {
    overflow: hidden;
  }

  .thinktank-mobile-chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
  }

  .thinktank-mobile-chat-overlay.hidden {
    display: none;
  }

  .thinktank-mobile-chat-header {
    flex: 0 0 auto;
  }

  .thinktank-mobile-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .thinktank-mobile-chat-footer {
    flex: 0 0 auto;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* 手机端隐藏 footer */
  body.thinktank-chat-open footer {
    display: none;
  }
}

@media (max-width: 640px) {
  .thinktank-handoff-form .thinktank-handoff-row {
    flex-direction: column;
  }

  .thinktank-response,
  .thinktank-response-actions,
  .thinktank-session-feedback {
    max-width: 100%;
  }

  .message-user .message-bubble {
    max-width: 80%;
  }

  .message-ai .message-bubble {
    max-width: 92%;
  }
}

/* Body scroll lock when mobile chat is open */
body.thinktank-chat-open {
  overflow: hidden;
}

/* Desktop layout fallback for JIT Tailwind builds without responsive grid utilities */
@media (min-width: 1024px) {
  .thinktank-desktop-layout.hidden.md\:grid {
    display: grid !important;
  }

  .thinktank-mobile-entry.md\:hidden {
    display: none !important;
  }
}

/* ==================== SEO/GEO 长内容区三端隐藏（保留给爬虫/AI抓取，不对用户直接显示） ==================== */
section[aria-labelledby="thinktank-about-heading"] {
  display: none !important;
}
