@charset "UTF-8";

/* ==========================================================================
   Chatbot Overlay — Erro Médico Cirurgia Plástica | Morais & Tavares
   Prefixo: #plastica-chat-* para não conflitar com o chatbot global
   ========================================================================== */

/* Overlay full-viewport */
#plastica-chat-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  /* dvh: desconta a barra do browser no iOS/Android corretamente */
  height: 100dvh !important;
  background: rgba(13, 32, 53, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2147483646 !important;
  transform: none !important;
  /* Garante que o overlay não suba junto com o teclado virtual */
  overscroll-behavior: contain;
}

#plastica-chat-overlay.active {
  display: flex !important;
}

/* Trava scroll do fundo */
body.chat-open {
  overflow: hidden !important;
  /* Evita o bounce/scroll no iOS quando o chat está aberto */
  position: fixed;
  width: 100%;
}

/* Popup — mesmas dimensões em desktop e mobile, como o bot global */
#plastica-chat-popup {
  position: relative;
  width: 92%;
  max-width: 500px;
  /* Altura máxima relativa ao viewport visível (já desconta teclado no iOS via dvh) */
  height: min(620px, 88dvh);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(13, 32, 53, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 4px solid #d4af37;
}

/* Cabeçalho do chat */
#plastica-chat-header {
  background: #0d2035;
  color: #ffffff;
  padding: 14px 48px 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#plastica-chat-header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.plastica-header-info strong {
  display: block;
  font-size: 0.95rem;
  color: #ffffff;
  font-family: 'Merriweather', serif;
}

.plastica-header-info span {
  font-size: 0.78rem;
  color: #d4af37;
}

/* Botão fechar */
#plastica-chat-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  font-size: 20px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  color: #ffffff;
  z-index: 2;
  transition: background 0.2s, transform 0.2s;
}

#plastica-chat-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* Área de mensagens — ocupa o espaço restante e rola internamente */
#plastica-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  /* -webkit- garante momentum scroll no iOS (Safari trata diferente) */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  background: #f8f9fa;
  /* Impede que o scroll vaze para o documento pai no iOS */
  overscroll-behavior: contain;
}

/* Área de input — nunca some; fica sempre acima do teclado */
#plastica-chat-input-area {
  flex-shrink: 0;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
}

/* Rodapé */
#plastica-chat-footer {
  padding: 6px 12px;
  text-align: center;
  font-size: 11px;
  color: #888;
  background: #f0f0f0;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* ==========================================================================
   Mensagens
   ========================================================================== */
.plastica-message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  opacity: 0;
  animation: plasticaFadeIn 0.3s forwards;
}

@keyframes plasticaFadeIn {
  to { opacity: 1; }
}

.plastica-message.bot  { flex-direction: row; }
.plastica-message.user { flex-direction: row-reverse; }

.plastica-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  margin: 0 8px;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid #d4af37;
}

.plastica-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.plastica-message.bot .plastica-bubble {
  background: #ffffff;
  color: #222222;
  border-bottom-left-radius: 4px;
}

.plastica-message.user .plastica-bubble {
  background: #0d2035;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* ==========================================================================
   Campo de entrada
   ========================================================================== */
.plastica-input-container {
  display: flex;
  width: 100%;
  margin-top: 8px;
  gap: 8px;
}

.plastica-input-container input,
.plastica-input-container textarea {
  flex: 1;
  border: 1.5px solid #c8c8c8;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  resize: none;
  font-family: 'Open Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.plastica-input-container input:focus,
.plastica-input-container textarea:focus {
  border-color: #d4af37;
}

.plastica-input-container textarea {
  min-height: 80px;
}

.plastica-input-container button {
  background: #d4af37;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.plastica-input-container button:hover {
  background: #b5952f;
  transform: translateY(-1px);
}

/* ==========================================================================
   Responsivo mobile — popup flutuante, NÃO fullscreen
   ========================================================================== */
@media (max-width: 480px) {
  #plastica-chat-popup {
    /* Mantém margens laterais para o popup não colar nas bordas */
    width: 94%;
    max-width: 94%;
    /* Altura máxima: 82% do viewport visível
       dvh desconta o teclado virtual no iOS/Android automaticamente */
    height: min(580px, 82dvh);
    /* Mantém bordas arredondadas — não expande para fullscreen */
    border-radius: 12px;
    /* Margem inferior para não colar no fundo da tela */
    margin-bottom: 4vh;
  }

  /* Fonte ligeiramente menor para caber mais conteúdo sem scroll */
  .plastica-bubble {
    font-size: 0.9rem;
  }

  /* Input menor em telas pequenas para poupar espaço vertical */
  .plastica-input-container textarea {
    min-height: 56px;
  }

  .plastica-input-container input,
  .plastica-input-container textarea {
    font-size: 16px; /* 16px evita zoom automático do Safari ao focar */
  }
}
