/* ============================== */
/* 🌟 全局基础样式 */
/* ============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: #f7f8fa;
  margin: 0;
  padding: 0;
  line-height: 1.55;
  color: #2c3e50;
  font-weight: 400;
}

h2 {
  text-align: center;
  margin: 0 0 24px 0;
  font-weight: 600;
  color: #2c3e50;
  font-size: 20px;
  letter-spacing: 0.2px;
}

textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e5e9f0;
  font-size: 14px;
  resize: vertical;
  transition: all 0.2s ease;
  background: #ffffff;
  color: #2c3e50;
}

textarea#mainInput,
.case-textarea {
  font-size: 16px;
  line-height: 1.6;
  min-height: 200px;
  max-height: 500px;
  padding: 16px 20px;
}

textarea:focus {
  border-color: #c9cdd4;
  outline: none;
  box-shadow: 0 0 0 2px rgba(201, 205, 212, 0.25);
}

/* ============================== */
/* 🌟 按钮样式 */
/* ============================== */
button {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  background: #26619C;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.button-group {
  display: flex;
  gap: 25px;
  margin: 24px 0;
  justify-content: center;
}

button:hover {
  background: #2c3e50;
  box-shadow: 0 2px 8px rgba(52, 73, 94, 0.12);
}

button:active {
  transform: translateY(0.5px);
  box-shadow: none;
}

.secondary-btn {
  background: none;
  border: none;
  color: #7f8c8d;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.secondary-btn:hover {
  color: #34495e;
  background: #f2f3f5;
}

.func-buttons {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  align-items: center;
}

.func-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  background-color: #7E8EA8;
  color: #fff;
}
.copy-btn:hover {
  background-color: #6D7E96;
}
.copy-btn:disabled {
  background-color: #B0B9C8;
  cursor: not-allowed;
  opacity: 0.8;
}

.download-btn {
  background-color: #6E7F9E;
  color: #fff;
}
.download-btn:hover {
  background-color: #5D6E8C;
}
.download-btn:disabled {
  background-color: #B0B9C8;
  cursor: not-allowed;
  opacity: 0.8;
}

/* ============================== */
/* 🌟 Tabs 样式 */
/* ============================== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 1px solid #eef2f7;
  padding-left: 4px;
}

.tab-btn {
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #7f8c8d;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 14px;
  margin-bottom: -1px;
}

.tab-btn.active {
  background: #ffffff;
  border-color: #eef2f7 #eef2f7 #ffffff #eef2f7;
  color: #34495e;
}

.tab-btn:hover:not(.active) {
  background: #fafbfc;
  color: #34495e;
}

.tab-content {
  min-height: 300px;
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
}

.empty-tip,
.analyze-download-tip {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #999;
}

/* ============================== */
/* 🌟 输入区样式 */
/* ============================== */
.case-input-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 24px auto;
  position: relative;
  z-index: 1;
}

.case-textarea {
  width: 100%;
  min-height: 160px;
  max-height: 400px;
  padding: 16px 20px;
  font-size: 15px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  resize: none;
  outline: none;
  box-sizing: border-box;
  overflow-y: auto;
  transition: all 0.2s ease;
  display: block;
  background: #fff;
  color: #2c3e50;
}

.case-textarea:focus {
  border-color: #c9cdd4;
  box-shadow: 0 0 0 2px rgba(201, 205, 212, 0.25);
}

/* ============================== */
/* 🌟 页面容器布局（左右两区） */
/* ============================== */
.ai-layout {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  background: #f7f8fa;
  overflow-x: hidden;
  padding-top: 0;
}

.ai-sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  flex-shrink: 0;
  position: relative;
  height: 100vh;
}

.ai-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 32px;
  overflow-y: auto;
  min-width: 0;
}

.ai-main-content {
  width: 80%;
  min-width: 360px;
  max-width: 900px;
}

.top-nav {
  position: fixed;
  top: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  z-index: 1000;
  background: #f7f8fa;
  box-shadow: none;
  border: none;
}

.top-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
  align-items: center;
}

.top-nav a,
#wechatLoginBtn {
  text-decoration: none;
  color: #333;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: transparent;
  transition: all 0.2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================== */
/* 🌟 弹窗样式 */
/* ============================== */
#qrModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#qrModal .modal-box {
  background: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 360px;
  height: auto;
}

#qrModal #qrClose {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
}

#wechat_qr_code {
  width: 300px;
  height: 380px;
  margin-bottom: 12px;
}

#qrModal .qr-text {
  font-size: 14px;
  color: #666;
  text-align: center;
}

/* ============================== */
/* 🌟 【最终版】单按钮上传 + 横向缩略图（按钮居中 + 无证据自动收起空白） */
/* ============================== */
.evidence-upload-area {
  margin: 10px 0;
  text-align: center;
  padding: 8px 0;
}

.upload-evidence-btn {
  padding: 0 20px;
  height: 36px;
  line-height: 36px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.2s ease;
}
.upload-evidence-btn:hover {
  background: #1d4ed8;
}

/* 🔥 关键修改：去掉 min-height，无证据时自动收起空间 */
.evidence-thumb-list {
  display: flex;
  gap: 12px;
  padding: 8px 0 4px 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd #f5f5f5;
  align-items: center;
  box-sizing: border-box;
}
.evidence-thumb-list::-webkit-scrollbar {
  height: 6px;
}
.evidence-thumb-list::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background-color: #ddd;
}
.evidence-thumb-list::-webkit-scrollbar-track {
  background-color: #f5f5f5;
}

.evidence-thumb-item {
  width: 100px;
  height: 100px;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.evidence-thumb-item:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.evidence-thumb-img {
  width: 100%;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  background: #f9fafb;
}

.evidence-thumb-name {
  font-size: 12px;
  color: #666666;
  margin-top: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 90px;
}

.evidence-thumb-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}
.evidence-thumb-item:hover .evidence-thumb-delete {
  opacity: 1;
}

.pdf-placeholder {
  width: 60px;
  height: 60px;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.evidence-empty-tip {
  color: #999999;
  font-size: 14px;
  text-align: center;
  width: 100%;
  padding: 0;
  margin: 0;
}

/* 左侧历史案件选中高亮 */
.history-item {
  cursor: pointer;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  transition: background 0.2s;
}
.history-item:hover {
  background: #f5f5f5;
}
.history-item.active {
  background: #1677ff; /* 蓝色高亮，可换成你的项目主色 */
  color: white;
}

/* 新建案件按钮 - 强制贴紧右侧区最左侧 */
#newCaseBtn {
  position: relative !important;
  margin-left: 0 !important;
  margin-right: auto !important;
  left: 0 !important;
  float: left !important;
  clear: both !important;
  width: auto !important;
}
/* 确保按钮的父容器无内边距遮挡，让按钮能贴到最左 */
.ai-main-content {
  padding-left: 0 !important;
  margin-left: 0 !important;
  position: relative !important;
}