/* ==============================
   CHAT — CSS AJUSTADO
============================== */

/* Wrapper: sem card extra */
.chat-wrapper{
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* ==============================
   BARRA SUPERIOR
============================== */

.chat-top-bar{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.chat-top-bar small{
  color: #666;
  font-size: 14px;
}

/* ==============================
   CAIXA PRINCIPAL
============================== */

.chat-box{
  position: relative;
  background: #ffffff;
  border: 1px solid #e3e6ea;
  border-radius: 14px;
  padding: 10px;
  height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

/* container interno das mensagens */
#chatMessages{
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

/* ==============================
   MENSAGENS
============================== */

.chat-message{
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 0;
  background: #f1f3f5;
  border: 1px solid #e6e8eb;
  animation: chatFadeIn .15s ease-out;
}

.chat-message.mine{
  background: #e7f6df;
  border-color: #d2ebc7;
}

.chat-user{
  font-weight: 700;
  color: #0d6efd;
  float: left;
}

.chat-user.mine{
  color: #198754;
}

.chat-time{
  float: right;
  font-size: 11px;
  color: #6c757d;
}

.chat-text{
  margin-top: 4px;
  color: #212529;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.35;
}

/* ==============================
   EMOJIS
============================== */

.chat-emoji-bar{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px;
  padding: 8px 10px;
  background: #f6f7f9;
  border: 1px solid #e3e6ea;
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
}

.chat-emoji-bar span{
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform .12s ease;
}

.chat-emoji-bar span:hover{
  transform: scale(1.15);
}

/* ==============================
   FORMULÁRIO
============================== */

.chat-form{
  margin-top: 0;
}

.chat-form textarea{
  resize: none;
  height: 54px;
  font-size: 14px;
  border-radius: 0 0 12px 12px;
  border: 1px solid #e3e6ea;
}

.chat-form textarea:focus{
  box-shadow: none;
  border-color: #86b7fe;
}

.chat-form button{
  padding: 7px 14px;
  font-size: 14px;
  border-radius: 8px;
}

.chat-typing{
  font-size: 12px;
  color: #777;
  margin-top: 6px;
}

/* ==============================
   OVERLAY (Bem-vindo)
============================== */

.chat-box .chat-welcome-overlay{
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 14px;
}

/* card do login */
.chat-welcome-card{
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px;
  max-width: 340px;
  width: calc(100% - 28px);
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  border: 1px solid #e9ecef;
}

.chat-welcome-card h5{
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 700;
  color: #212529;
}

.chat-welcome-card p{
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 15px;
}

.chat-welcome-card input{
  border-radius: 10px;
  height: 44px;
  font-size: 14px;
}

.chat-welcome-card button{
  border-radius: 10px;
  font-weight: 600;
  height: 44px;
}

/* ==============================
   INTEGRAÇÃO COM O INDEX
============================== */

section.chat-section.card .chat-wrapper{
  width: 100%;
}

/* ==============================
   SCROLL
============================== */

.chat-box::-webkit-scrollbar{
  width: 8px;
}

.chat-box::-webkit-scrollbar-thumb{
  background: #cfd4da;
  border-radius: 8px;
}

.chat-box::-webkit-scrollbar-track{
  background: transparent;
}

/* ==============================
   ANIMAÇÃO
============================== */

@keyframes chatFadeIn{
  from{
    opacity: 0;
    transform: translateY(4px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================
   RESPONSIVO
============================== */

@media (max-width: 767px){
  .chat-top-bar{
    flex-direction: column;
    align-items: stretch;
  }

  .chat-box{
    height: 320px;
  }

  .chat-welcome-card{
    max-width: 92%;
    padding: 18px 16px;
  }

  .chat-welcome-card h5{
    font-size: 24px;
  }

  .chat-emoji-bar{
    flex-wrap: wrap;
  }
}