@import url('./variables.css');

/* ============================================
   BOTÃO FLUTUANTE (TOGGLER)
============================================ */
.chatbot-toggler {
  position: fixed;
  right: 35px;
  bottom: 30px;
  height: 52px;
  width: 52px;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.25 ease;
  z-index: 1000;

  /* Glassmorphism no tom Azul/Vinho da marca */
  background: rgba(66, 85, 122, 0.85);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px rgba(182, 35, 31, 0.3);
}

.chatbot-toggler:hover {
  background: var(--primary-red, #b6231f);
  transform: scale(1.08);
  box-shadow: 0 10px 25px rgba(182, 35, 31, 0.45);
}

.show-chatbot .chatbot-toggler {
  transform: rotate(90deg);
  background: var(--primary-red, #b6231f);
}

.chatbot-toggler span {
  position: absolute;
  font-size: 1.5rem;
}

.show-chatbot .chatbot-toggler span:first-child,
.chatbot-toggler span:last-child {
  opacity: 0;
}

.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
}

/* ============================================
   JANELA DO CHAT (GLASSMORPHISM EMBUTIDO)
============================================ */
.chatbot {
  position: fixed;
  right: 35px;
  bottom: 95px;
  width: 380px;

  /* Animação e comportamento original */
  transform: scale(0.5);
  opacity: 0;
  pointer-events: none;

  overflow: hidden;
  border-radius: 18px;
  transform-origin: bottom right;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);

  /* Estilo Glassmorphism Burgundy / Warm Dark */
  background: rgba(30, 15, 20, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid rgba(182, 35, 31, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);

  z-index: 2000;
}

.show-chatbot .chatbot {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   HEADER DO CHAT
============================================ */
.chatbot header {
  background: rgba(182, 35, 31, 0.88);
  backdrop-filter: blur(10px);
  padding: 14px 20px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot header h2 {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
  padding: 0;
  flex: 1;
  text-align: center;
  text-transform: uppercase;
}

.chatbot header span {
  position: absolute;
  right: 16px;
  top: 50%;
  color: #ffffff;
  cursor: pointer;
  display: none;
  transform: translateY(-50%);
  font-size: 1.3rem;
  transition: opacity 0.2s ease;
}

.chatbot header span:hover {
  opacity: 0.8;
}

/* ============================================
   CAIXA DE MENSAGENS (CHATBOX)
============================================ */
.chatbot .chatbox {
  height: 420px;
  overflow-y: auto;
  padding: 20px 16px 80px 16px;
  display: flex;
  flex-direction: column;
}

.chatbox .chat {
  display: flex;
  margin-bottom: 12px;
}

/* Avatar do Bot (Incoming) */
.chatbox .incoming span {
  height: 34px;
  width: 34px;
  color: #ffffff;
  align-self: flex-end;

  background: var(--accent-blue, #42557a);
  backdrop-filter: blur(6px);

  text-align: center;
  line-height: 34px;
  border-radius: 8px;

  margin: 0 10px 2px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 1.1rem;
}

/* Balão de Mensagem Enviada (Outgoing - Usuário) */
.chatbox .outgoing {
  justify-content: flex-end;
}

.chatbox .outgoing p {
  color: #ffffff;
  max-width: 78%;
  white-space: pre-wrap;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 14px 14px 2px 14px;

  /* Gradiente marcante no tom vermelho da marca */
  background: linear-gradient(135deg, rgba(182, 35, 31, 0.95), rgba(150, 25, 20, 0.95));
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(182, 35, 31, 0.3);
}

/* Balão de Mensagem Recebida (Incoming - Bot) */
.chatbox .incoming p {
  color: #f1f5f9;
  max-width: 78%;
  white-space: pre-wrap;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 2px;

  /* Vidro fosco escuro para contraste suave */
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}

/* ============================================
   INPUT DE MENSAGEM
============================================ */
.chatbot .chat-input {
  position: absolute;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;

  background: rgba(20, 10, 12, 0.85);
  backdrop-filter: blur(12px);

  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.chat-input textarea {
  height: 45px;
  width: 100%;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  padding: 12px 10px 12px 0;

  color: #ffffff;
  background: transparent;
}

.chat-input textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.chat-input span {
  align-self: center;
  color: #ff9d9a;
  font-size: 1.4rem;
  cursor: pointer;
  visibility: hidden;
  transition: transform 0.15s ease, color 0.15s ease;
}

.chat-input span:hover {
  color: #ffffff;
  transform: scale(1.1);
}

.chat-input textarea:valid ~ span {
  visibility: visible;
}

/* ============================================
   RESPONSIVIDADE (MOBILE)
============================================ */
@media(max-width: 490px) {
  .chatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .chatbot .chatbox {
    height: calc(100% - 110px);
  }

  .chatbot header span {
    display: block;
  }
}