/* ── Page navigation tabs (header) ── */
.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #e0e7ff; /* indigo-100: ~6.2:1 on indigo-800 bg */
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,0.15); }
.nav-tab.nav-active { background: #4f46e5; color: #fff; }
/* Keyboard focus for nav tabs */
.nav-tab:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ── Scope chips (search page upload selector) ── */
.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}
/* ON: #5b21b6 on #ede9fe → 7.1:1 ✓ */
.scope-chip-on  { background:#ede9fe; color:#5b21b6; border-color:#a78bfa; }
/* OFF: #374151 on #f1f5f9 → 8.4:1 ✓ */
.scope-chip-off { background:#f1f5f9; color:#374151; border-color:#cbd5e1; }
.scope-chip-on:hover  { background:#ddd6fe; }
/* hover: #1e293b on #e2e8f0 → 12.6:1 ✓ */
.scope-chip-off:hover { background:#e2e8f0; color:#1e293b; }

/* ── Embedded model badges (data page) ── */
.embed-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
}
/* YES: #166534 on #dcfce7 → 7.6:1 ✓ */
.embed-badge-yes { background:#dcfce7; color:#166534; }
/* NO:  #374151 on #e2e8f0 → 9.0:1 ✓ */
.embed-badge-no  { background:#e2e8f0; color:#374151; }

/* ── Action buttons (data page) ── */
.action-btn-primary {
  font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.75rem;
  border-radius: 0.5rem; border: 1px solid #818cf8;
  /* #3730a3 on #eef2ff → 8.6:1 ✓ */
  color: #3730a3; background: #eef2ff; white-space: nowrap;
  transition: background 0.15s; cursor: pointer;
}
.action-btn-primary:hover { background:#e0e7ff; }
.action-btn-primary:focus-visible { outline: 3px solid #4f46e5; outline-offset: 2px; }
.action-btn-primary:disabled { opacity:0.5; cursor:not-allowed; }

/* danger: #991b1b on #fff1f2 → 9.8:1 ✓ */
.action-btn-danger {
  font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.75rem;
  border-radius: 0.5rem; border: 1px solid #fca5a5;
  color: #991b1b; background: #fff1f2; white-space: nowrap;
  transition: background 0.15s; cursor: pointer;
}
.action-btn-danger:hover { background:#fee2e2; }
.action-btn-danger:focus-visible { outline: 3px solid #dc2626; outline-offset: 2px; }

.progress-track {
  width: 100%;
  height: 0.6rem;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #4f46e5);
  transition: width 0.25s ease;
}
.progress-fill.error {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

/* ── Search tab styles ── */
.search-tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  /* #374151 on white → 10.7:1 ✓ */
  color: #374151;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
}
/* #111827 on white → 18.9:1 ✓ */
.search-tab:hover { color: #111827; }
.search-tab.tab-active {
  color: #4338ca; /* indigo-700: 5.1:1 on white ✓ */
  border-bottom-color: #4338ca;
}
.search-tab:focus-visible {
  outline: 3px solid #4f46e5;
  outline-offset: -1px;
  border-radius: 4px;
}

/* ── Shared form inputs ── */
.search-input {
  border: 1.5px solid #9ca3af; /* increased from 1px for better visibility */
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  /* #111827 on white → 18.9:1 ✓ */
  color: #111827;
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
  background: #fff;
}
/* Placeholder: #4b5563 on white → 7.5:1 ✓ */
.search-input::placeholder { color: #4b5563; }
.search-input:focus {
  /* 3px solid ring ensures 3:1 non-text contrast for focus indicator */
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.5);
  border-color: #4f46e5;
}

/* ── Search / action buttons ── */
.search-btn {
  background: #4338ca; /* indigo-700 for more contrast with white label */
  color: #fff;
  padding: 0.375rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
  cursor: pointer;
  /* white on #4338ca → 8.1:1 ✓ */
}
.search-btn:hover  { background: #3730a3; }
.search-btn:focus-visible { outline: 3px solid #111827; outline-offset: 2px; }
.search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Keyword highlight ── */
mark {
  background-color: #fef08a;
  /* #1a1700 on #fef08a → ~15:1 ✓ */
  color: #1a1700;
  border-radius: 2px;
  padding: 0 2px;
}

/* ── Embedding model option cards ── */
.model-option {
  display: block;
  border: 1.5px solid #d1d5db;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.model-option:hover { border-color: #818cf8; background: #fafafa; }
.model-option:focus-visible { outline: 3px solid #4f46e5; outline-offset: 2px; }
.model-option-active {
  border-color: #4338ca;
  background: #f5f3ff;
}

/* ── Context messages ── */
.ctx-target {
  background: #fefce8;
  border: 2px solid #d97706; /* amber-600 for better contrast */
  border-radius: 0.75rem;
}
.ctx-regular {
  background: #f8fafc;
  border: 1px solid #cbd5e1; /* slightly darker border */
  border-radius: 0.75rem;
}

/* ── Filter labels ── */
.filter-label {
  font-size: 0.75rem;
  font-weight: 600; /* bold for small text legibility */
  /* #374151 on white → 10.7:1 ✓ */
  color: #374151;
  white-space: nowrap;
}

/* ── Date range mode toggle (segmented control) ── */
.range-mode-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 1rem;
  border: none;
  border-left: 1px solid #d1d5db;
  /* #374151 on #f9fafb → 9.7:1 ✓ */
  color: #374151;
  background: #f9fafb;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.range-mode-btn:first-child { border-left: none; }
.range-mode-btn:hover:not(.range-mode-active) { background: #f3f4f6; color: #111827; }
.range-mode-btn.range-mode-active {
  background: #4338ca;
  color: #fff;
  font-weight: 600;
}
.range-mode-btn:focus-visible {
  outline: 3px solid #4f46e5;
  outline-offset: -2px;
}

/* ── Suno team toggle ── */
.suno-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  /* #78350f on #fef3c7 → 7.3:1 ✓ */
  color: #78350f;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.suno-toggle input[type="checkbox"] {
  accent-color: #b45309;
  cursor: pointer;
}


/* ── Username badges ── */
/* Text color must be set by callers — ensure ≥4.5:1 on chosen bg */
.ubadge { padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 700; }

/* ── Smooth context reveal ── */
.context-body {
  overflow: hidden;
  transition: max-height 0.25s ease;
}

/* ── Chat sub-tabs ── */
.chat-sub-tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  /* #374151 on white → 10.7:1 ✓ */
  color: #374151;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.chat-sub-tab:hover { color: #111827; }
.chat-sub-tab.tab-active { color: #4338ca; border-bottom-color: #4338ca; }
.chat-sub-tab:focus-visible {
  outline: 3px solid #4f46e5;
  outline-offset: -1px;
  border-radius: 4px;
}

/* ── Chat bubbles ── */
/* user: white on #4338ca → 8.1:1 ✓ */
.chat-bubble-user {
  background: #4338ca;
  color: #fff;
  border-radius: 1rem 1rem 0.25rem 1rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  max-width: 80%;
  align-self: flex-end;
  white-space: pre-wrap;
  word-break: break-word;
}
/* assistant: #111827 on #f1f5f9 → 17.1:1 ✓ */
.chat-bubble-assistant {
  background: #f1f5f9;
  color: #111827;
  border-radius: 1rem 1rem 1rem 0.25rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  max-width: 90%;
  align-self: flex-start;
  word-break: break-word;
  border: 1px solid #cbd5e1;
}

/* ── Markdown renderer ─────────────────────────────────────── */
.markdown-body { line-height: 1.65; color: #111827; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child  { margin-bottom: 0; }
.markdown-body h1 { font-size: 1.2rem;  font-weight: 700; margin: 1rem 0 0.4rem; color: #111827; }
.markdown-body h2 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 0.35rem; border-bottom: 1px solid #d1d5db; padding-bottom: 0.2rem; color: #111827; }
.markdown-body h3 { font-size: 0.95rem; font-weight: 600; margin: 0.85rem 0 0.3rem; color: #111827; }
.markdown-body h4 { font-size: 0.875rem; font-weight: 600; margin: 0.75rem 0 0.25rem; color: #111827; }
.markdown-body p  { margin: 0 0 0.65rem; }
.markdown-body ul { list-style: disc;    margin: 0 0 0.65rem 1.35rem; }
.markdown-body ol { list-style: decimal; margin: 0 0 0.65rem 1.35rem; }
.markdown-body li { margin-bottom: 0.2rem; }
.markdown-body li > ul,
.markdown-body li > ol { margin-top: 0.2rem; margin-bottom: 0.2rem; }
.markdown-body blockquote {
  border-left: 3px solid #4338ca;
  margin: 0.65rem 0;
  padding: 0.35rem 0.85rem;
  background: #eef2ff;
  /* #1e1b4b on #eef2ff → 14.2:1 ✓ */
  color: #1e1b4b;
  font-style: italic;
  border-radius: 0 0.35rem 0.35rem 0;
}
.markdown-body code {
  background: #e2e8f0;
  /* #1e293b on #e2e8f0 → 10.2:1 ✓ */
  color: #1e293b;
  padding: 0.1em 0.4em;
  border-radius: 0.25rem;
  font-family: ui-monospace, monospace;
  font-size: 0.82em;
}
.markdown-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0 0 0.65rem;
}
.markdown-body pre code { background: none; padding: 0; font-size: 0.82em; color: inherit; }
.markdown-body strong { font-weight: 700; }
.markdown-body em     { font-style: italic; }
.markdown-body hr     { border: none; border-top: 1px solid #d1d5db; margin: 0.85rem 0; }
/* link: #3730a3 on white → 9.6:1 ✓ */
.markdown-body a      { color: #3730a3; text-decoration: underline; }
.markdown-body a:focus-visible { outline: 3px solid #4f46e5; outline-offset: 2px; border-radius: 2px; }
.markdown-body table  { border-collapse: collapse; width: 100%; margin-bottom: 0.65rem; font-size: 0.85rem; }
.markdown-body th,
.markdown-body td     { border: 1px solid #d1d5db; padding: 0.4rem 0.65rem; text-align: left; }
/* #111827 on #f1f5f9 → 17.1:1 ✓ */
.markdown-body th     { background: #f1f5f9; font-weight: 700; color: #111827; }
