/* ============================================
   WHATSAPP CHAT — Botón flotante + mini-chat
   ============================================ */

/* ── Botón flotante ── */
.wa-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 5000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45), 0 0 0 0 rgba(37, 211, 102, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: wa-pulse 2.5s infinite;
}

.wa-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(37, 211, 102, 0.6);
  animation: none;
}

.wa-fab--open {
  animation: none;
  background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
}

@keyframes wa-pulse {
  0%   { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45), 0 0 0 0 rgba(37, 211, 102, 0.4); }
  70%  { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45), 0 0 0 18px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45), 0 0 0 0 rgba(37, 211, 102, 0.4); }
}

/* ── Panel del chat ── */
.wa-chat {
  position: fixed;
  bottom: 7rem;
  right: 2rem;
  z-index: 4999;
  width: 370px;
  max-height: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.wa-chat--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header del chat ── */
.wa-chat__header {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.wa-chat__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.wa-chat__info h4 {
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.wa-chat__info p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  margin: 0;
}

.wa-chat__status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #76FF03;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Cuerpo del chat (burbujas) ── */
.wa-chat__body {
  padding: 1rem;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #f0f0f0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(217, 4, 41, 0.03) 0%, transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(37, 211, 102, 0.03) 0%, transparent 60%);
}

/* Burbuja del bot */
.wa-chat__bubble {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 0 12px 12px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  animation: wa-bubbleIn 0.35s ease-out;
}

/* Burbuja del usuario (Texto 100% Legible) */
.wa-chat__bubble--user {
  align-self: flex-end;
  border-radius: 12px 0 12px 12px;
  background: #075E54;
  border: 1px solid #128C7E;
  color: #ffffff;
  font-weight: 500;
}

@keyframes wa-bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Input actual (campo de pregunta) ── */
.wa-chat__input-area {
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--color-surface);
}

.wa-chat__input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 24px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.3s;
}

.wa-chat__input::placeholder {
  color: var(--color-text-muted);
}

.wa-chat__input:focus {
  border-color: #25D366;
}

.wa-chat__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #25D366;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
  flex-shrink: 0;
}

.wa-chat__send:hover {
  background: #128C7E;
  transform: scale(1.1);
}

.wa-chat__send:disabled {
  background: #555;
  cursor: not-allowed;
  transform: none;
}

/* ── Opciones (botones de respuesta rápida) ── */
.wa-chat__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  animation: wa-bubbleIn 0.35s ease-out;
}

.wa-chat__option {
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  border: 1px solid rgba(37, 211, 102, 0.4);
  background: transparent;
  color: #25D366;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.wa-chat__option:hover {
  background: rgba(37, 211, 102, 0.15);
  border-color: #25D366;
  transform: translateY(-1px);
}

/* ── Typing indicator ── */
.wa-chat__typing {
  display: flex;
  gap: 4px;
  padding: 0.7rem 1rem;
  max-width: 70px;
  border-radius: 0 12px 12px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.wa-chat__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: wa-typingDot 1.4s infinite;
}

.wa-chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.wa-chat__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wa-typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ── Botón final de enviar a WhatsApp ── */
.wa-chat__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
  animation: wa-bubbleIn 0.35s ease-out;
}

.wa-chat__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .wa-chat {
    right: 0.8rem;
    left: 0.8rem;
    bottom: 6rem;
    width: auto;
  }

  .wa-fab {
    bottom: 1.2rem;
    right: 1.2rem;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
}
