/* ==================== MARKDOWN GFM TABLES, ADMONITIONS, CITATIONS ==================== */
/* ==================== MARKDOWN LINKS ==================== */

.message-content a,
.doc-reader-body a,
.citation-snippet-content a,
a.markdown-link {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.15s ease;
}

.message-content a:hover,
.doc-reader-body a:hover,
.citation-snippet-content a:hover,
a.markdown-link:hover {
  color: #7dd3fc;
}

/* ANTI-PHISHING SUSPICIOUS LINK BADGE */
a.markdown-link.link-suspicious {
  color: #fbbf24 !important;
  text-decoration-style: dashed !important;
}
a.markdown-link.link-suspicious::after {
  content: " ⚠️";
  font-size: 0.85em;
}

/* ==================== GLOBAL MEDIA DIMENSION CONTAINMENT ==================== */
.message-content img,
.message-content img.markdown-image,
.message-content svg.markdown-svg-inline,
.message-content svg:not(.mermaid-diagram-card svg):not(.katex svg):not(.svg-inline--fa),
.doc-reader-body img,
.doc-reader-body svg:not(.svg-inline--fa),
.citation-snippet-content img {
  max-width: 100% !important;
  max-height: 450px !important;
  height: auto !important;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin: 10px 0;
  box-sizing: border-box;
}

.message-content video,
.message-content canvas,
.message-content iframe:not(.artifact-preview-frame) {
  max-width: 100% !important;
  max-height: 450px !important;
  height: auto !important;
  object-fit: contain;
  box-sizing: border-box;
}

.message-content img[alt] {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}



/* ==================== MARKDOWN TABLES (ANTIGRAVITY THEME & MOBILE SCROLL) ==================== */

.markdown-table-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: #1a1a1a;
  box-sizing: border-box;
  scrollbar-width: thin;
}

.markdown-table-wrapper::-webkit-scrollbar {
  height: 6px;
}
.markdown-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.markdown-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.markdown-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.message-content table,
table.markdown-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  margin: 0;
  background-color: transparent;
  border: none;
  table-layout: auto;
}

.message-content th,
table.markdown-table th {
  background-color: #282828;
  color: #FFFFFF;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid var(--border-input);
  text-align: left;
  white-space: nowrap;
  min-width: 160px;
}

.message-content td,
table.markdown-table td {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
  min-width: 180px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.message-content td a,
table.markdown-table td a {
  white-space: nowrap !important;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.message-content tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.message-content tr:hover {
  background-color: rgba(255, 255, 255, 0.04);
}



/* ==================== TASK LIST CHECKBOXES FIX ==================== */

.message-content li:has(> input[type="checkbox"]) {
  list-style: none !important;
  margin: 4px 0;
  display: block;
}

.message-content li:has(> input[type="checkbox"]) input[type="checkbox"],
.message-content input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  cursor: pointer;
}





/* ==================== NUMBERED MICRO-PILLS CITATION ==================== */

.citation-badges-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.citation-badge-micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.citation-badge-micro:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px) scale(1.08);
}



/* ==================== CITATION SOURCE INSPECTOR ==================== */

.modal-citation-card {
  width: 640px;
  max-width: 95vw;
}

.citation-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.citation-snippet-box {
  background: rgba(11, 13, 20, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.snippet-header {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.citation-snippet-content {
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-main);
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.citation-snippet-content mark {
  background: rgba(234, 179, 8, 0.28);
  color: #fef08a;
  border-bottom: 2px solid #eab308;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}





/* ==================== ARTIFACTS / LIVE CANVAS PREVIEWER ==================== */

.code-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.artifact-tabs-group {
  display: inline-flex;
  align-items: center;
  background: rgba(16, 21, 34, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.btn-artifact-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-artifact-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-artifact-tab.active {
  background: var(--primary);
  color: #FFFFFF;
}

.artifact-preview-frame {
  width: 100%;
  min-height: 380px;
  border: none;
  background: #FFFFFF;
  display: block;
}





/* ==================== FOOTNOTES STYLING ==================== */
.footnote-ref {
  font-size: 0.78em;
  font-weight: 700;
  vertical-align: super;
  margin-left: 2px;
  line-height: 0;
}

.footnote-link {
  color: var(--primary) !important;
  text-decoration: none !important;
  padding: 0 2px;
  border-radius: 2px;
}

.footnote-link:hover {
  text-decoration: underline !important;
  color: var(--accent-cyan) !important;
  background: rgba(99, 102, 241, 0.15);
}

.footnotes-section {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 13px;
  color: var(--text-muted);
}

.footnotes-heading {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footnotes-list {
  padding-left: 22px;
  margin: 0;
}

.footnote-item {
  margin-bottom: 6px;
  line-height: 1.55;
  color: var(--text-main);
}

.footnote-backref {
  color: var(--primary) !important;
  text-decoration: none !important;
  font-weight: 700;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 3px;
}

.footnote-backref:hover {
  color: var(--accent-cyan) !important;
  background: rgba(99, 102, 241, 0.15);
}



/* ==================== GFM ADMONITIONS / CALLOUT BANNERS ==================== */
.markdown-callout {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-sm);
}

.markdown-callout p {
  margin: 4px 0;
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.callout-note {
  border-left-color: #0078D4 !important;
  background: rgba(0, 120, 212, 0.08) !important;
}
.callout-note .callout-header {
  color: #58a6ff;
}

.callout-tip {
  border-left-color: #238636 !important;
  background: rgba(35, 134, 54, 0.08) !important;
}
.callout-tip .callout-header {
  color: #3fb950;
}

.callout-important {
  border-left-color: #8957e5 !important;
  background: rgba(137, 87, 229, 0.08) !important;
}
.callout-important .callout-header {
  color: #a371f7;
}

.callout-warning {
  border-left-color: #d29922 !important;
  background: rgba(210, 153, 34, 0.08) !important;
}
.callout-warning .callout-header {
  color: #d29922;
}

.callout-caution {
  border-left-color: #da3633 !important;
  background: rgba(218, 54, 51, 0.08) !important;
}
.callout-caution .callout-header {
  color: #f85149;
}

/* ==================== AGENTIC TOOL ACTIVITY PILLS ==================== */
.tool-activity-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.tool-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color, #333333);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary, #cccccc);
  width: fit-content;
  max-width: 100%;
  transition: all 0.2s ease;
}

.tool-call-pill.running {
  border-color: rgba(0, 120, 212, 0.4);
  background: rgba(0, 120, 212, 0.08);
  color: #58a6ff;
}

.tool-call-pill.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
}

.tool-call-pill.failed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

.tool-call-pill .tool-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(0, 120, 212, 0.2);
  border-top-color: var(--primary, #0078D4);
  border-radius: 50%;
  animation: toolSpin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes toolSpin {
  to { transform: rotate(360deg); }
}

.text-green {
  color: #4ade80 !important;
}

.text-red {
  color: #f87171 !important;
}


