/* ============================================================
   OLLI — Widget de qualificação de leads
   100% herdado do design system (style.css): cores, fonte, easings,
   pill radius e o mesmo "glass" usado no modal de diagnóstico.
   ============================================================ */

/* ── Avatar flutuante (FAB) ── */
.olli-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 9600;
  width: 64px;
  height: 64px;
  opacity: 0;
  transform: translateY(40px) scale(0.6);
  transition: opacity 0.7s var(--ease-expo), transform 0.7s var(--ease-expo);
  cursor: pointer;
}
.olli-fab.is-in { opacity: 1; transform: translateY(0) scale(1); }

.olli-fab__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0.5;
  animation: olli-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

.olli-fab__inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: olli-float 3.6s ease-in-out infinite;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.olli-fab:hover .olli-fab__inner {
  border-color: var(--accent);
  box-shadow: 0 14px 44px var(--accent-glow);
  transform: scale(1.06);
}
.olli-fab__inner img { width: 72%; height: 72%; object-fit: contain; }

@keyframes olli-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
@keyframes olli-pulse {
  0% { transform: scale(0.9); opacity: 0.45; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* ── Balão de fala ── */
.olli-bubble {
  position: fixed;
  right: 1.5rem;
  bottom: 6.35rem;
  z-index: 9600;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 1rem 1.6rem 1rem 1.15rem;
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-expo), transform 0.45s var(--ease-expo);
  cursor: pointer;
}
.olli-bubble.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.olli-bubble::after {
  content: '';
  position: absolute;
  right: 26px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-right: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  transform: rotate(45deg);
}
.olli-bubble p { font-size: 0.84rem; line-height: 1.45; color: var(--text); }
.olli-bubble__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: color var(--t), background var(--t);
}
.olli-bubble__close:hover { color: var(--text); background: var(--surface-2); }

/* ── Modo Zen: overlay de vidro escuro (mesma receita do modal de diagnóstico) ── */
.olli-overlay {
  position: fixed;
  inset: 0;
  z-index: 99980;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1.5rem;
}
.olli-overlay.active { opacity: 1; pointer-events: auto; }

/* ── Janela de chat ── */
.olli-chat {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 640px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(28px) scale(0.97);
  opacity: 0;
  transition: transform 0.5s var(--ease-expo), opacity 0.4s ease;
}
.olli-overlay.active .olli-chat { transform: translateY(0) scale(1); opacity: 1; }
.olli-chat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.olli-chat__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.olli-chat__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.olli-chat__avatar img { width: 76%; height: 76%; object-fit: contain; }
.olli-chat__id { flex: 1; min-width: 0; }
.olli-chat__name { font-size: 0.9rem; font-weight: 700; }
.olli-chat__status {
  font-size: 0.72rem; color: var(--accent);
  display: flex; align-items: center; gap: 0.35rem;
}
.olli-chat__status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 6px var(--accent-glow);
}
.olli-chat__close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid var(--border-2);
  transition: color var(--t), border-color var(--t);
  flex-shrink: 0;
}
.olli-chat__close:hover { color: var(--text); border-color: var(--text); }

.olli-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.olli-chat__body::-webkit-scrollbar { width: 6px; }
.olli-chat__body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.olli-msg {
  max-width: 84%;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.5;
  animation: olli-msg-in 0.4s var(--ease-expo);
}
@keyframes olli-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.olli-msg--bot {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.olli-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.olli-typing { display: flex; gap: 4px; padding: 0.85rem 1rem; align-self: flex-start; }
.olli-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: olli-typing-bounce 1.1s ease-in-out infinite;
}
.olli-typing span:nth-child(2) { animation-delay: 0.15s; }
.olli-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes olli-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.olli-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; animation: olli-msg-in 0.4s var(--ease-expo); }
.olli-choice {
  padding: 0.6rem 1.05rem;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  transition: border-color var(--t), color var(--t), background var(--t), transform var(--t);
}
.olli-choice:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.olli-choice.is-selected { background: var(--accent); border-color: var(--accent); color: #000; }
.olli-choice:disabled { cursor: default; opacity: 0.55; }

.olli-cta-wrap { animation: olli-msg-in 0.4s var(--ease-expo); }
.olli-cta {
  width: 100%;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ── Input de texto (nome / nicho) ── */
.olli-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: olli-msg-in 0.4s var(--ease-expo);
}
.olli-input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-pill);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.84rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.olli-input::placeholder { color: var(--muted-2); }
.olli-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.olli-input__send {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #000;
  transition: background var(--t), transform var(--t);
}
.olli-input__send svg { width: 16px; height: 16px; }
.olli-input__send:hover { background: var(--accent-2); transform: scale(1.06); }
.olli-input__send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ── Bloco de resumo (glass, estilo quote/código) para copiar e colar no Workana ── */
.olli-summary {
  animation: olli-msg-in 0.4s var(--ease-expo);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-2);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.olli-summary__text {
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
}
.olli-summary__copy { width: 100%; justify-content: center; margin-top: 0.9rem; }
.olli-summary__copy.is-copied { background: var(--accent-2); border-color: var(--accent-2); }

/* ── Mobile: bottom sheet ── */
@media (max-width: 640px) {
  .olli-overlay { padding: 0; }
  .olli-chat { max-width: none; border-radius: 20px 20px 0 0; max-height: 82svh; }
  .olli-bubble { right: 1rem; left: 1rem; max-width: none; bottom: 6rem; }
  .olli-fab { right: 1rem; bottom: 1rem; width: 56px; height: 56px; }
}
