/* ============================================================================
   Opa! Suite Webchat — Identidade Visual RM Network (rmnetwork.com.br)
   Baseado na estrutura .opa_ico / .opa_chat do Opa! Suite + responsividade
   ============================================================================ */

:root {
  --brand: #1682b8;
  --brand-primary: #21acea;
  --brand-dark: #0b3649;
  --brand-accent: #65e578;
  --brand-gradient: linear-gradient(135deg, #0b3649 0%, #16698e 55%, #21acea 100%);
  --text-main: #1f2937;
  --text-muted: #5f6b7a;
  --border-light: #dbe7f0;
  --bg-soft: #eef4f8;
  --radius-card: 18px;
  --radius-sm: 12px;
  --radius-btn: 50px;
  --shadow-soft: 0 4px 16px rgba(11, 54, 73, 0.08);
  --shadow-hover: 0 12px 28px rgba(22, 130, 184, 0.35);
  --transition-fast: 0.2s ease;
}

/* =========================================================
   ELEMENTOS FLUTUANTES (WEBCHAT OPA! SUITE)
   ========================================================= */
/* Ícone do webchat, alinhado acima do selo do reCAPTCHA
   (o selo fica em bottom: 14px, com 70px x 60px visíveis à direita).
   "body >" vence o opa.css, que é injetado depois deste arquivo. */
body > .opa_ico {
  width: 58px;
  height: 58px;
  right: 16px;
  bottom: 24px;
  border-radius: 50%;
  background: var(--brand-gradient);
  border: 2px solid rgba(101, 229, 120, 0.55);
  box-shadow: 0 10px 24px rgba(11, 54, 73, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 99999;
}

body > .opa_ico:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 30px rgba(11, 54, 73, 0.6);
}

/* Troca o "pisca-pisca" do opa.css por um anel pulsando em volta do ícone */
body > .opa_ico .opa_pulsar {
  animation: none;
  -webkit-animation: none;
  opacity: 1;
}

/* Com o chat aberto o ícone ficaria aparecendo atrás da janela
   (o opa.js tenta escondê-lo com display: 'hide', que não é válido) */
body:has(> .opa_chat:not([style*="none"])) > .opa_ico {
  display: none;
}

body > .opa_ico::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(33, 172, 234, 0.55);
  animation: opa-ring 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes opa-ring {
  0% { box-shadow: 0 0 0 0 rgba(33, 172, 234, 0.55); }
  70%, 100% { box-shadow: 0 0 0 16px rgba(33, 172, 234, 0); }
}

/* Chamariz: a cada 5s o ícone dá dois pulinhos. Usa "translate" (e não
   "transform") para não brigar com o efeito de hover. */
body > .opa_ico {
  animation: opa-bounce 5s ease-in-out 1.5s infinite;
}

body > .opa_ico:hover {
  animation-play-state: paused;
}

@keyframes opa-bounce {
  0%, 16%, 100% { translate: 0 0; }
  4% { translate: 0 -14px; }
  8% { translate: 0 0; }
  11% { translate: 0 -7px; }
  14% { translate: 0 0; }
}

/* Balão "Precisa de ajuda?" que aparece ao lado do ícone durante o pulo */
body > .opa_ico::before {
  content: "Precisa de ajuda? Fale conosco";
  position: absolute;
  top: 50%;
  right: calc(100% + 14px);
  padding: 9px 14px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--brand-dark);
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(11, 54, 73, 0.18);
  border: 1px solid var(--border-light);
  opacity: 0;
  transform: translate(8px, -50%);
  pointer-events: none;
  animation: opa-hint 10s ease-in-out 1.5s infinite;
}

body > .opa_ico:hover::before {
  animation: none;
  opacity: 1;
  transform: translate(0, -50%);
}

@keyframes opa-hint {
  0%, 2% { opacity: 0; transform: translate(8px, -50%); }
  6%, 38% { opacity: 1; transform: translate(0, -50%); }
  44%, 100% { opacity: 0; transform: translate(8px, -50%); }
}

/* Janela do chat. Os seletores começam com "body > .opa_chat" para vencer o
   opa.css; onde o opa.css usa !important, aqui também é preciso. */
body > .opa_chat {
  --brand: #1682b8;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  bottom: calc(var(--site-chat-bottom, 0px) + 16px);
  right: max(16px, env(safe-area-inset-right, 0px));
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(var(--site-chat-vh, 100dvh) - 32px));
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #f4f8fb;
  box-shadow: 0 24px 60px rgba(11, 54, 73, 0.24), 0 4px 16px rgba(11, 54, 73, 0.1);
  font-family: "Poppins", "Inter", sans-serif;
  color: var(--text-main);
  animation: opa-chat-in 0.25s ease-out;
  z-index: 100001;
}

@keyframes opa-chat-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Cabeçalho: título e subtítulo via pseudo-elementos (o Opa não gera texto aqui) */
body > .opa_chat .opa_cabecalho {
  flex: none;
  position: relative;
  min-height: 64px;
  height: 64px;
  border-radius: 0;
  background: var(--brand-gradient);
}

body > .opa_chat .opa_cabecalho::before,
body > .opa_chat .opa_cabecalho::after {
  position: absolute;
  left: 16px;
  right: 112px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body > .opa_chat .opa_cabecalho::before {
  content: "Atendimento RM Network";
  top: 14px;
  font-size: 1rem;
  font-weight: 700;
}

body > .opa_chat .opa_cabecalho::after {
  content: "Fale com nossa equipe";
  top: 37px;
  font-size: 0.78rem;
  opacity: 0.92;
}

body > .opa_chat .opa_minimize,
body > .opa_chat .opa_close {
  top: 50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.16);
  background-position: center;
  background-size: 18px;
  transition: background-color 0.2s ease;
}

body > .opa_chat .opa_minimize {
  right: 56px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body > .opa_chat .opa_close {
  right: 8px;
  background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

body > .opa_chat .opa_minimize:hover,
body > .opa_chat .opa_close:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.3);
}

/* Área de mensagens */
body > .opa_chat .opa_corpo {
  flex: 1 1 0;
  min-height: 0;
  padding: 12px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* Tela inicial ("Continuar sem efetuar login") */
body > .opa_chat .div-logins {
  margin: 24px 20px 0;
  padding: 28px 20px 22px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

body > .opa_chat .div-logins::before {
  content: "Olá!\A Como podemos ajudar você hoje?";
  display: block;
  margin-bottom: 18px;
  white-space: pre-line;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
}

body > .opa_chat .sem-login {
  display: inline-block;
  margin: 0;
  padding: 10px 26px;
  border-radius: var(--radius-btn);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(22, 130, 184, 0.28);
  transition: var(--transition-fast);
}

body > .opa_chat .sem-login:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Balões */
body > .opa_chat .opa_ballon {
  max-width: 85%;
  min-width: 64px;
  margin: 4px 14px;
  padding: 10px 14px 7px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(11, 54, 73, 0.06);
}

body > .opa_chat .opa_ballon.enviada {
  text-align: left !important;
  border-radius: 16px 16px 4px 16px;
  background: #dff3fd;
  color: var(--text-main);
}

body > .opa_chat .opa_ballon.recebida::before,
body > .opa_chat .opa_ballon.recebida::after,
body > .opa_chat .opa_ballon.enviada::before,
body > .opa_chat .opa_ballon.enviada::after {
  content: none;
}

body > .opa_chat .opa_ballon a {
  color: var(--brand-dark);
  text-decoration: underline;
}

body > .opa_chat .opa_ballon .time {
  margin-top: 4px;
  padding: 0 !important;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--text-muted);
}

body > .opa_chat .opa_ballon.enviada .time {
  color: var(--text-muted);
}

body > .opa_chat .opa_ballon img,
body > .opa_chat .opa_ballon video {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

body > .opa_chat .netzon-audio-attachment {
  color: var(--text-main);
}

body > .opa_chat .netzon-audio-status {
  margin: 0;
}

/* Rodapé: anexo, campo de texto, enviar e microfone */
body > .opa_chat .opa_rodape {
  height: auto;
  min-height: 61px;
  padding: 8px 10px;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border-light);
  background: #fff;
}

body > .opa_chat .opa_rodape_menu,
body > .opa_chat .opa_rodape_send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  transition: var(--transition-fast);
}

body > .opa_chat .opa_rodape_menu {
  background-size: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
}

body > .opa_chat .opa_rodape_menu:hover {
  opacity: 1;
  background-color: var(--bg-soft);
}

body > .opa_chat .opa_rodape_input {
  height: 44px !important;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid transparent !important;
  border-radius: var(--radius-btn);
  background: #eef4f8 !important;
  font-family: inherit;
  font-size: 16px !important;
  color: var(--text-main);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

body > .opa_chat .opa_rodape_input:focus {
  border-color: var(--brand-primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(33, 172, 234, 0.18) !important;
}

body > .opa_chat .opa_rodape_send {
  background-size: 18px, cover;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22l-4-9-9-4 20-7z'/%3E%3C/svg%3E"),
    var(--brand-gradient);
  box-shadow: 0 6px 14px rgba(22, 130, 184, 0.3);
}

body > .opa_chat .opa_rodape_send:hover {
  opacity: 1;
  transform: scale(1.06);
}

body > .opa_chat .opa_rodape_send:focus-visible,
body > .opa_chat .netzon-audio-mic:focus-visible {
  outline: 3px solid var(--brand-dark);
  outline-offset: 2px;
}

/* Ativar notificações: à esquerda de minimizar/fechar, mesma área de toque */
body > .opa_chat .netzon-site-notify {
  position: absolute;
  top: 50%;
  right: 104px;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 2;
}
body > .opa_chat .netzon-site-notify:hover { background: rgba(255, 255, 255, 0.32); }
body > .opa_chat .netzon-site-notify[hidden] { display: none; }
body > .opa_chat .netzon-site-notify:disabled { opacity: 0.6; cursor: default; }
body > .opa_chat .netzon-site-notify svg { width: 22px; height: 22px; fill: #fff; }
body > .opa_chat .opa_cabecalho:has(.netzon-site-notify:not([hidden]))::before,
body > .opa_chat .opa_cabecalho:has(.netzon-site-notify:not([hidden]))::after { right: 156px; }

/* Modal "Encerrar atendimento?" */
dialog.opa-confirm {
  width: min(380px, calc(100% - 32px));
  margin: auto;
  padding: 28px 24px 22px;
  border: 0;
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text-main);
  font-family: "Poppins", "Inter", sans-serif;
  text-align: center;
  box-shadow: 0 24px 60px rgba(11, 54, 73, 0.28);
}

dialog.opa-confirm[open] {
  animation: opa-confirm-in 0.2s ease-out;
}

dialog.opa-confirm::backdrop {
  background: rgba(11, 54, 73, 0.55);
  backdrop-filter: blur(3px);
}

@keyframes opa-confirm-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.opa-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(33, 172, 234, 0.14);
  color: var(--brand);
}

.opa-confirm-icon svg {
  width: 28px;
  height: 28px;
}

dialog.opa-confirm h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-dark);
}

dialog.opa-confirm p {
  margin-bottom: 22px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.opa-confirm-actions {
  display: flex;
  gap: 10px;
}

.opa-confirm-btn {
  flex: 1;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.opa-confirm-btn-secondary {
  background: #eef4f8;
  color: var(--text-main);
}

.opa-confirm-btn-secondary:hover {
  background: #dbe7f0;
}

.opa-confirm-btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 130, 184, 0.28);
}

.opa-confirm-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.opa-confirm-btn:focus-visible {
  outline: 3px solid rgba(33, 172, 234, 0.45);
  outline-offset: 2px;
}

@media (max-width: 380px) {
  .opa-confirm-actions {
    flex-direction: column-reverse;
  }
}

/* Responsividade Desktop grande / Mobile fullscreen */
@media (min-width: 1440px) {
  body > .opa_chat { width: 460px; }
}

@media (max-width: 640px), (max-height: 500px) and (max-width: 1024px) {
  html.netzon-site-chat-open, html.netzon-site-chat-open body {
    overflow: hidden;
    overscroll-behavior: none;
  }
  body > .opa_chat {
    top: var(--site-chat-top, 0px);
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    bottom: auto;
    width: auto;
    height: var(--site-chat-vh, 100dvh);
    border-radius: 0;
    animation: none;
  }
  body > .opa_chat .opa_cabecalho { height: calc(64px + env(safe-area-inset-top, 0px)); }
  body > .opa_chat .opa_cabecalho::before { top: calc(14px + env(safe-area-inset-top, 0px)); }
  body > .opa_chat .opa_cabecalho::after { top: calc(37px + env(safe-area-inset-top, 0px)); }
  body > .opa_chat .opa_rodape { padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 374px) {
  body > .opa_chat .opa_rodape { gap: 6px; padding-left: 8px; padding-right: 8px; }
  body > .opa_chat .opa_ballon { margin-left: 10px; margin-right: 10px; max-width: 90%; }
}

@media (max-height: 500px) {
  body > .opa_chat .opa_cabecalho { height: 56px; min-height: 56px; }
  body > .opa_chat .opa_cabecalho::before { top: 8px; }
  body > .opa_chat .opa_cabecalho::after { top: 31px; }
  body > .opa_chat .opa_rodape { padding-top: 6px; padding-bottom: 6px; min-height: 57px; }
}

@media (prefers-reduced-motion: reduce) {
  body > .opa_ico,
  body > .opa_ico::after,
  body > .opa_chat {
    animation: none;
  }
}
