/* ==================== VS CODE DARK MODERN SYNTAX & SANDBOX RUNNER ==================== */
/* ==================== CODEBLOCK CONTAINER ==================== */

.code-block-container {
  margin: 14px 0;
  border-radius: var(--radius-md);
  background-color: #10131E;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background-color: rgba(19, 24, 38, 0.95);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  gap: 8px;
  flex-wrap: wrap;
}

.code-lang-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.code-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-code-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  min-width: 28px;
  width: auto;
  height: 26px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-code-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.code-block-container pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 480px;
  background: #0C0E17;
  border: none;
  max-width: 100%;
  box-sizing: border-box;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.code-block-container pre code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
}

/* ==================== OFFICIAL VS CODE DARK MODERN SYNTAX TOKENS (1:1) ==================== */
.token-keyword {
  color: #C586C0 !important; /* Control Flow Magenta */
  font-weight: 600;
}

.token-storage {
  color: #569CD6 !important; /* Declarations / Types Studio Blue */
  font-weight: 600;
}

.token-class,
.token-type,
.token-builtin {
  color: #4EC9B0 !important; /* Entity Teal */
  font-weight: 500;
}

.token-function {
  color: #DCDCAA !important; /* Method / Function Yellow */
  font-weight: 500;
}

.token-string {
  color: #CE9178 !important; /* Warm Terra Cotta / Orange */
}

.token-number {
  color: #B5CEA8 !important; /* Mint Green */
  font-weight: 500;
}

.token-comment {
  color: #6A9955 !important; /* Olive Green Italic */
  font-style: italic !important;
}

.token-decorator {
  color: #DCDCAA !important; /* Decorator Yellow */
  font-weight: 600;
}

.token-tag {
  color: #569CD6 !important; /* HTML/XML Tag Studio Blue */
  font-weight: 600;
}

.token-tag-bracket {
  color: #808080 !important; /* HTML/XML Tag Angle Brackets */
}

.token-attr {
  color: #9CDCFE !important; /* Attribute / Property Sky Blue */
}

.token-variable {
  color: #9CDCFE !important; /* Variable Sky Blue */
}

.token-constant {
  color: #4FC1FF !important; /* Constant / Language Literal Electric Blue */
  font-weight: 500;
}

.token-punctuation {
  color: #D4D4D4 !important; /* Delimiters / Punctuation Light */
}

.token-heading {
  color: #569CD6 !important; /* Markdown Headings */
  font-weight: 700;
}

.token-list-bullet {
  color: #9CDCFE !important; /* Markdown List Bullets */
  font-weight: 600;
}

/* GIT DIFF SYNTAX HIGHLIGHTING */
.diff-line {
  display: block;
  padding: 0 4px;
  font-family: var(--font-mono);
  border-radius: 2px;
}
.diff-line.diff-add {
  color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.12);
}
.diff-line.diff-del {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.12);
}
.diff-line.diff-info {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.08);
}


.code-block-container.collapsed pre {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  overflow: hidden;
}

.code-block-container.collapsed .code-block-header {
  border-bottom: none;
}

/* GROUNDED CITATION BADGES */
.citation-badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.citation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.citation-badge:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--primary);
}

/* SEARCH GROUNDING WEB LINKS */
.search-links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.search-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: #67e8f9;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.15s ease;
}

.search-link-pill:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

/* MESSAGE FOOTER & UNIFIED 1-FRAME META CAPSULE */
.message-meta {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important; /* Desktop: Ujung Kanan */
  width: 100% !important;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  isolation: isolate;
  clear: both;
}

.unified-meta-capsule {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 20px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  color: var(--text-dim) !important;
  font-family: var(--font-mono) !important;
  box-shadow: var(--shadow-sm) !important;
  max-width: 100% !important;
  white-space: nowrap !important;
}

.capsule-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.capsule-divider {
  color: rgba(255, 255, 255, 0.15) !important;
  font-size: 10px !important;
  user-select: none !important;
}

.capsule-cache.is-hit {
  color: var(--accent-green) !important;
  font-weight: 600 !important;
}

.capsule-cache.is-miss {
  color: var(--text-muted) !important;
}

@media (max-width: 768px) {
  .message-meta {
    justify-content: center !important; /* Mobile: Center */
    margin-top: 8px !important;
    padding-top: 6px !important;
  }
  .unified-meta-capsule {
    margin: 0 auto !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
}

.msg-actions {
  display: flex;
  gap: 4px;
}





/* ==================== INTERACTIVE CODE SANDBOX RUNNER ==================== */

.btn-code-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.2s ease;
}

.btn-code-run:hover {
  background: #22c55e;
  color: #000;
  box-shadow: none;
}

.code-output-terminal {
  background: #090a10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #a7f3d0;
  overflow-x: auto;
  animation: slashFadeIn 0.2s ease;
}

.code-output-terminal.error-output {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.sandbox-stdin-card {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sandbox-stdin-header {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sandbox-stdin-row {
  display: flex;
  gap: 6px;
}

.sandbox-stdin-input {
  flex: 1;
  background: #090a10;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}

.sandbox-stdin-input:focus {
  border-color: var(--primary);
}

.btn-stdin-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-stdin-submit:hover {
  background: var(--primary-hover);
}



.thinking-accordion {
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.thinking-accordion summary {
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(139, 92, 246, 0.08);
  transition: background 0.15s ease;
}

.thinking-accordion summary:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-bright);
}

.thinking-badge {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #c084fc;
}

.thinking-status {
  font-size: 11px;
  color: var(--text-dim);
}

.thinking-content {
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #94a3b8;
  border-top: 1px solid var(--border-color);
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--font-sans);
}





/* ==================== PYTHON SANDBOX & MATPLOTLIB AUTO-PLOT ==================== */

.btn-code-run-sandbox {
  background: rgba(30, 36, 52, 0.8) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 10px !important;
  height: 24px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.btn-code-run-sandbox:hover {
  background: rgba(45, 55, 80, 0.9) !important;
  border-color: var(--primary) !important;
}

.sandbox-terminal-output {
  margin-top: 2px;
  background: #090B12;
  border-top: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 12px;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #111420;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.terminal-status.status-ok { color: var(--accent-green); }
.terminal-status.status-err { color: #ef4444; }

.terminal-body {
  padding: 10px 14px;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.5;
}

.sandbox-plot-card {
  margin: 10px 12px 14px;
  background: #111420;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.plot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.btn-download-plot {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-download-plot:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--primary);
}

.sandbox-plot-img {
  width: 100%;
  max-width: 650px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.sandbox-plot-img:hover {
  transform: scale(1.01);
}

.plot-card-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
}

/* SPEAKER BUTTON ACTIVE ANIMATION */
.btn-bubble-speak.speaking {
  color: var(--primary) !important;
  animation: pulseSpeak 1.2s infinite ease-in-out;
}

@keyframes pulseSpeak {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}

