/* --- ESTILOS PARA EL CHATBOT DE IA OMNIPRESENTE --- */
.ai-assistant {
    position: fixed;
    bottom: 88px;
    right: 22px;
    z-index: 1010;
}
.ai-avatar {
    width: 60px;
    height: 60px;
    background: var(--navy);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s ease-in-out;
}
.ai-avatar:hover {
    transform: scale(1.1);
}
.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--cyan);
    animation: pulse 1.5s infinite;
    z-index: -1;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

.ai-chat-window {
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 90px);
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 152px;
    right: 0;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}
.ai-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.ai-chat-header {
    background: var(--navy);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-header-info h4 { margin: 0; font-size: 1rem; }
.ai-header-info span { font-size: 0.8rem; color: #90cdf4; }
.ai-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.ai-chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ai-message {
    max-width: 85%;
    padding: 0.75rem;
    border-radius: 15px;
    line-height: 1.4;
}
.ai-message p { margin: 0 0 0.5rem 0; }
.ai-message small { font-size: 0.8em; opacity: 0.8; }

.ai-message-user {
    background: var(--cyan);
    color: white;
    border-bottom-right-radius: 5px;
    align-self: flex-end;
}
.ai-message-bot {
    background: #f1f5f9;
    color: var(--navy);
    border-bottom-left-radius: 5px;
    align-self: flex-start;
}
.ai-message-typing {
    font-style: italic;
    color: #64748b;
}

.ai-chat-input-form {
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
}
#aiChatForm {
    display: flex;
    align-items: center;
    gap: 10px;
}
#aiChatInput {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0.5rem;
    background: transparent;
}
#aiChatForm button {
    background: var(--cyan);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
#aiChatForm button:hover {
    background: var(--navy);
}

/* LA BURBUJA DE IA EN MÓVIL (07/11/2026): más pequeña y pegada a la esquina para no
   tapar el CTA del comparador ni la valoración de la ficha de app. */
@media (max-width: 768px) {
    .ai-assistant {
        right: 6px;
        bottom: 12px;
    }
    .ai-avatar {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
    .ai-pulse {
        display: none;
    }
    .ai-chat-window {
        bottom: 56px;
        width: min(370px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
    }
}
