/* ============================================
   Ana Chat Widget — Obsidian Gold (WhatsApp-style)
   ============================================ */

.ana-chat {
  /* Paleta unificada — laranja profundo do app */
  --ana-c1: #d68930;
  --ana-c2: #c8882e;
  --ana-c1-rgb: 214, 137, 48;
  --ana-c2-rgb: 200, 136, 46;
}

.ana-chat * { box-sizing: border-box; }

/* ── Launcher (bolha flutuante) ── */
.ana-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ana-c1) 0%, var(--ana-c2) 100%);
  border: none;
  cursor: pointer;
  z-index: 999999;
  box-shadow: 0 8px 24px rgba(var(--ana-c1-rgb), 0.4), 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  font-family: 'Outfit','Sora',system-ui,sans-serif;
}
.ana-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(var(--ana-c1-rgb), 0.55), 0 4px 12px rgba(0,0,0,0.35);
}
.ana-launcher svg {
  width: 32px;
  height: 32px;
  fill: #0c0c0f;
}
.ana-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  border: 2px solid #0c0c0f;
}

/* ── Janela do chat ── */
.ana-window {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: #0c0c0f;
  border: 1px solid rgba(var(--ana-c1-rgb), 0.25);
  border-radius: 18px;
  z-index: 999998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(var(--ana-c1-rgb),0.08);
  font-family: 'Outfit','Sora',system-ui,sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(.98);
  transition: opacity .25s ease, transform .25s ease;
}
.ana-window.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.ana-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #1a1a22 0%, #0c0c0f 100%);
  border-bottom: 1px solid rgba(var(--ana-c1-rgb),0.2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.ana-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ana-c1) 0%, var(--ana-c2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0c0c0f;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid rgba(var(--ana-c2-rgb), 0.4);
}
.ana-header-info {
  flex: 1;
  min-width: 0;
}
.ana-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 2px;
}
.ana-status {
  color: #8a8a98;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ana-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.ana-close {
  background: none;
  border: none;
  color: #8a8a98;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.ana-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.ana-close svg { width: 18px; height: 18px; }

/* ── Mensagens ── */
.ana-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(circle at 30% 20%, rgba(var(--ana-c1-rgb),0.04) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(var(--ana-c1-rgb),0.03) 0%, transparent 50%),
    #0c0c0f;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--ana-c1-rgb),0.3) transparent;
}
.ana-messages::-webkit-scrollbar { width: 6px; }
.ana-messages::-webkit-scrollbar-thumb {
  background: rgba(var(--ana-c1-rgb),0.3);
  border-radius: 3px;
}

.ana-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: anaBubbleIn .25s ease-out;
}
@keyframes anaBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ana-bubble a {
  color: var(--ana-c2);
  text-decoration: underline;
  word-break: break-all;
}
.ana-bubble.assistant {
  align-self: flex-start;
  background: #1a1a22;
  color: #e8e8f0;
  border: 1px solid rgba(var(--ana-c1-rgb),0.12);
  border-top-left-radius: 4px;
}
.ana-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(var(--ana-c1-rgb),0.22) 0%, rgba(var(--ana-c2-rgb),0.14) 100%);
  color: #fff;
  border: 1px solid rgba(var(--ana-c1-rgb),0.3);
  border-top-right-radius: 4px;
}
.ana-bubble-time {
  font-size: 10px;
  color: #6a6a78;
  margin-top: 4px;
  text-align: right;
}

/* ── Typing indicator ── */
.ana-typing {
  align-self: flex-start;
  background: #1a1a22;
  padding: 12px 16px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  border: 1px solid rgba(var(--ana-c1-rgb),0.12);
  display: flex;
  gap: 4px;
}
.ana-typing span {
  width: 8px;
  height: 8px;
  background: var(--ana-c1);
  border-radius: 50%;
  animation: anaDot 1.2s infinite ease-in-out;
}
.ana-typing span:nth-child(2) { animation-delay: .15s; }
.ana-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes anaDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Input ── */
.ana-input-wrap {
  padding: 12px 14px;
  background: #14141a;
  border-top: 1px solid rgba(var(--ana-c1-rgb),0.15);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ana-input {
  flex: 1;
  background: #0c0c0f;
  border: 1px solid rgba(var(--ana-c1-rgb),0.2);
  border-radius: 22px;
  padding: 11px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  outline: none;
  transition: border-color .15s;
}
.ana-input:focus { border-color: rgba(var(--ana-c1-rgb),0.5); }
.ana-input::placeholder { color: #5a5a68; }
.ana-send {
  background: linear-gradient(135deg, var(--ana-c1) 0%, var(--ana-c2) 100%);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
}
.ana-send:hover:not(:disabled) { transform: scale(1.06); }
.ana-send:disabled { opacity: 0.4; cursor: not-allowed; }
.ana-send svg { width: 20px; height: 20px; fill: #0c0c0f; }

/* ── Rodapé ── */
.ana-footer {
  padding: 6px 14px 10px;
  background: #14141a;
  text-align: center;
  font-size: 10.5px;
  color: #4a4a58;
  border-top: 1px solid rgba(var(--ana-c1-rgb),0.05);
}
.ana-footer strong { color: #8a8a98; font-weight: 600; }

/* ── Erro / aviso ── */
.ana-error {
  align-self: center;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  text-align: center;
  max-width: 90%;
}

/* ── Mobile ── */
@media (max-width: 500px) {
  .ana-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .ana-launcher { bottom: 16px; right: 16px; width: 58px; height: 58px; }
  .ana-launcher svg { width: 28px; height: 28px; }
}
