/* Utilidades básicas */
.ai360wc-hidden {
  display: none !important;
}

/* Lanzador base */
.ai360wc-chat-launcher {
  position: fixed;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #25d366;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
}

/* Posiciones del lanzador */
.ai360wc-chat-launcher.ai360wc-pos-right {
  right: 20px;
  bottom: 20px;
}

.ai360wc-chat-launcher.ai360wc-pos-left {
  left: 20px;
  bottom: 20px;
}

.ai360wc-chat-launcher.ai360wc-pos-center {
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
}

/* Ventana de chat */
.ai360wc-chat-window {
  position: fixed;
  width: 320px;
  max-width: 95vw;
  height: 420px;
  max-height: 70vh;
  background-color: #e5ddd5;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Posiciones de la ventana */
.ai360wc-chat-window.ai360wc-pos-right {
  right: 20px;
  bottom: 90px;
}

.ai360wc-chat-window.ai360wc-pos-left {
  left: 20px;
  bottom: 90px;
}

.ai360wc-chat-window.ai360wc-pos-center {
  left: 50%;
  transform: translateX(-50%);
  bottom: 90px;
}

/* Cabecera */
.ai360wc-chat-header {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: #075e54;
  color: #ffffff;
}

.ai360wc-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #128c7e;
  margin-right: 10px;
  position: relative;
}

.ai360wc-chat-avatar::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #25d366;
  bottom: -1px;
  right: -1px;
  border: 2px solid #075e54;
}

.ai360wc-chat-header-text {
  flex: 1;
  min-width: 0;
}

.ai360wc-chat-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai360wc-chat-status {
  font-size: 11px;
  opacity: 0.8;
}

.ai360wc-chat-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
}

/* Cuerpo del chat */
.ai360wc-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow: hidden;
}

.ai360wc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* Burbujas */
.ai360wc-bubble {
  max-width: 80%;
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.ai360wc-bubble-user {
  margin-left: auto;
  background-color: #dcf8c6;
}

.ai360wc-bubble-bot {
  margin-right: auto;
  background-color: #ffffff;
}

/* Indicador de escribiendo */
.ai360wc-chat-typing {
  display: flex;
  align-items: center;
  padding: 4px 0;
}

.ai360wc-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.4);
  margin-right: 3px;
  animation: ai360wc-typing 1s infinite ease-in-out;
}

.ai360wc-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai360wc-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ai360wc-typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Formulario de lead */
.ai360wc-lead-form {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 6px;
  margin-top: 6px;
}

.ai360wc-lead-title {
  font-size: 12px;
  margin-bottom: 4px;
}

.ai360wc-lead-form input,
.ai360wc-lead-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 12px;
  font-family: inherit;
}

.ai360wc-lead-form textarea {
  min-height: 40px;
  resize: vertical;
}

.ai360wc-lead-send {
  display: inline-block;
  background-color: #25d366;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.ai360wc-lead-send:hover {
  background-color: #1ebe5b;
}

.ai360wc-lead-status {
  font-size: 11px;
  margin-top: 2px;
}

/* Área de entrada */
.ai360wc-chat-input-area {
  display: flex;
  align-items: center;
  padding: 6px;
  background-color: #f0f0f0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.ai360wc-lead-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background-color: #25d366;
  color: #ffffff;
  font-size: 18px;
  margin-right: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai360wc-chat-input {
  flex: 1;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  margin-right: 6px;
}

.ai360wc-chat-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background-color: #128c7e;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai360wc-chat-send:hover {
  background-color: #0c6d61;
}

/* Iconos del lanzador */
.ai360wc-chat-launcher-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  position: relative;
}

/* Estilo WhatsApp genérico */
.ai360wc-chat-launcher-icon.ai360wc-icon-whatsapp::before,
.ai360wc-chat-launcher-icon.ai360wc-icon-whatsapp::after {
  content: '';
  position: absolute;
  background-color: #ffffff;
}

.ai360wc-chat-launcher-icon.ai360wc-icon-whatsapp::before {
  width: 60%;
  height: 2px;
  top: 50%;
  left: 20%;
  transform: translateY(-50%);
}

.ai360wc-chat-launcher-icon.ai360wc-icon-whatsapp::after {
  width: 2px;
  height: 60%;
  left: 50%;
  top: 20%;
  transform: translateX(-50%);
}

/* Icono de chat genérico */
.ai360wc-chat-launcher-icon.ai360wc-icon-chat {
  border-width: 0;
  background-color: #ffffff;
}

.ai360wc-chat-launcher-icon.ai360wc-icon-chat::before,
.ai360wc-chat-launcher-icon.ai360wc-icon-chat::after {
  content: '';
  position: absolute;
  background-color: #25d366;
}

.ai360wc-chat-launcher-icon.ai360wc-icon-chat::before {
  width: 70%;
  height: 60%;
  border-radius: 10px;
  top: 15%;
  left: 15%;
}

.ai360wc-chat-launcher-icon.ai360wc-icon-chat::after {
  width: 10px;
  height: 10px;
  bottom: 10%;
  right: 15%;
  transform: rotate(45deg);
}

/* Icono personalizado */
.ai360wc-chat-launcher-icon.ai360wc-icon-custom {
  border: none;
  background-color: transparent;
  overflow: hidden;
}

.ai360wc-chat-launcher-icon.ai360wc-icon-custom::before,
.ai360wc-chat-launcher-icon.ai360wc-icon-custom::after {
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  .ai360wc-chat-window {
    width: 95vw;
    height: 70vh;
  }

  .ai360wc-chat-launcher {
    width: 56px;
    height: 56px;
  }
}
