/* =========================================================
   CHAT WIDGET (layout)
   ========================================================= */
#ti-chat-bubble{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: flex;
  align-items:center;
  justify-content:center;
  cursor: pointer;
  z-index: 999999;
  box-shadow: 0 10px 25px var(--chat-shadow);
  background: var(--chat-primary);
  overflow: hidden;
}

/* Avatar (foto do atendente) */
#ti-chat-bubble .ti-avatar{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.05);
  filter: saturate(1.05);
  margin:0px;
}

/* Mãozinha (fica por cima e anima) */
#ti-chat-bubble .ti-wave{
  position: absolute;
  right: -2px;
  bottom: -4px;
  font-size: 22px;
  transform-origin: 30% 80%;
  animation: wave 1.2s ease-in-out infinite;
  text-shadow: 0 6px 14px rgba(0,0,0,.25);
}

@keyframes wave{
  0%,100% { transform: rotate(0deg); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(14deg); }
  80% { transform: rotate(-6deg); }
}

/* Painel */
#ti-chat-panel{
  position: fixed;
  right: 18px;
  bottom: 94px;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 480px;
  max-height: calc(100vh - 130px);
  z-index: 999999;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 45px var(--chat-shadow);
  background: var(--chat-card);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,.08);
}

#ti-chat-header{
  display:flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px;
  background: var(--chat-primary);
  color: #fff;
}
#ti-chat-title{ font-weight: 700; font-size: 14px; line-height: 1.1; }
#ti-chat-subtitle{ font-size: 12px; opacity: .85; margin-top: 2px; }

#ti-chat-close{
  border:0; background: transparent; color:#fff; font-size: 18px;
  cursor:pointer; padding:6px 8px; border-radius:8px;
}
#ti-chat-close:hover{ background: rgba(255,255,255,.10); }

#ti-chat-messages{
  padding: 12px;
  overflow:auto;
  flex: 1;
  background: var(--chat-bg);
}

.ti-msg{ margin: 8px 0; display:flex; }
.ti-msg .ti-bubble{
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}
.ti-user{ justify-content: flex-end; }
.ti-user .ti-bubble{
  background: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.ti-bot{ justify-content: flex-start; }
.ti-bot .ti-bubble{
  background: var(--chat-card);
  color: var(--chat-text);
  border-bottom-left-radius: 5px;
}

#ti-chat-typing{
  padding: 6px 12px;
  font-size: 12px;
  color: var(--chat-muted);
  background: var(--chat-bg);
}

#ti-chat-form{
  display:flex;
  gap: 8px;
  padding: 10px;
  background: var(--chat-card);
  border-top: 1px solid rgba(0,0,0,.08);
}
#ti-chat-input{
  flex:1;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 10px;
  font-size: 13px;
  outline: none;
}
#ti-chat-input:focus{ border-color: var(--chat-primary); }
#ti-chat-send{
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--chat-primary);
  color: #fff;
  cursor:pointer;
  font-size: 13px;
}
#ti-chat-send:disabled{ opacity:.6; cursor:not-allowed; }

.ti-hidden{ display:none !important; }


/* HEADER COM LOGO */
.ti-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ti-chat-logo {
  height: 36px;
  width: auto;
  border-radius: 6px;
}

.ti-chat-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

/* Mobile ajuste */
@media (max-width: 480px) {
  .ti-chat-logo {
    height: 30px;
  }
}

.ti-whatsapp-btn{
  display:inline-block;
  background:#25D366;
  color:#fff;
  padding:10px 14px;
  border-radius:999px;
  text-decoration:none;
  font-weight:700;
}
.ti-whatsapp-btn:hover{ filter:brightness(.95); }


