/* ── Antigravity Studio Chat Stream & Thinking Protocol ── */

.chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

/* User Message */
.chat-msg.user {
  align-self: flex-end;
  max-width: 82%;
  background: linear-gradient(135deg, #1b2236 0%, #141a29 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--r-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 14.5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  line-height: 1.55;
  word-break: break-word;
}

/* Assistant Message */
.chat-msg.assistant {
  align-self: flex-start;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistant-avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #06b6d4, #6366f1 60%, #a855f7);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.45);
  flex-shrink: 0;
}

.assistant-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.assistant-model-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Expandable Thinking Process Accordion ── */
.thinking-block {
  background: rgba(14, 18, 29, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.thinking-block summary {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  list-style: none;
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
  transition: background 0.15s ease;
}

.thinking-block summary:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.thinking-block summary::-webkit-details-marker {
  display: none;
}

.thinking-summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thinking-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 0 10px #818cf8;
  animation: pulseBrain 1.8s infinite ease-in-out;
}

@keyframes pulseBrain {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

.thinking-time-chip {
  font-size: 10.5px;
  color: var(--ink-muted);
  font-weight: 500;
  margin-left: 4px;
}

.thinking-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
}

.thinking-block[open] .thinking-chevron {
  transform: rotate(90deg);
}

.thinking-content {
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.65;
  border-top: 1px solid var(--border-hairline);
  background: rgba(5, 7, 12, 0.55);
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Antigravity Visual Tool Calling Cards ── */
.tool-call-card {
  background: #090c16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 6px 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

.tool-call-header {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.tool-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.tool-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--accent-emerald);
}

.tool-status-pill.running {
  color: var(--accent-amber);
}

.tool-call-body {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-secondary);
  border-top: 1px solid var(--border-hairline);
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  background: #05070e;
}

/* ── Inline Artifact Card in Chat ── */
.chat-artifact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.35);
  margin: 8px 0;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chat-artifact-card:hover {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(6, 182, 212, 0.1));
  transform: translateY(-1px);
}

.artifact-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.artifact-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.25);
  display: grid;
  place-items: center;
  color: #c7d2fe;
}

.artifact-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}

.artifact-card-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.artifact-card-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Assistant Message Body */
.msg-body {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-md);
  padding: 20px 24px;
  color: var(--ink-primary);
  font-size: 14.5px;
  line-height: 1.68;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.msg-body p {
  margin-bottom: 14px;
}

.msg-body p:last-child {
  margin-bottom: 0;
}

.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 {
  color: #fff;
  margin: 18px 0 10px;
  letter-spacing: -0.015em;
}

.msg-body h1 { font-size: 19px; }
.msg-body h2 { font-size: 16.5px; border-bottom: 1px solid var(--border-hairline); padding-bottom: 6px; }
.msg-body h3 { font-size: 15px; }

.msg-body ul, .msg-body ol {
  padding-left: 22px;
  margin-bottom: 14px;
}

.msg-body li {
  margin-bottom: 6px;
}

.msg-body blockquote {
  border-left: 3px solid var(--accent-indigo);
  padding: 6px 14px;
  margin: 12px 0;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 8px 8px 0;
  color: var(--ink-secondary);
}

.msg-body pre {
  background: #060810;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 14px 0;
  position: relative;
}

.msg-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c7d2fe;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* ── Modern Docked Input Deck & Slash Chips ── */
.chat-input-deck {
  flex-shrink: 0;
  padding: 10px 18px max(16px, env(safe-area-inset-bottom, 16px));
  background: var(--bg-main);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 12;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
}

/* Quick Action Suggestion Chips */
.quick-action-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 4px;
  scrollbar-width: none;
}

.quick-action-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: rgba(18, 22, 35, 0.9);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  backdrop-filter: blur(12px);
}

.chip-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  color: #fff;
}

/* Slash Popover */
.slash-popover {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 440px;
  backdrop-filter: var(--blur-glass);
}

.slash-item {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.12s ease;
}

.slash-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.slash-item strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
}

.slash-item span {
  font-size: 12px;
  color: var(--ink-secondary);
}

/* Floating Input Box */
.input-card {
  background: #121522;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 12px 16px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.input-card:focus-within {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 1px var(--accent-indigo), 0 16px 48px rgba(0, 0, 0, 0.85);
}

.input-card textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14.5px;
  resize: none;
  line-height: 1.5;
  max-height: 140px;
}

.input-card textarea::placeholder {
  color: var(--ink-muted);
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--border-hairline);
}

.input-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-tool-btn {
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.composer-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.composer-tool-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.6);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
