/* ─── OAA Agente AI — Widget de Chat ───────────────────── */

/* ─── Botão flutuante ────────────────────────────────── */
#oaa-chat-trigger {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 1050;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--grad);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 30px 90px -30px oklch(0.74 0.085 158 / 0.42);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
#oaa-chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 30px 90px -30px oklch(0.74 0.085 158 / 0.42),
    0 0 0 1px var(--red);
}
#oaa-chat-trigger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
#oaa-chat-trigger svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
#oaa-chat-trigger .icon-close {
  display: none;
}
#oaa-chat-trigger.open .icon-chat {
  display: none;
}
#oaa-chat-trigger.open .icon-close {
  display: block;
}

/* Badge de notificação */
#oaa-chat-trigger .oaa-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--magenta);
  border: 2px solid var(--bg);
  display: none;
}
#oaa-chat-trigger .oaa-badge.show {
  display: block;
}

/* ─── Painel de chat ─────────────────────────────────── */
#oaa-chat-panel {
  position: fixed;
  bottom: 96px;
  left: 28px;
  z-index: 1049;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 60px -24px oklch(0 0 0 / 0.7),
    0 30px 90px -30px oklch(0.74 0.085 158 / 0.42);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#oaa-chat-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.oaa-chat-header {
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.oaa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.oaa-header-info {
  flex: 1;
  min-width: 0;
}
.oaa-header-name {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.oaa-header-status {
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.oaa-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(0.74 0.12 145);
  flex-shrink: 0;
}
.oaa-header-logo {
  height: 18px;
  width: auto;
  flex-shrink: 0;
}
.oaa-header-logo .lk { fill: var(--ink); }
.oaa-header-logo .dot { fill: var(--red); }

/* Área de mensagens */
.oaa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.oaa-messages::-webkit-scrollbar {
  width: 4px;
}
.oaa-messages::-webkit-scrollbar-track {
  background: transparent;
}
.oaa-messages::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

/* Mensagens */
.oaa-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: oaa-msg-in 0.2s ease;
}
@keyframes oaa-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.oaa-msg.user  { align-self: flex-end;  align-items: flex-end; }
.oaa-msg.agent { align-self: flex-start; align-items: flex-start; }

.oaa-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
  font-family: var(--ff-body);
}
.oaa-msg.user .oaa-bubble {
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.oaa-msg.agent .oaa-bubble {
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.oaa-bubble a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.oaa-msg.user .oaa-bubble a {
  color: #fff;
}
.oaa-msg-time {
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 4px;
  padding: 0 2px;
  font-family: var(--ff-mono);
}

/* Typing indicator */
.oaa-typing .oaa-bubble {
  padding: 12px 16px;
}
.oaa-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.oaa-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: oaa-dot 1.2s infinite;
}
.oaa-dots span:nth-child(2) { animation-delay: 0.2s; }
.oaa-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes oaa-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Sugestões rápidas */
.oaa-suggestions {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.oaa-suggestion-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--ff-body);
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.oaa-suggestion-btn:hover {
  background: oklch(0.74 0.085 158 / 0.15);
  border-color: var(--red);
  color: var(--red);
}

/* Input */
.oaa-chat-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}
.oaa-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.oaa-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 13.5px;
  padding: 9px 13px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.5;
}
.oaa-input::placeholder {
  color: var(--ink-3);
}
.oaa-input:focus {
  border-color: var(--red);
}
.oaa-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--grad);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.oaa-send-btn:hover:not(:disabled) {
  opacity: 0.85;
  transform: scale(1.05);
}
.oaa-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.oaa-send-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.oaa-send-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}
.oaa-footer-note {
  text-align: center;
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 8px;
  letter-spacing: 0.04em;
  font-family: var(--ff-mono);
}
