/* Ajustes de integracao do WebChat no site institucional. */

/* Variáveis do tema EasyDesk para garantir renderização consistente */
:root {
  --ui-bg-card: #ffffff;
  --ui-bg-page: #f0f2f5;
  --ui-bg-inset: #f5f5f5;
  --ui-line: #dddddd;
  --ui-text-dim: #718096;
  --ui-shadow-extra: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Ícone flutuante: transição suave com fallback automático */
@keyframes edFadeIn {
  0% {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.75);
  }
  100% {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
  }
}

.ed-webchat-plugin {
  position: fixed !important;
  right: 24px !important;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  background-color: lightskyblue !important;
  box-shadow: 0 4px 14px rgba(135, 206, 250, 0.4) !important;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.75);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
  animation: edFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 2.5s forwards;
  z-index: 2147482999 !important;
}

/* Oculta o ícone padrão da EasyDesk enquanto o da Hebraica não carrega */
.ed-webchat-plugin:not([style*="url"]) {
  background-image: none !important;
}

/* Revela suavemente o botão com o ícone da Hebraica */
.ed-webchat-plugin.ready {
  opacity: 1 !important;
  visibility: visible !important;
  transform: scale(1) !important;
  animation: none !important;
}

.ed-webchat-container {
  position: fixed !important;
  right: 16px !important;
  bottom: env(safe-area-inset-bottom, 0px) !important;
  width: min(430px, calc(100vw - 32px)) !important;
  max-height: calc(100dvh - 16px - env(safe-area-inset-bottom, 0px)) !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #dbe2ea !important;
  border-bottom: none !important;
  border-radius: 1rem 1rem 0 0 !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22) !important;
  overflow: hidden !important;
  z-index: 2147483000 !important;
}

.ed-webchat-container.visible {
  height: min(640px, calc(100dvh - 16px - env(safe-area-inset-bottom, 0px))) !important;
}

/* Garante fundo branco opaco para o conteúdo interno e o iframe */
.ed-webchat-container .ed-webchat-content {
  background: #ffffff !important;
  background-color: #ffffff !important;
  width: 100% !important;
  height: 100% !important;
}

.ed-webchat-container .ed-webchat-content > iframe {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: none !important;
  width: 100% !important;
  height: 100% !important;
}

.ed-webchat-container .ed-webchat-content > span {
  color: #718096 !important;
  z-index: 10 !important;
}

@supports not (height: 100dvh) {
  .ed-webchat-container,
  .ed-webchat-container.visible {
    max-height: calc(100vh - 16px) !important;
  }

  .ed-webchat-container.visible {
    height: min(640px, calc(100vh - 16px)) !important;
  }
}

@media (max-width: 480px) {
  .ed-webchat-plugin {
    right: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .ed-webchat-container {
    right: 8px !important;
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 8px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .ed-webchat-container.visible {
    height: calc(100dvh - 8px - env(safe-area-inset-bottom, 0px)) !important;
  }
}
