/* Botón Flotante */
#kmar-ai-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999999;
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: kmar-pulse 2s infinite;
}
#kmar-ai-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.6);
}

/* Ventana del Chat */
#kmar-ai-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 360px;
    height: 500px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
}
#kmar-ai-window.kmar-ai-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Cabecera */
.kmar-ai-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#kmar-ai-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Área de Mensajes */
#kmar-ai-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.kmar-ai-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.kmar-ai-msg.bot {
    background: #ffffff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.kmar-ai-msg.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.kmar-ai-msg a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}
.kmar-ai-msg.user a {
    color: #fff;
    text-decoration: underline;
}

/* Área de Input */
.kmar-ai-input-area {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #eaeaea;
    gap: 10px;
}
#kmar-ai-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
}
#kmar-ai-input:focus {
    border-color: #667eea;
}
#kmar-ai-send {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
#kmar-ai-send:hover {
    transform: scale(1.05);
}
#kmar-ai-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Animación */
@keyframes kmar-pulse {
    0% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(118, 75, 162, 0); }
    100% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0); }
}

/* Responsive Móvil */
@media (max-width: 480px) {
    #kmar-ai-window {
        width: calc(100% - 30px);
        right: 15px;
        bottom: 90px;
        height: 60vh;
    }
    #kmar-ai-btn {
        right: 15px;
        bottom: 15px;
        width: 60px;
        height: 60px;
    }
}