/* ==========================================
   ESTILOS PREMIUM - CHATBOT WHYAWEB
   ========================================== */

#whyaweb-bot-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Burbuja flotante con degradado y pulso animado */
#whyaweb-bot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa, #005177);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
}

#whyaweb-bot-bubble:hover {
    transform: scale(1.08);
}

/* Animación de pulso */
.whyaweb-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    opacity: 0.6;
    animation: whyawebPulseAnim 2s infinite;
    z-index: -1;
}

@keyframes whyawebPulseAnim {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* 1. VENTANA DE CHAT PARA ORDENADOR (Panel lateral alto y fijo) */
#whyaweb-bot-window {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    top: 0 !important;
    width: 380px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    background: #ffffff;
    border-radius: 0 !important;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.whyaweb-hidden {
    display: none !important;
    opacity: 0;
    transform: translateX(100%);
}

/* 2. ADAPTACIÓN EXCLUSIVA PARA MÓVILES (Menor o igual a 768px) */
@media (max-width: 768px) {
    #whyaweb-bot-window {
        position: fixed !important;
        top: auto !important;
        bottom: 10px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        height: 75vh !important; /* Altura perfecta para que se vea el campo de texto y el botón */
        max-height: 550px !important;
        border-radius: 16px !important;
        z-index: 9999999 !important;
        box-shadow: 0 10px 35px rgba(0,0,0,0.3) !important;
    }
}

/* Cabecera optimizada (Evita solapamientos y desajustes) */
#whyaweb-bot-header {
    background: #0073aa;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-sizing: border-box;
}

.whyaweb-header-left {
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-grow: 1;
    margin-right: 10px;
}

.whyaweb-avatar {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}

.whyaweb-header-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whyaweb-status {
    font-size: 11px;
    opacity: 0.9;
}

.whyaweb-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.whyaweb-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}

.whyaweb-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Zona de Mensajes y Disclaimer DSGVO */
#whyaweb-bot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f7f9fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.whyaweb-legal-disclaimer {
    background: #ffffff;
    border-left: 4px solid #ffb900;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-size: 13px;
    line-height: 1.5;
    color: #333333;
}

.whyaweb-legal-disclaimer a {
    color: #0073aa;
    text-decoration: underline;
}

#whyaweb-accept-legal {
    background: #0073aa;
    color: #ffffff;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
    font-weight: 600;
}

/* Burbujas de Mensaje */
.whyaweb-msg {
    display: flex;
}
.whyaweb-msg-user { justify-content: flex-end; }
.whyaweb-msg-bot { justify-content: flex-start; }

.whyaweb-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
}

.whyaweb-msg-user .whyaweb-msg-bubble {
    background: #0073aa;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.whyaweb-msg-bot .whyaweb-msg-bubble {
    background: #ffffff;
    color: #333333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Área de Input inferior */
#whyaweb-bot-input-area {
    display: flex;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #eaeaea;
}

.whyaweb-disabled {
    opacity: 0.5;
    background: #fafafa !important;
}

#whyaweb-user-input {
    flex: 1;
    border: 1px solid #cccccc;
    border-radius: 20px;
    padding: 8px 16px;
    outline: none;
    font-size: 16px !important; /* CLAVE: Evita el zoom automático en móviles */
}

#whyaweb-send-btn {
    background: none;
    border: none;
    color: #0073aa;
    margin-left: 8px;
    cursor: pointer;
}

/* Animación de los tres puntitos saltando (...) */
.whyaweb-typing span {
    content: '';
    animation: whyawebBlink 1.4s infinite both;
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #888888;
    border-radius: 50%;
    margin: 0 2px;
}
.whyaweb-typing span:nth-child(2) { animation-delay: .2s; }
.whyaweb-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes whyawebBlink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* Estilos para el botón del micrófono */
#whyaweb-mic-btn {
    background: none;
    border: none;
    color: #64748b;
    margin-left: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
}

#whyaweb-mic-btn:hover {
    color: #0073aa;
}

/* Efecto visual cuando el micrófono está escuchando activamente */
#whyaweb-mic-btn.whyaweb-recording svg {
    color: #ef4444 !important;
    animation: whyawebMicPulse 1.2s infinite;
}

@keyframes whyawebMicPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}