/* Agente VG - estilos do widget (Guanabara DS) */
#agvg-root { --agvg-blue: #19398A; --agvg-card: #BED3E5; font-family: "Nunito Sans", sans-serif; }

/* Posicionamento blindado com !important: o tema/Elementor tem resets de button e position
   que sobrescrevem o widget, jogando o botão para o fluxo da página. Forçamos fixed. */
#agvg-root #agvg-fab {
  position: fixed !important; right: 20px !important; bottom: 20px !important;
  left: auto !important; top: auto !important; margin: 0 !important; float: none !important;
  transform: none; z-index: 2147483000 !important;
  display: inline-flex !important; align-items: center; gap: 6px;
  width: auto !important; max-width: none !important;
  background: var(--agvg-blue) !important; color: #fff !important; border: none; cursor: pointer;
  padding: 12px 20px; border-radius: 999px; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#agvg-fab:hover { filter: brightness(1.1); background: var(--agvg-blue) !important; color: #fff !important; }
#agvg-fab span.agvg-fab-label { line-height: 1; }

/* Encolhe o botão para só o ícone quando o balão de convite já apareceu (evita repetir
   a mesma mensagem duas vezes: o balão já explica, o botão não precisa mais do texto). */
.agvg-fab-label {
  display: inline-block; overflow: hidden; white-space: nowrap;
  max-width: 160px; opacity: 1; margin-left: 2px;
  transition: max-width .35s ease, opacity .2s ease, margin .35s ease;
}
#agvg-root #agvg-fab.agvg-fab-collapsed {
  padding: 13px; gap: 0; transition: padding .35s ease;
}
#agvg-root #agvg-fab.agvg-fab-collapsed .agvg-fab-label {
  max-width: 0; opacity: 0; margin-left: 0;
}

/* Ícone de faísca (IA) usado no botão, cabeçalho e balão */
.agvg-spark { display: block; flex-shrink: 0; }
@keyframes agvgSparkTwinkle { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.agvg-spark path:nth-child(2) { animation: agvgSparkTwinkle 1.7s ease-in-out infinite; transform-origin: center; }

/* Badge (bolinha) no botão - chamada de atenção no mobile */
#agvg-badge {
  position: absolute; top: -6px; right: -6px;
  background: #E11D2E; color: #fff; font-size: 12px; font-weight: 800;
  min-width: 20px; height: 20px; line-height: 20px; padding: 0 5px;
  border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
/* Animação de atenção do botão (pulse suave) */
@keyframes agvgAttn {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  50% { transform: scale(1.06); box-shadow: 0 6px 20px rgba(225,29,46,.45); }
}
#agvg-fab.agvg-attn { animation: agvgAttn 1.6s ease-in-out infinite; }

/* Balão de convite - tamanho base (mobile). Desktop fica maior (ver media query abaixo). */
#agvg-invite {
  position: fixed; right: 20px; bottom: 78px; z-index: 2147483000;
  max-width: min(280px, calc(100vw - 40px)); background: #fff; color: #1a1a1a;
  padding: 14px 34px 14px 16px; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); cursor: pointer;
  font-size: 14px; line-height: 1.4; border: 1px solid #e6e6e6;
  animation: agvgInviteIn .35s ease-out;
}
#agvg-invite::after {
  content: ''; position: absolute; right: 28px; bottom: -8px;
  border-width: 8px 8px 0 8px; border-style: solid;
  border-color: #fff transparent transparent transparent;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.06));
}
#agvg-invite-close {
  position: absolute; top: 6px; right: 8px; background: none; border: none;
  font-size: 18px; line-height: 1; color: #999; cursor: pointer; padding: 2px 4px;
}
#agvg-invite-close:hover { color: #444; }
.agvg-invite-body { display: flex; align-items: flex-start; gap: 8px; }
.agvg-invite-body .agvg-spark { margin-top: 2px; }
@keyframes agvgInviteIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Desktop: balão com mais destaque (maior, texto maior) */
@media (min-width: 641px) {
  #agvg-invite {
    max-width: 320px; padding: 18px 40px 18px 20px; font-size: 16px; border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0,0,0,.22);
  }
  #agvg-invite-close { font-size: 20px; top: 8px; right: 10px; }
}

#agvg-panel {
  position: fixed; right: 20px; bottom: 78px; z-index: 99999;
  width: 360px; max-width: calc(100vw - 32px); height: 480px; max-height: 70vh;
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

#agvg-header {
  background: var(--agvg-blue); color: #fff; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 15px;
}
.agvg-header-title { display: flex; align-items: center; gap: 7px; }
#agvg-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }

#agvg-msgs { flex: 1; overflow-y: auto; padding: 12px; background: #f5f8fb; }
.agvg-msg { max-width: 85%; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.agvg-user { background: var(--agvg-blue); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.agvg-assistant { background: var(--agvg-card); color: #10264d; margin-right: auto; border-bottom-left-radius: 4px; }
.agvg-assistant a { color: var(--agvg-blue) !important; font-weight: 700; }

#agvg-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e2e8f0; background: #fff; }
#agvg-input { flex: 1; border: 1px solid #cbd5e1 !important; border-radius: 999px; padding: 10px 14px; font-size: 14px; outline: none; }
#agvg-input:focus { border-color: var(--agvg-blue) !important; }
#agvg-send { background: var(--agvg-blue) !important; border: none; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: filter .15s; }
#agvg-send:hover:not(:disabled) { background: var(--agvg-blue) !important; filter: brightness(1.15); }
#agvg-send:disabled { cursor: default; opacity: .85; }
#agvg-send svg { width: 22px !important; height: 22px !important; display: block !important; flex-shrink: 0 !important; }
.agvg-dots.agvg-dots-btn i { background: #fff !important; }

#agvg-foot { font-size: 11px; color: #64748b; text-align: center; padding: 6px 10px 10px; background: #fff; }

/* Pesquisa de satisfação (estrelas) ao fechar o chat */
#agvg-nps {
  position: absolute; inset: 0; background: #fff; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
}
#agvg-nps-title { font-size: 15px; font-weight: 700; color: #10264d; margin: 0; }
.agvg-stars { display: flex; flex-direction: row-reverse; gap: 4px; }
.agvg-stars button {
  background: none !important; border: none; cursor: pointer; font-size: 34px; line-height: 1;
  color: #d8dde5 !important; padding: 2px; transition: color .1s ease;
}
.agvg-stars button:hover,
.agvg-stars button:hover ~ button { color: #efc348 !important; }
#agvg-nps-skip { background: none !important; border: none; color: #8a94a6 !important; font-size: 13px; cursor: pointer; text-decoration: underline; }
#agvg-nps-skip:hover { color: #5a6472 !important; background: none !important; }

/* Loading dinâmico */
.agvg-loading { display: flex; align-items: center; gap: 8px; }
.agvg-load-text { font-style: italic; color: #3a4a66; }
.agvg-dots { display: inline-flex; gap: 3px; }
.agvg-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--agvg-blue); opacity: .35; animation: agvg-bounce 1.2s infinite ease-in-out; }
.agvg-dots i:nth-child(2) { animation-delay: .2s; }
.agvg-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes agvg-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }

/* ===== Mobile: chat em tela cheia, estilo app ===== */
@media (max-width: 640px) {
  #agvg-panel {
    right: 0; left: 0; bottom: 0; top: 0;
    width: 100%; max-width: 100%; height: 100%; max-height: 100%;
    border-radius: 0;
    background: #ffffff; /* fundo opaco: impede ver a página (cards de cupom) atrás quando o teclado sobe */
  }
  #agvg-msgs { background: #ffffff; } /* área de mensagens também opaca no mobile */
  #agvg-header { padding: 16px; font-size: 17px; padding-top: max(16px, env(safe-area-inset-top)); }
  #agvg-close { font-size: 28px; padding: 4px 8px; }
  #agvg-msgs { padding: 16px; }
  .agvg-msg { max-width: 88%; font-size: 15px; padding: 12px 14px; }
  #agvg-form { padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #agvg-input { padding: 13px 16px; font-size: 16px; } /* 16px evita zoom automático no iOS */
  #agvg-send { width: 44px; height: 44px; } /* levemente maior no mobile, alvo de toque melhor */
  #agvg-send svg { width: 22px !important; height: 22px !important; }
  /* Trava o scroll do site atrás do chat aberto */
  body.agvg-open { overflow: hidden; }
  /* Balão agora aparece também no mobile (junto com o badge), posicionado acima do botão */
  #agvg-invite { bottom: 84px; }
}

/* Esconde o botão flutuante e o convite sempre que o painel está aberto, em qualquer tela.
   Precisa repetir #agvg-root aqui para IGUALAR a especificidade da blindagem do botão lá em
   cima (que também usa 2 IDs); com apenas 1 ID essa regra perdia o empate e nunca escondia. */
body.agvg-open #agvg-root #agvg-fab,
body.agvg-open #agvg-invite,
body.agvg-open #agvg-badge { display: none !important; }

/* Camada branca de segurança: fica ATRÁS da conversa e NA FRENTE da página, só quando o
   chat está aberto no mobile. Evita que o teclado do iOS (barra de senha/cartão) exponha
   o conteúdo da página por trás de qualquer imprecisão de altura do painel. */
#agvg-overlay { display: none; }
@media (max-width: 640px) {
  body.agvg-open #agvg-overlay {
    display: block; position: fixed; inset: 0; background: #fff;
    z-index: 99990; height: 100vh; height: 100dvh; /* abaixo do painel (99999): fica ATRÁS dele */
  }
  #agvg-panel { height: 100dvh; } /* dvh acompanha a retração do teclado melhor que % */
}

/* Markdown dentro das mensagens */
.agvg-msg p { margin: 0 0 6px; }
.agvg-msg p:last-child { margin-bottom: 0; }
.agvg-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.agvg-msg li { margin-bottom: 3px; }
.agvg-assistant strong { color: #0d2a66; }

/* Formulário de captação de lead, inline no chat */
.agvg-leadform { background: #fff; border: 1px solid #dbe4f0 !important; }
.agvg-lead-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.agvg-lead-emoji { font-size: 26px; line-height: 1; }
.agvg-lead-title { margin: 0 0 2px; font-size: 14px; font-weight: 800; color: #10264d; }
.agvg-lead-sub { margin: 0; font-size: 12px; color: #64748b; }
.agvg-lead-form { display: flex; flex-direction: column; gap: 8px; }
.agvg-lead-field { display: flex; flex-direction: column; gap: 3px; }
.agvg-lead-form input {
  border: 1px solid #cbd5e1 !important; border-radius: 8px; padding: 9px 12px; font-size: 13px;
  font-family: inherit; outline: none; width: 100%; box-sizing: border-box;
}
.agvg-lead-form input:focus { border-color: var(--agvg-blue) !important; }
.agvg-lead-msg-erro { color: #a22635; font-size: 11px; min-height: 13px; }
.agvg-lead-form button[type="submit"] {
  background: var(--agvg-blue) !important; color: #fff !important; border: none; border-radius: 999px;
  padding: 10px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.agvg-lead-form button[type="submit"]:disabled { opacity: .7; cursor: default; }
.agvg-lead-skip { background: none !important; border: none; color: #8a94a6 !important; font-size: 12px; cursor: pointer; text-decoration: underline; align-self: center; }
.agvg-lead-skip:hover { background: none !important; color: #5a6472 !important; }
.agvg-lead-erro { color: #a22635; font-size: 12px; margin-top: 4px; }

/* Carrossel de cards: rola só DENTRO do próprio painel do chat, nunca vaza pra página */
.agvg-card-carousel {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory; margin: -2px 0 10px; padding: 2px 2px 6px;
  max-width: 100%; scrollbar-width: thin; scrollbar-color: #c9d6ea transparent;
}
.agvg-card-carousel::-webkit-scrollbar { height: 6px; }
.agvg-card-carousel::-webkit-scrollbar-track { background: transparent; }
.agvg-card-carousel::-webkit-scrollbar-thumb { background: #c9d6ea; border-radius: 3px; }
.agvg-card-track { display: flex; gap: 10px; width: max-content; }
.agvg-card-track .agvg-card { flex: 0 0 240px; scroll-snap-align: start; margin-bottom: 0; }

/* Card de rota — neutro (fundo branco), foto do destino quando disponível, tags do que sabemos */
.agvg-card { border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.agvg-card-rota { background: #fff; border: 1px solid #e2e8f0; color: #10264d; display: flex; flex-direction: column; }
.agvg-card-rota-img { width: 100%; height: 110px; object-fit: cover; display: block; }
.agvg-card-rota-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.agvg-card-data { font-size: 10.5px; font-weight: 800; color: #64748b; background: #f1f5f9; padding: 3px 9px; border-radius: 999px; }
.agvg-tag-cupom { background: #fdf3dc; color: #8a5a00; }
/* Sugestões rápidas após a saudação inicial (cupom/dicas, propositalmente sem busca de passagem) */
.agvg-sugg-row { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 10px 2px; }
.agvg-sugg {
  background: #fff !important; border: 1px solid #c9d6ea !important; border-radius: 999px;
  padding: 8px 14px; font-size: 12.5px; font-weight: 700; color: #19398A !important; cursor: pointer;
}
.agvg-sugg:hover { background: #eef3fb !important; color: #19398A !important; border-color: #c9d6ea !important; }

.agvg-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.agvg-tag {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; background: #eef3fb; color: #19398A;
}
.agvg-tag-alt { background: #fdf3dc; color: #8a5a00; }
.agvg-card-route { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.agvg-card-arrow { color: #efc348; font-weight: 900; }
.agvg-card-cta {
  align-self: flex-start; background: var(--agvg-blue) !important; color: #fff !important; font-weight: 800;
  font-size: 13px; padding: 8px 16px; border-radius: 999px; text-decoration: none !important;
}
.agvg-card-cta:hover { filter: brightness(1.15); }

/* Card de artigo de blog — agora o card inteiro é clicável (não só "Ler artigo") */
.agvg-card-blog { background: #fff; border: 1px solid #e2e8f0; display: flex; flex-direction: column; text-decoration: none !important; color: inherit; transition: box-shadow .15s, transform .15s; }
.agvg-card-blog:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-2px); }
.agvg-card-blog img { width: 100%; height: 100px; object-fit: cover; flex-shrink: 0; }
.agvg-card-blog-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.agvg-card-blog-body h4 { margin: 0; font-size: 13px; color: #10264d; line-height: 1.3; }
.agvg-card-blog-body p { margin: 0; font-size: 12px; color: #64748b; line-height: 1.35; }
.agvg-card-blog-cta { font-size: 12px; font-weight: 700; color: #19398A !important; margin-top: 2px; }
.agvg-card-blog:hover .agvg-card-blog-cta { text-decoration: underline; }

/* Feedback por resposta */
.agvg-feedback { display: flex; gap: 10px; margin: -4px 0 10px 2px; }
.agvg-feedback button { background: none !important; border: none; cursor: pointer; font-size: 16px; opacity: .6; padding: 2px; transition: opacity .15s, transform .1s; }
.agvg-feedback button:hover { opacity: 1; transform: scale(1.15); background: none !important; }
.agvg-feedback-obrigado { font-size: 11.5px; color: #8a94a6; }
