/* ── Bootstrap 主题覆盖 ── */
:root {
  --bs-primary: #1565c0;
  --bs-primary-rgb: 21, 101, 192;
  --bs-success: #1565c0;
  --bs-success-rgb: 21, 101, 192;
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 14px;
  --bs-body-bg: #f4f5f9;
  --bs-body-color: #333;
}

/* ── Body ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bs-body-bg);
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  padding: 0 0;
  height: 56px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85) !important;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.navbar-brand {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 24px;
  letter-spacing: 2px;
  color: var(--bs-primary) !important;
}

/* ── Cards ── */
.card {
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow 0.25s;
}
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important; }
.card-header {
  font-size: 13.5px;
  font-weight: 600;
  padding: 14px 18px;
  background: #fafbfd;
}
.card-header svg { flex-shrink: 0; color: var(--bs-primary); }
.card-body { padding: 18px; }

/* ── Tip Cards ── */
.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  border: 1px solid rgba(0,0,0,0.04);
  height: 100%;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.tip-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  border-radius: 14px 14px 0 0;
}
.tip-card-green::before { background: linear-gradient(90deg, #2196f3, #1e88e5); }
.tip-card-blue::before  { background: linear-gradient(90deg, #42a5f5, #1e88e5); }
.tip-card-amber::before { background: linear-gradient(90deg, #ffa726, #f57c00); }
.tip-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.08); }
.tip-card .tip-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tip-card-green .tip-icon { background: #e3f2fd; color: #1565c0; }
.tip-card-blue .tip-icon  { background: #e3f2fd; color: #1976d2; }
.tip-card-amber .tip-icon { background: #fff8e1; color: #f57c00; }
.tip-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #333; }
.tip-card p { font-size: 12px; color: #777; line-height: 1.6; margin: 0; }
.tip-card code {
  background: #f0f1f5;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  color: #e53935;
  font-weight: 500;
}

/* ── Project Dropdown ── */
#projectDropdownBtn {
  border: 1.5px solid #dce0e8;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  background: #f8f9fc;
  transition: all 0.2s;
}
#projectDropdownBtn:hover { border-color: #bbdefb; background: #f3f6fd; }
#projectDropdownBtn:focus { border-color: #2196f3; box-shadow: 0 0 0 0.2rem rgba(21,101,192,0.1); background: #fff; }
.project-list .dropdown-item {
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.project-list .dropdown-item:hover { background: #e3f2fd; }
.project-list .dropdown-item.active { background: var(--bs-primary); color: #fff; }
.project-list::-webkit-scrollbar { width: 4px; }
.project-list::-webkit-scrollbar-thumb { background: #d0d4d8; border-radius: 3px; }

/* ── Tab Content ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Form Switch ── */
.form-switch .form-check-input {
  width: 2.5em;
  height: 1.3em;
  cursor: pointer;
}
.form-switch .form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }

/* ── Prompt Card ── */
.prompt-card { border-left: 4px solid #2196f3; }
.prompt-header-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #e3f2fd;
  color: #1565c0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prompt-textarea {
  width: 100%;
  min-height: 320px;
  font-size: 12.5px;
  line-height: 1.75;
  background: #f8f9fc;
  color: #555;
  border: none;
  border-radius: 0;
  padding: 14px 18px;
  resize: vertical;
  transition: all 0.2s;
}
.prompt-textarea:focus {
  background: #fff;
  color: #222;
  box-shadow: inset 0 0 0 2px rgba(21,101,192,0.12);
  outline: none;
}
.prompt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid #eef0f5;
  background: #fafbfd;
  border-radius: 0 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg);
  flex-wrap: wrap;
}
.prompt-char-badge {
  font-size: 10.5px;
  color: #999;
  background: #f0f1f5;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 500;
}

/* ── Upload Zone ── */
.upload-zone {
  background: #f8f9fc;
  border: 1.5px dashed #dce0e8;
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s;
}
.upload-zone:hover { border-color: #bbdefb; background: #f3f6fd; }
.upload-zone .input-group { box-shadow: 0 1px 2px rgba(0,0,0,0.04); border-radius: 8px; overflow: hidden; }

/* ── Paste Textarea ── */
.paste-textarea {
  min-height: 170px;
  font-size: 0.8125rem;
  line-height: 1.7;
  background: #f8f9fc;
  border-radius: 10px;
  border: 1.5px solid #dce0e8;
  resize: vertical;
  transition: all 0.2s;
  padding: 12px 14px;
}
.paste-textarea:focus {
  background: #fff;
  border-color: #2196f3;
  box-shadow: 0 0 0 0.2rem rgba(21,101,192,0.08);
}

/* ── KB Section ── */
.kb-section { border-color: #e8eaf0 !important; }

/* ── Chunk List ── */
.chunk-list {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #e8eaf0;
  border-radius: 10px;
  background: #fff;
}
.chunk-list::-webkit-scrollbar { width: 5px; }
.chunk-list::-webkit-scrollbar-track { background: transparent; }
.chunk-list::-webkit-scrollbar-thumb { background: #d0d4d8; border-radius: 3px; }
.chunk-list::-webkit-scrollbar-thumb:hover { background: #b0b4b8; }

.chunk-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f2f4f8;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
}
.chunk-item:hover { background: #f3f6fd; }
.chunk-item:last-child { border-bottom: none; }
.chunk-item .idx {
  color: #fff;
  font-weight: 600;
  min-width: 26px;
  height: 22px;
  flex-shrink: 0;
  font-size: 11px;
  background: linear-gradient(135deg, #2196f3, #1e88e5);
  text-align: center;
  border-radius: 6px;
  line-height: 22px;
}
.chunk-item .preview {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #555;
  line-height: 1.6;
}
.chunk-item .len {
  color: #bbb;
  font-size: 10.5px;
  flex-shrink: 0;
  padding-top: 2px;
}
.chunk-item .chunk-del {
  display: none;
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #ccc;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.chunk-item:hover .chunk-del { display: flex; }
.chunk-item .chunk-del:hover { background: #ffebee; color: #e53935; }

/* ── Buttons ── */
.btn-outline-success {
  --bs-btn-color: #1565c0;
  --bs-btn-border-color: #90caf9;
  --bs-btn-hover-bg: #e3f2fd;
  --bs-btn-hover-border-color: #64b5f6;
  --bs-btn-active-bg: #bbdefb;
  --bs-btn-active-border-color: #42a5f5;
}
.btn-success, .btn-outline-success.active, .btn-outline-success.active-tab {
  background: linear-gradient(135deg, #1565c0, #1e88e5) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.btn-success:hover {
  background: linear-gradient(135deg, #0d47a1, #1976d2) !important;
  box-shadow: 0 4px 14px rgba(21,101,192,0.3);
}
.btn-outline-danger {
  --bs-btn-color: #e53935;
  --bs-btn-border-color: #ef9a9a;
  --bs-btn-hover-bg: #ffebee;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: #c0c4cc;
  font-size: 13px;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: 0.3; }

/* ── Model List ── */
.model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
  transition: all 0.15s;
}
.model-item:last-child { border-bottom: none; }
.model-item:hover { background: #f8f9fc; }
.model-item .model-info { flex: 1; min-width: 0; }
.model-item .model-name { font-size: 13px; font-weight: 500; color: #333; }
.model-item .model-detail { font-size: 11px; color: #999; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-item .model-actions { display: flex; gap: 4px; flex-shrink: 0; }
.model-item .model-actions .btn { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.model-item.disabled { opacity: 0.45; }
.model-item.disabled .model-name { text-decoration: line-through; }

/* ── Cache Stats ── */
.cache-stat { font-size: 12px; color: #888; }
.cache-stat-value { color: #555; font-weight: 500; }
.cache-stat-sep { color: #ddd; font-size: 12px; }

/* ── Badge ── */
.badge.bg-light {
  background: #f0f1f5 !important;
  color: #777 !important;
}

/* ── Modal ── */
.modal-content {
  border-radius: 16px;
  border: none;
}
.modal-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid #f0f2f5;
}
.modal-body { padding: 16px 22px; }
.modal-footer { padding: 12px 22px 18px; }

/* ── Toast ── */
.toast { border-radius: 12px; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .col-lg-6 + .col-lg-6 { margin-top: 0; }
}
@media (max-width: 767.98px) {
  .tip-card { padding: 14px 16px; }
  .tip-card .tip-icon { width: 36px; height: 36px; border-radius: 10px; }
  .tip-card .tip-icon svg { width: 15px; height: 15px; }
  .navbar-brand { font-size: 20px; }
  .prompt-textarea { min-height: 220px; }
}
