/* ============================================================
   CHAT-MODULE — estilos del chat de prospección (autocontenido)
   Prefijo waq- para no chocar con ningún otro componente del
   portal. Familiar, no imitación: cabecera verde, fondo claro con
   trama sutil, burbujas redondeadas, hora y doble check propios.
   Móvil: pantalla completa. Modo incrustado: #waq-overlay.waq-embedded.
   ============================================================ */

#waq-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
#waq-overlay.waq-hidden { display: none; }

#waq-card {
    display: flex;
    flex-direction: column;
    width: min(420px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 48px));
    background: #efeae2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 8c1.6 3.6-1.4 5.8-4 5.2-2.8-.6-4.4 2.6-2.4 4.6 1.8 1.8-.2 5-2.8 4.2-2.8-.8-4.6 2.6-2.4 4.6' fill='none' stroke='%23e2ddd3' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

/* ---------- Cabecera verde ---------- */
#waq-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #075e54;
    color: #fff;
}
#waq-back { display: none; cursor: pointer; font-size: 20px; line-height: 1; }
#waq-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #128c7e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.5px;
}
#waq-header-texto { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
#waq-header-texto strong { font-size: 15px; }
#waq-estado { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 5px; }
#waq-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}
#waq-dot.waq-escribiendo { animation: waq-pulso 1s infinite alternate; }
@keyframes waq-pulso { from { opacity: 0.35; } to { opacity: 1; } }
#waq-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

/* ---------- Mensajes ---------- */
#waq-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}
.waq-fila { display: flex; }
.waq-fila.waq-lead { justify-content: flex-end; }
.waq-burbuja {
    max-width: 78%;
    padding: 7px 10px 4px;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
    position: relative;
}
.waq-fila.waq-lead .waq-burbuja {
    background: #d9fdd3;
    border-top-right-radius: 2px;
}
.waq-fila.waq-bot .waq-burbuja { border-top-left-radius: 2px; }
.waq-pie {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 10.5px;
    color: #6b7280;
    margin-top: 2px;
}
.waq-doble-check { display: inline-flex; color: #53bdeb; }
.waq-doble-check svg { width: 15px; height: 11px; }

/* Burbuja "escribiendo…" */
.waq-escr-burbuja { display: inline-flex; gap: 4px; align-items: center; padding: 10px 12px; }
.waq-escr-punto {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: waq-salto 1.1s infinite;
}
.waq-escr-punto:nth-child(2) { animation-delay: 0.15s; }
.waq-escr-punto:nth-child(3) { animation-delay: 0.3s; }
@keyframes waq-salto {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Respuestas rápidas ---------- */
#waq-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 12px 8px;
}
#waq-quick.waq-hidden { display: none; }
.waq-chip {
    border: 1px solid #128c7e;
    color: #075e54;
    background: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.waq-chip:hover { background: #e7f7f1; }

/* ---------- Barra de entrada ---------- */
#waq-entrada {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f0f2f5;
}
#waq-input {
    flex: 1;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #111827;
}
#waq-input:disabled { background: #e5e7eb; }
#waq-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #128c7e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
#waq-send:hover { background: #0e6f64; }
#waq-send:disabled { background: #9ca3af; cursor: not-allowed; }

/* ---------- Salida final a WhatsApp ---------- */
#waq-final { padding: 10px 12px 14px; background: #f0f2f5; text-align: center; }
#waq-final.waq-hidden { display: none; }
.waq-btn-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25d366;
    color: #ffffff; /* texto e ícono blancos (dueño 2026-10-21): el #053b2b anterior se perdía sobre el verde */
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    border-radius: 999px;
    padding: 11px 20px;
}
.waq-btn-wa:hover { filter: brightness(0.95); }
#waq-final-nota { display: block; margin-top: 6px; font-size: 11.5px; color: #6b7280; }

/* ---------- Móvil: pantalla completa ---------- */
@media (max-width: 640px) {
    #waq-overlay { align-items: stretch; padding: 0; }
    #waq-card {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    #waq-back { display: inline; }
}

/* ---------- Modo incrustado (CONECTAR opcional) ---------- */
#waq-overlay.waq-embedded {
    position: static;
    background: none;
    padding: 0;
}
#waq-overlay.waq-embedded #waq-card {
    width: 100%;
    height: 560px;
    max-height: none;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
