/**
 * AxiaChat AI – Training Section Styles
 * Reuses easy-config design tokens for consistency.
 *
 * @since 3.0.1
 */

/* ========== Layout ========== */
.aichat-training-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 0;
}

.aichat-training-wrap h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
}

.aichat-training-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 28px;
}

/* ========== Bot Selector (top bar) ========== */
.aichat-training-bot-selector {
  margin-bottom: 24px;
}

.aichat-training-bot-selector label {
  font-weight: 600;
  margin-right: 10px;
  font-size: 14px;
}

.aichat-training-bot-selector select {
  min-width: 240px;
}

/* ========== Card Grid (main hub) ========== */
.aichat-training-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 600px) {
  .aichat-training-grid {
    grid-template-columns: 1fr;
  }
}

.aichat-training-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 28px 28px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
}

.aichat-training-card:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
  text-decoration: none;
  color: inherit;
}

.aichat-training-card:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.aichat-training-card-icon {
  font-size: 48px;
  margin-bottom: 14px;
  line-height: 1;
}

.aichat-training-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.aichat-training-card-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  max-width: 280px;
}

/* ========== Context selector (if >1 context) ========== */
.aichat-training-ctx-selector {
  margin-bottom: 20px;
}

.aichat-training-ctx-selector label {
  font-weight: 600;
  margin-right: 10px;
  font-size: 14px;
}

/* ========== Instructions page ========== */
.aichat-training-instructions-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 0;
}

/* Mode toggle */
.aichat-instr-mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.aichat-instr-mode-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background .2s, color .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.aichat-instr-mode-btn.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, .10), rgba(118, 75, 162, .10));
  color: #667eea;
}

.aichat-instr-mode-btn:hover:not(.active) {
  background: #f8fafc;
}

/* Manual mode */
.aichat-instr-manual {
  display: block;
}

.aichat-instr-manual .aichat-tpl-simple {
  margin-bottom: 16px;
}

.aichat-instr-textarea {
  width: 100%;
  min-height: 440px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  resize: vertical;
  transition: border-color .2s;
}

.aichat-instr-textarea:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .15);
}

/* Template modal */
.aichat-tpl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aichat-tpl-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  width: 640px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: aichat-tpl-modal-in .2s ease-out;
}

@keyframes aichat-tpl-modal-in {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aichat-tpl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.aichat-tpl-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.aichat-tpl-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
}

.aichat-tpl-modal-close:hover {
  color: #334155;
}

.aichat-tpl-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.aichat-tpl-modal-body .aichat-tpl-simple {
  border: none;
  padding: 0;
}

.aichat-tpl-modal-body .aichat-tpl-box {
  flex: 0 0 220px;
}

.aichat-tpl-modal-body .aichat-tpl-list {
  max-height: 320px;
}

/* Guided mode – reuses easy-config type grid */
.aichat-instr-guided {
  display: none;
}

.aichat-instr-guided .aichat-ec-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .aichat-instr-guided .aichat-ec-type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.aichat-instr-guided .aichat-ec-type-card {
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.aichat-instr-guided .aichat-ec-type-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.aichat-instr-guided .aichat-ec-type-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, .08), rgba(118, 75, 162, .08));
}

.aichat-instr-guided .aichat-ec-type-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.aichat-instr-guided .aichat-ec-type-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
}

.aichat-instr-guided .aichat-ec-type-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  margin-top: 4px;
}

/* Tone pills */
.aichat-instr-tone-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.aichat-instr-tone-pill {
  padding: 10px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .2s, background .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aichat-instr-tone-pill:hover {
  border-color: #cbd5e1;
}

.aichat-instr-tone-pill.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, .08), rgba(118, 75, 162, .08));
}

/* Response length slider */
.aichat-instr-length-wrap {
  margin-bottom: 24px;
}

.aichat-instr-length-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

/* Guided warning */
.aichat-instr-guided-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 20px;
}

.aichat-instr-guided-warning i {
  margin-right: 6px;
}

/* Preview block */
.aichat-instr-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  color: #334155;
}

/* ========== Context page ========== */
.aichat-training-context-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 0;
}

/* 3-box grid */
.aichat-ctx-source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 768px) {
  .aichat-ctx-source-grid {
    grid-template-columns: 1fr;
  }
}

.aichat-ctx-source-card {
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 24px 20px;
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}

.aichat-ctx-source-card.active {
  border-color: #667eea;
  box-shadow: 0 2px 12px rgba(102, 126, 234, .12);
}

.aichat-ctx-source-card.disabled {
  opacity: .45;
  pointer-events: none;
}

.aichat-ctx-source-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.aichat-ctx-source-header {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.aichat-ctx-source-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.aichat-ctx-source-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 0;
}

.aichat-ctx-source-body {
  text-align: left;
}

/* Selection modes inside source cards */
.aichat-ctx-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.aichat-ctx-mode-option label {
  cursor: pointer;
}

/* Expand/collapse for custom selections */
.aichat-ctx-custom-panel {
  display: none;
  margin-top: 10px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.aichat-ctx-custom-panel.show {
  display: block;
}

.aichat-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.aichat-ctx-item:last-child {
  border-bottom: none;
}

/* Search bar inside custom panel */
.aichat-ctx-search {
  margin-bottom: 10px;
}

.aichat-ctx-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
}

/* Status / stats */
.aichat-ctx-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.aichat-ctx-stat-badge {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #475569;
}

.aichat-ctx-stat-badge strong {
  color: #1e293b;
}

/* Advanced settings accordion */
.aichat-ctx-advanced-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  padding: 12px 0;
  border: none;
  background: none;
  transition: color .2s;
}

.aichat-ctx-advanced-toggle:hover {
  color: #334155;
}

.aichat-ctx-advanced-toggle i {
  transition: transform .2s;
}

.aichat-ctx-advanced-toggle.open i {
  transform: rotate(180deg);
}

.aichat-ctx-advanced-body {
  display: none;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
  margin-bottom: 20px;
}

.aichat-ctx-advanced-body.show {
  display: block;
}

/* Action bar */
.aichat-ctx-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

/* Toast / success message */
.aichat-training-toast {
  position: fixed;
  top: 40px;
  right: 20px;
  background: #22c55e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 99999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
  transition: opacity .3s;
}

.aichat-training-toast.error {
  background: #ef4444;
}

/* Advanced contexts link */
.aichat-ctx-advanced-link {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

.aichat-ctx-advanced-link a {
  font-size: 13px;
  color: #94a3b8;
  text-decoration: none;
}

.aichat-ctx-advanced-link a:hover {
  color: #667eea;
}

/* Back arrow */
.aichat-training-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
  margin-bottom: 16px;
}

.aichat-training-back:hover {
  color: #667eea;
}

/* Progress overlay for indexing */
.aichat-ctx-indexing-overlay {
  display: none;
  position: relative;
  background: rgba(255,255,255,.9);
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.aichat-ctx-indexing-overlay.show {
  display: block;
}

.aichat-ctx-indexing-pbar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.aichat-ctx-indexing-pbar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width .3s;
  width: 0%;
}

/* PDF upload area */
.aichat-ctx-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-top: 12px;
}

.aichat-ctx-upload-zone:hover,
.aichat-ctx-upload-zone.dragover {
  border-color: #667eea;
  background: rgba(102, 126, 234, .04);
}

.aichat-ctx-upload-zone i {
  font-size: 32px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.aichat-ctx-upload-zone p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* File list */
.aichat-ctx-file-list {
  margin-top: 12px;
}

.aichat-ctx-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.aichat-ctx-file-item .file-name {
  font-weight: 500;
}

.aichat-ctx-file-item .file-remove {
  color: #ef4444;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 14px;
}

/* Per-file upload progress */
.aichat-ctx-file-item.uploading,
.aichat-ctx-file-item.done,
.aichat-ctx-file-item.error {
  flex-wrap: wrap;
  gap: 4px;
}
.aichat-ctx-file-item .file-info {
  flex: 1 1 100%;
  font-weight: 500;
}
.aichat-ctx-file-item .file-upload-bar {
  flex: 1 1 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.aichat-ctx-file-item .file-upload-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width .3s ease;
}
.aichat-ctx-file-item .file-upload-status {
  flex: 1 1 100%;
  font-size: 11px;
  color: #64748b;
}

/* ========== Guided Response Length Slider (gradient like easy-config) ========== */
#aichat-guided-length {
  width: 100% !important;
  height: 8px !important;
  border-radius: 4px !important;
  background: linear-gradient(to right, #e2e8f0, #667eea) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 10px 0;
}

#aichat-guided-length::-webkit-slider-thumb {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  cursor: grab;
  margin-top: -8px;
}

#aichat-guided-length::-webkit-slider-thumb:active {
  cursor: grabbing;
}

#aichat-guided-length::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #e2e8f0, #667eea);
}

#aichat-guided-length::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #e2e8f0, #667eea);
}

#aichat-guided-length::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  cursor: grab;
}

/* ========== Knowledge Sources Limit slider (context page) ========== */
#aichat-ctx-limit {
  width: 100% !important;
  height: 8px !important;
  border-radius: 4px !important;
  background: linear-gradient(to right, #e2e8f0, #667eea) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer;
  padding: 0 !important;
}

#aichat-ctx-limit::-webkit-slider-thumb {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  cursor: grab;
  margin-top: -7px;
}

#aichat-ctx-limit::-webkit-slider-thumb:active {
  cursor: grabbing;
}

#aichat-ctx-limit::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #e2e8f0, #667eea);
}

#aichat-ctx-limit::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #e2e8f0, #667eea);
}

#aichat-ctx-limit::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  cursor: grab;
}

/* ========== Source cards – closed by default ========== */
.aichat-ctx-source-card .aichat-ctx-source-body {
  display: none;
}

.aichat-ctx-source-card.open .aichat-ctx-source-body {
  display: block;
}

.aichat-ctx-source-card .aichat-ctx-source-header {
  cursor: pointer;
  user-select: none;
}

.aichat-ctx-source-card .aichat-ctx-source-toggle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
  transition: transform .2s;
}

.aichat-ctx-source-card.open .aichat-ctx-source-toggle {
  transform: rotate(180deg);
  color: #667eea;
}

/* ========== Chat Guidelines (guided instructions) ========== */
.aichat-guidelines-section {
  margin-bottom: 24px;
}

.aichat-guidelines-list {
  margin-bottom: 12px;
}

.aichat-guideline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.aichat-guideline-bullet {
  color: #667eea;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
}

.aichat-guideline-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  transition: border-color .2s;
}

.aichat-guideline-input:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, .12);
}

.aichat-guideline-delete {
  border: none;
  background: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color .2s;
}

.aichat-guideline-delete:hover {
  color: #ef4444;
}

.aichat-add-guideline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.aichat-add-guideline:hover {
  border-color: #667eea;
  color: #667eea;
}

/* ========== Guideline Picker Modal ========== */
.aichat-gl-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aichat-gl-modal {
  background: #fff;
  border-radius: 16px;
  width: 780px;
  max-width: 94vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
  padding: 32px 36px;
}

.aichat-gl-modal h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1e293b;
}

.aichat-gl-modal-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.aichat-gl-modal-body {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

.aichat-gl-section-label {
  font-size: 12px;
  font-weight: 700;
  color: #667eea;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 14px 0 6px;
  border-bottom: 1px solid rgba(102, 126, 234, .12);
  margin-bottom: 8px;
}

.aichat-gl-modal-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: border-color .15s, background .15s;
  line-height: 1.4;
}

.aichat-gl-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.aichat-gl-modal-item:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, .04);
}

.aichat-gl-modal-item.blank {
  border-style: dashed;
  color: #64748b;
  font-style: italic;
}

.aichat-gl-modal-footer {
  text-align: right;
  margin-top: 16px;
}

.aichat-gl-modal-footer .btn-cancel {
  padding: 8px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
}

/* ========== Indexing options orange card ========== */
.aichat-ctx-indexing-card {
  background: #fff8f0;
  border: 1px solid #f0cda0;
  border-radius: 8px;
  padding: 16px 20px 20px;
  margin-top: 20px;
}

.aichat-ctx-indexing-card .aichat-ctx-adv-separator {
  margin-top: 0;
  color: #b87a2b;
}

.aichat-ctx-indexing-card .aichat-ctx-adv-separator::before,
.aichat-ctx-indexing-card .aichat-ctx-adv-separator::after {
  background: #f0cda0;
}

/* ========== Advanced Indexing separator ========== */
.aichat-ctx-adv-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.aichat-ctx-adv-separator::before,
.aichat-ctx-adv-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* WP source card tab-like radios */
.aichat-ctx-wp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.aichat-ctx-wp-tabs label {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}

.aichat-ctx-wp-tabs label:hover {
  border-color: #cbd5e1;
}

.aichat-ctx-wp-tabs input[type="radio"] {
  display: none;
}

.aichat-ctx-wp-tabs input[type="radio"]:checked + label {
  border-color: #667eea;
  background: rgba(102, 126, 234, .08);
  color: #667eea;
}

/* ========== Spin animation for indexing button ========== */
@keyframes aichat-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.aichat-spin {
  display: inline-block;
  animation: aichat-spin 1s linear infinite;
}

/* ========== Progress bar panel ========== */
#aichat-ctx-process-panel .progress {
  border-radius: 6px;
  overflow: hidden;
}
#aichat-ctx-process-panel .progress-bar {
  background: linear-gradient(90deg, #667eea, #764ba2);
  font-weight: 600;
  font-size: 12px;
  transition: width .3s ease;
}
#aichat-ctx-index-log {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

/* ========== Web Pages (Scraper) card ========== */

/* Method tabs — reuse the same style as wp-tabs */
.aichat-ctx-web-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.aichat-ctx-web-tabs label {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}
.aichat-ctx-web-tabs label:hover {
  border-color: #cbd5e1;
}
.aichat-ctx-web-tabs input[type="radio"] {
  display: none;
}
.aichat-ctx-web-tabs input[type="radio"]:checked + label {
  border-color: #667eea;
  background: rgba(102, 126, 234, .08);
  color: #667eea;
}

/* URL textarea */
#aichat-ctx-web-urls-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}

/* Discovered URLs list */
.aichat-ctx-web-results-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}
.aichat-ctx-web-url-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
  cursor: pointer;
  transition: background .1s;
}
.aichat-ctx-web-url-item:last-child {
  border-bottom: none;
}
.aichat-ctx-web-url-item:hover {
  background: #eef2ff;
}
.aichat-ctx-web-url-item .url-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4b5563;
}
.aichat-ctx-web-url-item input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: #667eea;
}

/* Progress bar for web scraper */
#aichat-ctx-web-progress .progress {
  border-radius: 6px;
  overflow: hidden;
}
#aichat-ctx-web-progress .progress-bar {
  background: linear-gradient(90deg, #667eea, #764ba2);
  font-weight: 600;
  font-size: 11px;
  transition: width .3s ease;
}
#aichat-ctx-web-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

/* ========== Document View / Edit Modals ========== */
#aichat-doc-view-modal .modal-dialog,
#aichat-doc-edit-modal .modal-dialog {
  max-width: 800px;
}

.aichat-doc-chunk-pre {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  margin: 0;
}

.aichat-doc-chunk-view,
.aichat-doc-chunk-edit {
  border-bottom: 1px dashed #e5e7eb;
  padding-bottom: 12px;
}
.aichat-doc-chunk-view:last-child,
.aichat-doc-chunk-edit:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.aichat-doc-chunk-textarea {
  font-size: 13px;
  line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  resize: vertical;
  min-height: 100px;
}

/* Ensure action button group doesn't wrap */
#aichat-ctx-docs-table .btn-group,
#aichat-modify-docs-table .btn-group {
  flex-wrap: nowrap;
  white-space: nowrap;
}

