/* WebChat nativo do Opa! Suite na Central do Assinante
 * Medidas em px (não rem): a central antiga usa fonte-base de 10px e a nova de 16px. */

.ixc-webchat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1060;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background-color: var(--primary-color, #468EF2);
  color: var(--white, #FFF);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.ixc-webchat-fab:hover {
  background-color: var(--primary-color-hover, #7AB2FF);
  transform: scale(1.05);
}

.ixc-webchat-fab svg {
  width: 25.6px;
  height: 25.6px;
  fill: currentColor;
}

.ixc-webchat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20.8px;
  height: 20.8px;
  padding: 0 4.8px;
  border-radius: 10.4px;
  background-color: var(--danger, #e74a3b);
  color: var(--white, #FFF);
  font-size: 12px;
  font-weight: bold;
  line-height: 20.8px;
  text-align: center;
}

.ixc-webchat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 1060;
  width: 368px;
  max-width: calc(100vw - 32px);
  height: 512px;
  max-height: calc(100vh - 128px);
  display: flex;
  flex-direction: column;
  background-color: var(--white, #FFF);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-size: 14px;
  color: var(--text-black, #1F212B);
}

.ixc-webchat-panel[hidden],
.ixc-webchat-fab[hidden],
.ixc-webchat-badge[hidden] {
  display: none;
}

.ixc-webchat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: var(--primary-color, #468EF2);
  color: var(--white, #FFF);
}

.ixc-webchat-header-title {
  flex: 1;
  min-width: 0;
}

.ixc-webchat-header-title strong {
  display: block;
  font-size: 16px;
}

.ixc-webchat-header-title small {
  display: block;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ixc-webchat-header button {
  background: transparent;
  border: none;
  color: inherit;
  padding: 4px 6.4px;
  border-radius: 4.8px;
  cursor: pointer;
  font-size: 12.8px;
}

.ixc-webchat-header button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.ixc-webchat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background-color: var(--background-dashboard, #F1F1F1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ixc-webchat-empty {
  margin: auto;
  text-align: center;
  color: var(--gray-text, #5D5D5D);
  padding: 16px;
}

.ixc-webchat-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ixc-webchat-msg.recebida {
  align-self: flex-start;
  background-color: var(--white, #FFF);
  border-bottom-left-radius: 3.2px;
}

.ixc-webchat-msg.enviada {
  align-self: flex-end;
  background-color: var(--cyan, #EDF4FE);
  border-bottom-right-radius: 3.2px;
}

.ixc-webchat-msg img,
.ixc-webchat-msg video {
  max-width: 100%;
  max-height: 192px;
  border-radius: 6.4px;
  display: block;
}

.ixc-webchat-msg audio {
  max-width: 100%;
}

.ixc-webchat-msg a {
  color: var(--blue, #4186F5);
  text-decoration: underline;
}

.ixc-webchat-msg ul {
  margin: 4.8px 0 0;
  padding-left: 17.6px;
}

.ixc-webchat-meta {
  margin-top: 4px;
  font-size: 11.2px;
  color: var(--gray-text, #5D5D5D);
  /* autor · horário sempre em uma linha; se ainda não couber, corta com reticências */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ixc-webchat-status {
  padding: 4.8px 12px;
  font-size: 12px;
  text-align: center;
  color: var(--gray-text, #5D5D5D);
  background-color: var(--white, #FFF);
  border-top: 1px solid var(--gray, #C9C9C9);
}

.ixc-webchat-status.erro {
  color: var(--warning, #F75C46);
}

.ixc-webchat-footer {
  display: flex;
  align-items: flex-end;
  gap: 6.4px;
  padding: 8px;
  border-top: 1px solid var(--gray, #C9C9C9);
  background-color: var(--white, #FFF);
}

/* campo de várias linhas: começa com 1 linha e o JS (#fitInput) aumenta até 5; os botões ficam alinhados embaixo */
.ixc-webchat-footer textarea {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--gray, #C9C9C9);
  border-radius: 17.6px;
  padding: 7.2px 12.8px;
  outline: none;
  font: inherit;
  line-height: 1.4;
  min-height: 35.2px;
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
}

.ixc-webchat-footer textarea:focus {
  border-color: var(--primary-color, #468EF2);
}

.ixc-webchat-footer button {
  flex: none;
  width: 35.2px;
  height: 35.2px;
  border: none;
  border-radius: 50%;
  background-color: transparent;
  color: var(--gray-text, #5D5D5D);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ixc-webchat-footer button.ixc-webchat-send {
  background-color: var(--primary-color, #468EF2);
  color: var(--white, #FFF);
}

.ixc-webchat-footer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ixc-webchat-footer svg {
  width: 17.6px;
  height: 17.6px;
  fill: currentColor;
}

@media (max-width: 576px) {
  .ixc-webchat-fab {
    right: 16px;
    bottom: 16px;
  }
}

/* Celular (em pé, deitado ou com o teclado aberto): janela em tela cheia, na altura visível da tela (dvh),
 * respeitando a barra inferior do iPhone; o botão flutuante some enquanto o chat está aberto para não
 * cobrir as mensagens (fechar fica no "Minimizar" do cabeçalho). "body" para valer sobre os ajustes de
 * posição que cada central faz no botão e na janela. */
@media (max-width: 576px), (max-height: 500px) and (pointer: coarse) {
  body .ixc-webchat-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body .ixc-webchat-fab[aria-expanded="true"] {
    display: none;
  }
}

/* Tela de toque: campo com 16px (abaixo disso o iPhone dá zoom ao focar) e botões do cabeçalho com
 * área de toque de 44px */
@media (pointer: coarse) {
  .ixc-webchat-footer textarea {
    font-size: 16px;
  }

  .ixc-webchat-header button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.ixc-webchat-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ixc-webchat-status[hidden] {
  display: none;
}

.ixc-webchat-retry {
  border: none;
  background: transparent;
  color: var(--blue, #4186F5);
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

/* Bootstrap 3 (central antiga) força input[type=file] { display: block }: o atributo hidden precisa vencer */
.ixc-webchat-panel [hidden],
.ixc-webchat-fab [hidden] {
  display: none !important;
}
