/* ==========================================================================
   Chat da Mari — widget flutuante do site
   Paleta do site: grafite #0f1b2b, azul clínico #0f5fc4, ciano #0fa3b8.
   Abre no canto direito, em cima do botão flutuante que a chamou: desde
   que o balão virou o gatilho do chat, só existe um canto em uso.
   ========================================================================== */

.mchat-botao {
  position: fixed;
  left: 1.1rem;
  bottom: 1.1rem;
  z-index: 960;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .8rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: #0f5fc4;
  color: #fff;
  font: 600 .95rem/1 'Archivo', system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 27, 43, .28);
  transition: transform .15s ease, background .15s ease;
}
.mchat-botao:hover { background: #0fa3b8; transform: translateY(-2px); }
.mchat-botao svg   { width: 20px; height: 20px; stroke: currentColor; fill: none; }

.mchat-caixa {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 970;
  width: min(370px, calc(100vw - 2.2rem));
  height: min(560px, calc(100vh - 6rem));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(15, 27, 43, .35);
}
.mchat-caixa.aberta { display: flex; }

.mchat-topo {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1rem;
  background: #0f1b2b;
  color: #fff;
}
.mchat-topo__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f5fc4;
  flex: none;
}
.mchat-topo__avatar svg { width: 20px; height: 20px; stroke: #fff; fill: none; }
.mchat-topo__avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.mchat-topo__avatar { overflow: hidden; }
.mchat-topo__nome   { font: 700 .95rem/1.2 'Archivo', system-ui, sans-serif; }
.mchat-topo__status { font-size: .74rem; opacity: .75; }
.mchat-topo__nova {
  margin-left: auto;
  border: 0;
  background: none;
  color: #fff;
  opacity: .8;
  cursor: pointer;
  padding: .3rem;
  line-height: 0;
}
.mchat-topo__nova:hover { opacity: 1; }
.mchat-topo__nova svg { width: 17px; height: 17px; stroke: currentColor; fill: none; }

.mchat-topo__fechar {
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  padding: .3rem;
  line-height: 0;
}
.mchat-topo__fechar svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

.mchat-corpo {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .9rem;
  background: #f2f5f9;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.mchat-msg {
  max-width: 84%;
  padding: .6rem .8rem;
  border-radius: 12px;
  font: 400 .9rem/1.45 'Source Sans 3', system-ui, sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mchat-msg--mari {
  align-self: flex-start;
  background: #fff;
  color: #0f1b2b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(15, 27, 43, .10);
}
.mchat-msg--voce {
  align-self: flex-end;
  background: #0f5fc4;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mchat-msg strong, .mchat-msg b { font-weight: 700; }
.mchat-msg__nome {
  display: block;
  margin-bottom: .2rem;
  font: 700 .74rem/1.2 'Archivo', system-ui, sans-serif;
  color: #0f5fc4;
}

.mchat-digitando {
  align-self: flex-start;
  display: none;
  gap: .28rem;
  padding: .7rem .9rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 27, 43, .10);
}
.mchat-digitando.ativa { display: flex; }
.mchat-digitando i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9fb2c8;
  animation: mchatPulsa 1.1s infinite;
}
.mchat-digitando i:nth-child(2) { animation-delay: .18s; }
.mchat-digitando i:nth-child(3) { animation-delay: .36s; }
@keyframes mchatPulsa {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Área de preparo dos anexos, entre a conversa e o campo de texto. */
.mchat-fila {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .6rem .7rem 0;
  background: #fff;
  border-top: 1px solid #e3e9f1;
}
.mchat-fila__item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d4dde8;
  background: #f2f5f9;
}
.mchat-fila__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mchat-fila__doc {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font: 700 .7rem/1 'Archivo', system-ui, sans-serif;
  color: #51607a;
}
.mchat-fila__tirar {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 27, 43, .75);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.mchat-fila__tirar svg { width: 10px; height: 10px; stroke: currentColor; fill: none; }
.mchat-fila__dica {
  flex-basis: 100%;
  font-size: .74rem;
  color: #6b7c92;
  padding-bottom: .2rem;
}
.mchat-fila ~ .mchat-envio { border-top: 0; }

.mchat-envio {
  display: flex;
  gap: .5rem;
  padding: .7rem;
  background: #fff;
  border-top: 1px solid #e3e9f1;
}
.mchat-envio textarea {
  flex: 1;
  resize: none;
  border: 1px solid #d4dde8;
  border-radius: 10px;
  padding: .55rem .7rem;
  font: 400 .9rem/1.4 'Source Sans 3', system-ui, sans-serif;
  max-height: 90px;
}
.mchat-envio textarea:focus { outline: 2px solid #0fa3b8; border-color: transparent; }
.mchat-envio button {
  border: 0;
  border-radius: 10px;
  background: #0f5fc4;
  color: #fff;
  width: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease;
}
.mchat-envio .mchat-clipe {
  background: #fff;
  color: #51607a;
  border: 1px solid #d4dde8;
}
.mchat-envio .mchat-clipe:hover { background: #f2f5f9; color: #0f5fc4; }
.mchat-msg__imgs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.mchat-msg__img { display: block; width: calc(50% - .15rem); max-height: 160px; object-fit: cover; border-radius: 8px; }
.mchat-msg__imgs .mchat-msg__img:only-child { width: 100%; max-height: 220px; object-fit: contain; }
.mchat-msg__arquivo { display: block; font-size: .78rem; opacity: .85; }
.mchat-envio button:hover    { background: #0fa3b8; }
.mchat-envio button:disabled { background: #9fb2c8; cursor: default; }
.mchat-envio button svg      { width: 18px; height: 18px; stroke: currentColor; fill: none; }

.mchat-aviso {
  padding: .35rem .9rem .6rem;
  background: #fff;
  color: #6b7c92;
  font-size: .72rem;
  text-align: center;
}

/* Sugestões de partida, dentro da conversa, até a primeira mensagem. */
.mchat-atalhos {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  max-width: 92%;
}
.mchat-atalho {
  border: 1px solid #0f5fc4;
  border-radius: 999px;
  background: #fff;
  color: #0f5fc4;
  padding: .4rem .8rem;
  font: 600 .84rem/1.2 'Archivo', system-ui, sans-serif;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mchat-atalho:hover { background: #0f5fc4; color: #fff; }

/* Saída para o WhatsApp quando o agente não responde. */
.mchat-zap {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .95rem;
  border-radius: 999px;
  background: #1ea95c;
  color: #fff;
  text-decoration: none;
  font: 600 .88rem/1 'Archivo', system-ui, sans-serif;
}
.mchat-zap svg { width: 17px; height: 17px; stroke: currentColor; fill: none; }

.mchat-aviso a { color: #0b4b9c; font-weight: 600; }

/* A página de agendamento esconde os flutuantes (mesma classe de body
   que o site usa para o botão do WhatsApp). */
/* Na página de agendamento só o balão some (a barra fixa do celular usa o
   mesmo canto); a janela precisa abrir, porque o botão "Agende com a
   Mari" da própria página chama ela. */
body.pg-agendamento .mchat-botao { display: none !important; }
body.pg-agendamento .mchat-caixa { z-index: 990; }

@media (max-width: 480px) {
  .mchat-caixa {
    left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: min(85vh, 100vh - 3rem);
    border-radius: 16px 16px 0 0;
  }
}

/* ==========================================================================
   Visor: imagem ou PDF enviado, em tela cheia, com zoom.
   ========================================================================== */
.mchat-abre { cursor: zoom-in; }
button.mchat-abre {
  border: 0; background: none; padding: 0; text-align: left;
  color: inherit; cursor: pointer; text-decoration: underline; font: inherit;
}

.mchat-visor {
  position: fixed;
  inset: 0;
  z-index: 980;
  display: none;
  flex-direction: column;
  background: rgba(15, 27, 43, .92);
}
.mchat-visor.aberto { display: flex; }
body.mchat-visor-aberto { overflow: hidden; }

.mchat-visor__barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .6rem .9rem;
  color: #fff;
  background: #0f1b2b;
}
.mchat-visor__titulo {
  font: 600 .88rem/1.2 'Archivo', system-ui, sans-serif;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mchat-visor__acoes { display: flex; align-items: center; gap: .35rem; flex: none; }
.mchat-visor__acoes button {
  min-width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: 700 1rem/1 'Archivo', system-ui, sans-serif;
  cursor: pointer;
  display: grid; place-items: center; padding: 0 .4rem;
}
.mchat-visor__acoes button:hover { background: rgba(255,255,255,.12); }
.mchat-visor__acoes button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.mchat-visor__fora {
  color: #fff; font-size: .8rem; text-decoration: underline; margin: 0 .4rem;
}

.mchat-visor__palco {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;
}
.mchat-visor__img {
  max-width: 96vw;
  max-height: calc(100vh - 70px);
  object-fit: contain;
  transform-origin: center center;
  transition: transform .06s linear;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}
.mchat-visor__img:active { cursor: grabbing; }
.mchat-visor__pdf {
  width: min(1000px, 96vw);
  height: calc(100vh - 70px);
  border: 0;
  background: #fff;
  border-radius: 8px;
}
@media (max-width: 480px) {
  .mchat-visor__fora { display: none; }
  .mchat-visor--pdf .mchat-visor__fora { display: inline; }
  .mchat-visor__pdf { width: 100vw; border-radius: 0; }
}
