/* Widget de chatbot y boton de WhatsApp - integrado con la identidad del sitio */
#tuseg-widgets {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.tuseg-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  text-decoration: none;
  transition: transform .15s ease;
}
.tuseg-fab:hover { transform: translateY(-2px); color: #fff; }

.tuseg-fab-whatsapp { background: #25d366; }
.tuseg-fab-chat { background: #2d6df6; }

.tuseg-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
}

.tuseg-chat-header {
  background: #0033a0;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tuseg-chat-header strong { display: block; font-size: 15px; }
.tuseg-chat-header span { display: block; font-size: 11px; color: #9fe6b0; margin-top: 2px; }
.tuseg-chat-header span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d058;
  margin-right: 5px;
}
.tuseg-chat-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.tuseg-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7f8fa;
}

.tuseg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.tuseg-bubble-bot {
  align-self: flex-start;
  background: #eceff3;
  color: #252a2c;
  border-bottom-left-radius: 3px;
}
.tuseg-bubble-user {
  align-self: flex-end;
  background: #2d6df6;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.tuseg-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}
.tuseg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa1ab;
  display: inline-block;
  animation: tuseg-typing-bounce 1.2s infinite ease-in-out;
}
.tuseg-typing span:nth-child(2) { animation-delay: 0.15s; }
.tuseg-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes tuseg-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.tuseg-chat-actions {
  padding: 0 14px 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #f7f8fa;
}
.tuseg-action-btn {
  border: 1px solid #2d6df6;
  color: #2d6df6;
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  font-weight: 600;
}
.tuseg-action-btn:hover { background: #2d6df6; color: #fff; }

.tuseg-chat-form {
  display: flex;
  border-top: 1px solid #e7e7ea;
  padding: 10px;
  gap: 8px;
  background: #fff;
}
.tuseg-chat-form input {
  flex: 1;
  border: 1px solid #e2e2e6;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
}
.tuseg-chat-form input:focus { border-color: #2d6df6; }
.tuseg-chat-form button {
  background: #2d6df6;
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

@media (max-width: 420px) {
  #tuseg-widgets { right: 14px; bottom: 14px; }
  .tuseg-chat-panel { right: 14px; left: 14px; width: auto; bottom: 84px; }
}
