/* =============================================================================
   AX Tecnologia — assistente virtual (chatbot)
   Desktop: janela no canto inferior direito, minimizável (vira uma barra).
   Celular (≤ 720px): ícone no canto inferior direito; ao tocar abre em tela cheia
   e o botão "Minimizar" devolve a pessoa à página principal.
   ========================================================================== */

.axchat {
  --axc-navy: #071b3f;
  --axc-navy-2: #0b2858;
  --axc-blue: #0663f5;
  --axc-blue-2: #087de8;
  --axc-cyan: #00d5df;
  --axc-ink: #102447;
  --axc-muted: #687891;
  --axc-line: #dfe7f1;
  --axc-surface: #f3f7fc;
  --axc-green: #25d366;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: var(--font, "DM Sans", system-ui, sans-serif);
  color: var(--axc-ink);
  line-height: 1.5;
}

.axchat *,
.axchat *::before,
.axchat *::after {
  box-sizing: border-box;
}

.axchat button,
.axchat input,
.axchat a {
  font: inherit;
}

.axchat [hidden] {
  display: none !important;
}

.axchat :focus-visible {
  outline: 2px solid var(--axc-cyan);
  outline-offset: 2px;
}

/* ---------- Lançador (barra no desktop / ícone no celular) ---------- */

.axchat-launcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 296px;
  height: 58px;
  padding: 0 14px 0 10px;
  border: 1px solid rgba(110, 158, 230, 0.38);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--axc-navy-2), var(--axc-navy));
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(2, 13, 32, 0.38);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s;
}

.axchat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(2, 13, 32, 0.48);
}

.axchat-launcher-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(110deg, var(--axc-blue), var(--axc-blue-2));
  color: #fff;
}

.axchat-launcher-icon svg {
  width: 22px;
  height: 22px;
}

.axchat-launcher-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.axchat-launcher-text strong {
  font-family: var(--display, "Manrope", sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.axchat-launcher-text small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9db3d6;
  font-size: 11.5px;
}

.axchat-launcher-chevron {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cfe0f8;
}

.axchat-status {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1fd18b;
  box-shadow: 0 0 0 0 rgba(31, 209, 139, 0.55);
  animation: axchat-pulse 2.4s infinite;
}

@keyframes axchat-pulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 209, 139, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(31, 209, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 209, 139, 0); }
}

/* Com a janela aberta, o lançador some (a janela ocupa o mesmo canto). */
.axchat[data-state="open"] .axchat-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- Janela ---------- */

.axchat-window {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 384px;
  height: min(620px, calc(100vh - 48px));
  height: min(620px, calc(100dvh - 48px));
  overflow: hidden;
  border: 1px solid rgba(8, 40, 90, 0.12);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(2, 13, 32, 0.38), 0 4px 14px rgba(2, 13, 32, 0.12);
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.22s;
}

.axchat[data-state="open"] .axchat-window {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

/* Cabeçalho */

.axchat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--axc-navy-2) 0%, var(--axc-navy) 70%);
  border-bottom: 2px solid var(--axc-cyan);
  color: #fff;
}

.axchat-avatar {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid rgba(110, 158, 230, 0.4);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}

/* O PNG tem margem e o texto "TECNOLOGIA" embaixo; aqui só a marca AX é exibida,
   centralizada pelo centro dela (48,8% / 46,6% da imagem). */
.axchat-avatar img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 108%;
  max-width: none;
  height: auto;
  transform: translate(-48.8%, -46.6%);
  clip-path: inset(0 0 33% 0);
}

.axchat-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.axchat-title strong {
  font-family: var(--display, "Manrope", sans-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.axchat-title span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a9bddb;
  font-size: 12px;
}

.axchat-min {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
}

.axchat-min:hover {
  background: rgba(255, 255, 255, 0.2);
}

.axchat-min-text {
  display: none;
}

/* Mensagens */

.axchat-messages {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 14px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--axc-surface);
  -webkit-overflow-scrolling: touch;
}

.axchat-msg {
  display: flex;
  margin-bottom: 10px;
  animation: axchat-in 0.22s ease both;
}

.axchat-msg--user {
  justify-content: flex-end;
}

@keyframes axchat-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.axchat-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.axchat-msg--bot .axchat-bubble {
  border: 1px solid var(--axc-line);
  border-bottom-left-radius: 4px;
  background: #fff;
  color: var(--axc-ink);
}

.axchat-msg--user .axchat-bubble {
  border-bottom-right-radius: 4px;
  background: linear-gradient(110deg, var(--axc-blue), var(--axc-blue-2));
  color: #fff;
}

.axchat-bubble p {
  margin: 0 0 8px;
}

.axchat-bubble p:last-child {
  margin-bottom: 0;
}

.axchat-bubble strong {
  font-weight: 700;
}

.axchat-bubble ul {
  margin: 0 0 8px;
  padding: 0 0 0 18px;
}

.axchat-bubble li {
  margin: 3px 0;
}

.axchat-bubble li::marker {
  color: #0b8fe0;
}

/* Digitando */

.axchat-typing .axchat-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 14px;
}

.axchat-typing .axchat-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8aa0c0;
  animation: axchat-bounce 1.1s infinite ease-in-out;
}

.axchat-typing .axchat-bubble span:nth-child(2) { animation-delay: 0.16s; }
.axchat-typing .axchat-bubble span:nth-child(3) { animation-delay: 0.32s; }

@keyframes axchat-bounce {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.5; }
  35% { transform: translateY(-4px); opacity: 1; }
}

/* Botões dentro das mensagens */

.axchat-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.axchat-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #b9d3f2;
  border-radius: 10px;
  background: #f2f8ff;
  color: #0a4ea8;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.axchat-action:hover {
  border-color: #0d8be6;
  background: #e5f1ff;
}

.axchat-action i {
  color: #00a9b6;
  font-style: normal;
}

.axchat-action--wa {
  border-color: var(--axc-green);
  background: var(--axc-green);
  color: #06241a;
}

.axchat-action--wa:hover {
  border-color: #1fbd5b;
  background: #2ee272;
  transform: translateY(-1px);
}

.axchat-action--wa svg {
  flex: 0 0 auto;
}

/* Sugestões */

.axchat-chips {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 124px;
  padding: 8px 14px 10px;
  overflow-y: auto;
  border-top: 1px solid var(--axc-line);
  background: var(--axc-surface);
}

.axchat-chip {
  padding: 7px 12px;
  border: 1px solid #cfe0f5;
  border-radius: 40px;
  background: #fff;
  color: #0d376f;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.axchat-chip:hover {
  border-color: #0d376f;
  background: #0d376f;
  color: #fff;
}

/* Campo de mensagem */

.axchat-form {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--axc-line);
  background: #fff;
}

.axchat-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: #fff;
  color: #19385e;
  font-size: 14px;
  outline: 0;
}

.axchat-input::placeholder {
  color: #9aa8bb;
}

.axchat-input:focus {
  border-color: #1683e0;
  box-shadow: 0 0 0 3px rgba(22, 131, 224, 0.14);
}

.axchat-send {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(110deg, var(--axc-blue), var(--axc-blue-2));
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}

.axchat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 83, 220, 0.3);
}

.axchat-note {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: #8a98ac;
  font-size: 11px;
  text-align: center;
}

/* Destaque do item do catálogo para o qual o chat levou a pessoa. */

.axchat-flash {
  animation: axchat-flash 2.4s ease;
}

@keyframes axchat-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 213, 223, 0); }
  15%, 70% { box-shadow: 0 0 0 4px rgba(0, 213, 223, 0.75), 0 12px 36px rgba(0, 120, 220, 0.25); }
}

/* ---------- Celular: ícone + tela cheia ---------- */

@media (max-width: 720px) {
  .axchat {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .axchat-launcher {
    width: 60px;
    height: 60px;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--axc-blue), var(--axc-blue-2));
    box-shadow: 0 12px 30px rgba(0, 83, 220, 0.45), 0 3px 10px rgba(2, 13, 32, 0.25);
  }

  .axchat-launcher-icon {
    flex-basis: auto;
    width: auto;
    height: auto;
    background: none;
  }

  .axchat-launcher-icon svg {
    width: 28px;
    height: 28px;
  }

  .axchat-launcher-text,
  .axchat-launcher-chevron {
    display: none;
  }

  /* Bolinha verde de "online" no canto do ícone. */
  .axchat-launcher::after {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #1fd18b;
    content: "";
  }

  .axchat-window {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(28px);
  }

  .axchat-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  .axchat-min-text {
    display: inline;
  }

  .axchat-messages {
    padding: 14px 12px 8px;
  }

  .axchat-bubble {
    max-width: 92%;
    font-size: 15px;
  }

  .axchat-chip {
    padding: 8px 13px;
    font-size: 13px;
  }

  /* 16px evita o zoom automático do iOS ao focar no campo. */
  .axchat-input {
    font-size: 16px;
  }

  .axchat-note {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}

/* Trava a rolagem da página enquanto o chat está em tela cheia. */
html.axchat-lock,
html.axchat-lock body {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .axchat *,
  .axchat *::before,
  .axchat *::after,
  .axchat-flash {
    animation: none !important;
    transition: none !important;
  }
}
