/* ============================================
   BOTICA AI — CHAT CSS
   Messages, welcome, suggestion cards, typing
   ============================================ */

/* ---- Inline links in chat messages ---- */
.message-text a,
.message-text .inline-link {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 500;
  word-break: break-all;
  cursor: pointer;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.message-text a:hover,
.message-text .inline-link:hover {
  opacity: 0.75;
  text-decoration-thickness: 2px;
}

/* ---- Suggested questions (Botica / רוני) ---- */
.suggested-questions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.suggested-questions-label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.suggested-questions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggested-questions-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.suggested-questions-links li {
  display: inline;
}

.suggested-question-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.suggested-question-link:hover {
  text-decoration: underline;
  border-bottom-color: var(--color-primary);
}

.suggested-question-chip {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  background: var(--color-primary-10);
  color: var(--color-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.suggested-question-chip:hover {
  background: var(--color-primary);
  color: white;
}

/* ---- Header / Topbar (Botica Workspace) ---- */
.header {
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(240, 243, 250, 0.88);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: background .25s, border-color .25s;
}
body.dark .header {
  background: rgba(12, 17, 32, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.mode-badge.general {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success-dark);
}

.mode-badge.botica {
  background: var(--color-primary-10);
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Welcome Card (Botica Workspace) ---- */
.welcome-card {
  background: transparent;
  border: none;
  padding: 40px 24px 0;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: none;
}

.welcome-icon {
  width: 68px;
  height: 68px;
  background: var(--gradient-primary);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  box-shadow: 0 8px 28px var(--color-primary-glow), 0 2px 8px rgba(53, 88, 240, 0.18);
  position: relative;
}
.welcome-icon::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 32px;
  background: radial-gradient(circle, rgba(53, 88, 240, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.welcome-icon .material-icons {
  font-size: 32px;
  color: white;
}

.welcome-icon img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
}

.welcome-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 14.5px;
  color: var(--color-text-secondary);
  margin: 0 auto 36px;
  max-width: 420px;
  line-height: 1.7;
  font-weight: 400;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0;
}

.suggestion-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .18s, background .25s;
  text-align: start;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.suggestion-card:hover {
  background: var(--color-surface);
  border-color: rgba(53, 88, 240, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(53, 88, 240, 0.1), 0 2px 8px rgba(53, 88, 240, 0.06);
}

.suggestion-icon {
  width: 38px;
  height: 38px;
  background: var(--color-primary-10);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
}

.suggestion-icon .material-icons {
  font-size: 18px;
  color: var(--color-primary);
}

.suggestion-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0;
  width: 100%;
}

.suggestion-description {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

/* ---- Messages ---- */
.messages-container {
  max-width: 900px;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  animation: screenFadeIn 0.3s var(--ease-smooth);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-primary-sm);
}

.bot-message .message-avatar {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
}

.message-avatar .material-icons {
  font-size: 22px;
  color: white;
}

.bot-message .message-avatar .material-icons {
  color: var(--color-primary);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.message-sender {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
}

.message-time {
  font-size: 12px;
  color: var(--color-text-muted);
}

.message-badge {
  background: var(--gradient-primary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.message-text {
  background: var(--color-surface);
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  line-height: 1.7;
  color: var(--color-text-body);
  font-size: 14px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.user-message .message-text {
  background: var(--gradient-primary);
  border: none;
  color: white;
  box-shadow: var(--shadow-primary-sm);
}

/* Message image */
.message-image {
  max-width: 300px;
  max-height: 200px;
  border-radius: var(--radius-lg);
  margin-top: 8px;
  object-fit: cover;
}

/* Wrapper for multiple attachments in a single user message */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-attachments .message-image {
  margin-top: 0;
}

/* Message actions */
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-base);
  font-family: inherit;
}

.message-action-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.message-action-btn .material-icons {
  font-size: 14px;
}

/* ---- File Card in message ---- */
.file-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.file-card:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.file-icon-large {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-primary-sm);
  flex-shrink: 0;
}

.file-icon-large .material-icons {
  font-size: 26px;
  color: white;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* ---- Typing Indicator ---- */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 4px;
}

.typing-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 6px var(--color-primary-glow);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
  0%, 55%, 100% { transform: translateY(0);    opacity: 0.4; }
  27%            { transform: translateY(-8px); opacity: 1;   }
}

/* Status label alongside dots */
.typing-status {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.typing-status:not(:empty) { opacity: 0.8; }

/* Blinking cursor during streaming */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-primary);
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 0.9s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ---- MCP Deep-Thinking Bubble ---- */
.mcp-thinking-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}

.mcp-thinking-sonar {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mcp-thinking-ring {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: mcp-sonar 2.4s ease-out infinite;
}
.mcp-thinking-ring:nth-child(2) { animation-delay: 0.8s; }
.mcp-thinking-ring:nth-child(3) { animation-delay: 1.6s; }

@keyframes mcp-sonar {
  0%   { transform: scale(0.3); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0;   }
}

.mcp-thinking-icon {
  font-size: 22px;
  color: var(--color-primary);
  animation: mcp-pulse 1.8s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes mcp-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

.mcp-thinking-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.mcp-thinking-phase {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
  animation: mcp-fade-in 0.35s ease;
}

@keyframes mcp-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ---- Error message ---- */
.error-message .message-text {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-error);
}

.retry-btn {
  background: none;
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  margin-top: 8px;
  transition: all var(--transition-base);
  font-family: inherit;
}

.retry-btn:hover {
  background: rgba(239, 68, 68, 0.05);
}

/* ---- Input Area (Botica Workspace design) ---- */
.input-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 24px 22px;
  border-top: none;
  background: linear-gradient(to top, var(--color-bg) 65%, transparent);
  flex-shrink: 0;
  pointer-events: none;
  transition: background .25s;
}
body.dark .input-area {
  background: linear-gradient(to top, #0C1120 65%, transparent);
}
.input-area > * { pointer-events: auto; }
.input-inner { max-width: 720px; margin: 0 auto; pointer-events: auto; }

/* ──────────────────────────────────────────────────────────────────
   Botica Workspace input box (matches design_handoff_botica_workspace)
   Single card: row (textarea + tools + send) + footer (hint + chips)
   ────────────────────────────────────────────────────────────────── */
.input-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s, background .25s;
}
.input-box:focus-within {
  border-color: rgba(53, 88, 240, 0.30);
  box-shadow: 0 4px 22px rgba(53, 88, 240, 0.10), 0 2px 8px rgba(53, 88, 240, 0.06);
}

.input-row {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  gap: 8px;
}

/* Tool buttons (attach/image/doc/mic) — left side of input row, 28×28, transparent */
.input-tools { display: flex; gap: 3px; align-items: center; flex-shrink: 0; border-right: 1px solid var(--color-border); padding-right: 8px; margin-right: 4px; }
.it-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: var(--color-text-muted);
  border-radius: 7px;
  transition: all .12s;
  padding: 0;
}
.it-btn:hover { background: var(--color-bg); color: var(--color-text-secondary); }
.it-btn .material-icons { font-size: 16px; }
.it-btn.active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border-radius: var(--radius-sm);
}
.it-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* ── Image generation mode indicator bar ───────────────────────────────── */
.image-mode-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
}
.image-mode-cancel {
  margin-inline-start: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.image-mode-cancel:hover { color: var(--color-text); }

/* Input footer: hint on one side + chip group on the other */
.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 11px;
  border-top: 1px solid var(--color-border);
}
.if-hint {
  font-size: 10.5px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.if-hint .material-icons { font-size: 11px; }
.if-chips { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

/* Each chip-wrap anchors its dropdown (position:absolute) above the trigger */
.chip-wrap { position: relative; display: inline-flex; }

/* Chips */
.chip, .chip-wrap > button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3.5px 9px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
  font-family: inherit;
  line-height: 1.4;
}
.chip:hover, .chip-wrap > button:hover {
  border-color: rgba(53, 88, 240, 0.25);
  color: var(--color-primary);
}
.chip.active {
  background: rgba(53, 88, 240, 0.10);
  border-color: rgba(53, 88, 240, 0.28);
  color: var(--color-primary);
  font-weight: 500;
}
body.dark .chip.active {
  background: rgba(53, 88, 240, 0.20);
  border-color: rgba(53, 88, 240, 0.40);
  color: #7EA8FF;
}
.chip .material-icons { font-size: 12px; }
.chip-live {
  width: 5px;
  height: 5px;
  background: #22C773;
  border-radius: 50%;
  flex-shrink: 0;
}

.attachment-preview-bar {
  max-width: 900px;
  margin: 0 auto 12px;
}

.attachment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  max-width: 320px;
}

.attachment-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.attachment-file-icon {
  color: var(--color-primary);
  font-size: 22px;
}

.attachment-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.attachment-size {
  font-size: 11px;
  color: var(--color-text-muted);
}

.attachment-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}

.attachment-remove:hover {
  color: var(--color-error);
}

.attachment-remove .material-icons {
  font-size: 18px;
}

/* .mode-btn is an alias for .chip — all visual styling comes from .chip /
   .chip.active. The .chip-live green dot is rendered only for the currently
   active mode button (the others have no .chip-live element in the DOM). */

/* Legacy wrappers kept for backwards-compat with non-chat screens */
.input-container { display: flex; gap: 12px; align-items: flex-end; max-width: 720px; margin: 0 auto; }

.input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 14px;
  resize: none;
  font-family: inherit;
  min-height: 22px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
  direction: rtl;
  text-align: right;
}
.input-field::placeholder { color: var(--color-text-muted); }

.input-icon:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg);
}

.input-icon.active {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
  animation: pulse 1s infinite;
}

.send-btn {
  background: var(--color-primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .14s, box-shadow .14s, transform .12s;
  box-shadow: var(--shadow-primary-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.06);
  box-shadow: var(--shadow-primary-md);
}

.send-btn:active {
  transform: scale(0.97);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.send-btn .material-icons {
  font-size: 15px;
}

/* Markdown rendered content */
.bot-message .message-text h1,
.bot-message .message-text h2,
.bot-message .message-text h3 {
  color: var(--color-text);
  margin: 16px 0 8px;
  line-height: 1.3;
}
.bot-message .message-text h1 { font-size: 20px; }
.bot-message .message-text h2 { font-size: 17px; }
.bot-message .message-text h3 { font-size: 15px; }

.bot-message .message-text ul,
.bot-message .message-text ol {
  padding-right: 20px;
  margin: 8px 0;
}

.bot-message .message-text li {
  margin-bottom: 4px;
}

.bot-message .message-text p {
  margin: 0 0 10px;
}
.bot-message .message-text p:last-child { margin-bottom: 0; }

.bot-message .message-text strong {
  font-weight: 700;
  color: var(--color-text);
}

.bot-message .message-text code.inline-code {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: 'Courier New', Courier, monospace;
  color: var(--color-primary);
}

/* ── Markdown + HTML tables ────────────────────────────────────────────── */
.bot-message .message-text table.md-table,
.bot-message .message-text table:not([class]) {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13.5px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.bot-message .message-text table.md-table th,
.bot-message .message-text table.md-table td,
.bot-message .message-text table:not([class]) th,
.bot-message .message-text table:not([class]) td {
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  text-align: start;
  vertical-align: top;
  line-height: 1.5;
}
.bot-message .message-text table.md-table th,
.bot-message .message-text table:not([class]) th {
  background: var(--color-surface-hover, rgba(255,255,255,0.06));
  font-weight: 600;
  color: var(--color-text);
}
.bot-message .message-text table.md-table tr:nth-child(even) td,
.bot-message .message-text table:not([class]) tr:nth-child(even) td {
  background: var(--color-surface-hover, rgba(255,255,255,0.02));
}
.bot-message .message-text table.md-table td,
.bot-message .message-text table:not([class]) td {
  color: var(--color-text-secondary);
}

.code-block {
  background: #1e293b;
  border-radius: var(--radius-lg);
  margin: 12px 0;
  overflow: hidden;
}

.code-lang {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  font-size: 11px;
  padding: 6px 14px;
  font-family: monospace;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  color: #e2e8f0;
  font-size: 13px;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ==============================
   Model Selector (input bar)
   ============================== */
.model-selector-wrap {
  position: relative;
  flex-shrink: 0;
}

.model-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all var(--transition-base);
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}
.model-trigger-icon, .mcp-trigger-icon { font-size: 14px; }
.model-trigger-caret { font-size: 14px; }

.model-trigger-btn:hover,
.model-trigger-btn.open {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-05);
}

.model-trigger-icon {
  font-size: 15px;
}

.model-trigger-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--color-primary-10);
  color: var(--color-primary);
  letter-spacing: 0.3px;
}

.model-trigger-caret {
  font-size: 16px;
  transition: transform var(--transition-fast);
}

.model-trigger-btn.open .model-trigger-caret {
  transform: rotate(180deg);
}

/* Dropdown panel — opens upward so it is not cut off at bottom of viewport */
.model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  top: auto;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  z-index: 300;
  animation: fadeInUp 0.15s var(--ease-smooth);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.model-dropdown-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  padding: 12px 16px 6px;
}

.model-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  direction: inherit;
  transition: background var(--transition-fast);
}

.model-option:hover {
  background: var(--color-hover-bg);
}

.model-option.active {
  background: var(--color-primary-05);
}

.model-option-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-option-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--color-primary-10);
  color: var(--color-primary);
  white-space: nowrap;
}

.model-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.model-option-preview {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
  font-weight: 600;
}

.model-option-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  padding-right: 2px;
}

.model-option:not(:last-child) {
  border-bottom: 1px solid var(--color-border);
}

/* ==============================
   MCP Selector (input bar)
   ============================== */
.mcp-selector-wrap {
  position: relative;
  flex-shrink: 0;
}

.mcp-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all var(--transition-base);
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}

.mcp-trigger-btn:hover,
.mcp-trigger-btn.open {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-05);
}

.mcp-trigger-btn--active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-10);
}

.mcp-trigger-icon {
  font-size: 15px;
}

.mcp-trigger-count {
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  padding: 0 5px;
}

.mcp-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  top: auto;
  min-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  z-index: 300;
  animation: fadeInUp 0.15s var(--ease-smooth);
}

.mcp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: start;
  direction: inherit;
  transition: background var(--transition-fast);
}

.mcp-option:last-child { border-bottom: none; }

.mcp-option:hover { background: var(--color-hover-bg); }

.mcp-option--active { background: var(--color-primary-05); }

.mcp-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.mcp-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-option-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-tool-count {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--color-primary-10);
  color: var(--color-primary);
  white-space: nowrap;
}

/* ==============================
   Settings – Model cards
   ============================== */
.settings-model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 420px;
}

.settings-model-card {
  display: block;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--color-surface);
}

.settings-model-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-05);
}

.settings-model-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-05);
  box-shadow: 0 0 0 3px var(--color-primary-10);
}

.settings-model-card-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-model-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-model-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.settings-model-desc {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ==============================
   Sources Panel
   ============================== */
.sources-panel {
  margin: 12px 0 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg);
}

/* Toggle button */
.sources-toggle-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-family: inherit;
  text-align: start;
  direction: inherit;
  transition: background var(--transition-fast);
}

.sources-toggle-btn:hover {
  background: var(--color-hover-bg);
  color: var(--color-primary);
}

.sources-toggle-btn .material-icons:first-child {
  font-size: 17px;
  color: var(--color-primary);
}

.sources-caret {
  margin-right: auto;
  font-size: 18px !important;
  transition: transform var(--transition-fast);
}

/* Collapsible body */
.sources-body {
  display: none;
  padding: 0 10px 10px;
  flex-direction: column;
  gap: 6px;
}

.sources-body.open {
  display: flex;
}

/* Individual source card */
.source-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  transition: box-shadow var(--transition-fast);
}

.source-card:hover {
  box-shadow: var(--shadow-sm);
}

.source-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  direction: inherit;
  user-select: none;
  transition: background var(--transition-fast);
}

.source-card-header:hover {
  background: var(--color-hover-bg);
}

.source-index {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary-10);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-page {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-hover-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.source-score {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--color-success-dark);
  font-family: monospace;
  background: var(--color-success-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.source-expand-icon {
  flex-shrink: 0;
  font-size: 18px !important;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

/* Expanded state */
.source-card-body {
  display: none;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--color-border);
  direction: inherit;
}

.source-card.expanded .source-card-body {
  display: block;
}

.source-card.expanded .source-expand-icon {
  transform: rotate(-90deg);
}

.source-snippet {
  font-size: 12px;
  line-height: 1.7;
  color: var(--color-text-body);
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.source-url {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-05);
  border: 1px solid var(--color-primary-10);
  transition: all var(--transition-fast);
}

.source-url:hover {
  background: var(--color-primary-10);
  text-decoration: none;
}

.source-url .material-icons {
  font-size: 14px;
}
