/* ============================================================================
   Capi Când-IA Pro — Chat Bubble (Fase 2)
   Mensagens user (right, gold-dim) + assistant (left, sem bubble).
   Actions no hover: copy, regenerate, edit, share.
   ============================================================================ */

.ds-msg {
  display: flex;
  gap: 14px;
  max-width: 780px;
  width: 100%;
}

.ds-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ds-msg-assistant {
  align-self: flex-start;
}

/* Avatar (32px) */
.ds-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--ds-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ds-msg-user .ds-msg-avatar {
  background: var(--ds-gold-dim);
  border: 1px solid var(--ds-gold-border);
  color: var(--ds-gold);
  font-family: var(--ds-font-display);
  font-weight: 700;
  font-size: 12px;
}

.ds-msg-assistant .ds-msg-avatar {
  background: radial-gradient(circle, var(--ds-gold) 0%, #8B6914 100%);
  box-shadow: 0 0 16px rgba(212,160,23,0.30);
  border: 1px solid rgba(212,160,23,0.45);
}

.ds-msg-assistant .ds-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Body (conteúdo + actions) */
.ds-msg-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

/* Bubble user (gold-dim com border) */
.ds-msg-user .ds-msg-bubble {
  background: var(--ds-gold-dim);
  border: 1px solid rgba(212,160,23,0.20);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--ds-text);
  font-family: var(--ds-font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  align-self: flex-end;
  max-width: 100%;
}

/* Bubble assistant (sem bubble, texto direto sobre dark) */
.ds-msg-assistant .ds-msg-bubble {
  color: #e8e6e3;
  font-family: var(--ds-font-sans);
  font-size: 14.5px;
  line-height: 1.7;
  padding: 2px 0;
  background: transparent;
}

.ds-msg-assistant .ds-msg-bubble strong {
  color: var(--ds-gold);
  font-weight: 600;
}

.ds-msg-assistant .ds-msg-bubble em {
  font-style: italic;
  opacity: 0.9;
}

.ds-msg-assistant .ds-msg-bubble ul,
.ds-msg-assistant .ds-msg-bubble ol {
  margin: 8px 0 8px 22px;
}

.ds-msg-assistant .ds-msg-bubble li {
  margin-bottom: 4px;
}

.ds-msg-assistant .ds-msg-bubble p {
  margin: 0 0 12px;
}

.ds-msg-assistant .ds-msg-bubble p:last-child {
  margin-bottom: 0;
}

.ds-msg-assistant .ds-msg-bubble a {
  color: var(--ds-gold);
  text-decoration: none;
  border-bottom: 1px dotted rgba(212,160,23,0.45);
}

.ds-msg-assistant .ds-msg-bubble a:hover {
  border-bottom-style: solid;
}

/* Ações que aparecem no hover */
.ds-msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ds-msg:hover .ds-msg-actions {
  opacity: 1;
}

.ds-msg-action-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--ds-text-muted);
  padding: 5px 9px;
  border-radius: var(--ds-radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--ds-font-sans);
  transition: all 0.12s ease;
}

.ds-msg-action-btn svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
}

.ds-msg-action-btn:hover {
  border-color: rgba(255,255,255,0.18);
  color: var(--ds-text);
  background: rgba(255,255,255,0.03);
}

.ds-msg-action-btn-danger:hover {
  color: var(--ds-error);
  border-color: rgba(248,113,113,0.30);
}

/* Streaming indicator (cursor piscando no fim) */
.ds-msg-streaming::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--ds-gold);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: ds-msg-blink 1s infinite;
  border-radius: 1px;
}

@keyframes ds-msg-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Mobile */
@media (max-width: 600px) {
  .ds-msg { gap: 10px }
  .ds-msg-avatar { width: 28px; height: 28px }
  .ds-msg-user .ds-msg-avatar { font-size: 11px }
  .ds-msg-user .ds-msg-bubble,
  .ds-msg-assistant .ds-msg-bubble { font-size: 14px }
}
