/*==================================================
        JENNY IA - PROINTSEG (CSS Corregido)
==================================================*/

.jenny-container {
    position: fixed;
    right: 25px;
    bottom: 105px;
    z-index: 999999;
    font-family: 'Poppins', sans-serif;
}

/*==================================
BOTÓN FLOTANTE
==================================*/

.jenny-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #0D6EFD;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
    transition: transform 0.35s ease;
}

.jenny-avatar:hover {
    transform: scale(1.08);
}

.jenny-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*==================================
VENTANA COMPACTA DE JENNY
==================================*/

.jenny-chat {
    position: absolute;
    right: 0;
    bottom: 85px;
    width: 330px;         /* Reducido de 360px */
    height: 550px;        /* Reducido de 620px para que no abarque toda la pantalla */
    max-height: 75vh;     /* Nunca superará el 80% de la altura de la pantalla */
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    display: none;
    box-shadow: 0 15px 40px rgba(0,0,0,.25);
    flex-direction: column;
}

.jenny-chat.active {
    display: flex !important;
}

/* Ajuste responsive para celulares */
@media (max-width: 480px) {
    .jenny-container {
        right: 10px;
        bottom: 20px;
    }
    .jenny-chat {
        width: 90vw;      /* Ocupa el 90% del ancho del celular */
        height: 70vh;     /* Ocupa el 70% del alto */
        bottom: 75px;
        right: 0;
    }
}

/*==================================
HEADER
==================================*/

.jenny-header {
    height: 78px;
    background: linear-gradient(90deg, #0E2A57, #154FA8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    color: #fff;
    flex-shrink: 0;
}

.company img {
    height: 35px;
}

.header-buttons {
    display: flex;
    gap: 15px;
}

.header-buttons button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: opacity 0.2s ease;
}

.header-buttons button:hover {
    opacity: 0.8;
}

/*==================================
PERFIL
==================================*/

.jenny-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #ececec;
    flex-shrink: 0;
}

.jenny-profile img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0D6EFD;
}

.jenny-profile h3 {
    margin: 0;
    font-size: 18px;
    color: #222;
}

.jenny-profile span {
    display: block;
    color: #777;
    font-size: 13px;
}

.online {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #3BB54A;
}

.status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3BB54A;
}

/*==================================
MENSAJES
==================================*/

.jenny-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #F6F8FB;
}

.message {
    display: flex;
    margin-bottom: 18px;
    align-items: flex-end;
}

.message.received,
.message.bot-message {
    justify-content: flex-start;
}

.message.sent,
.message.user-message {
    justify-content: flex-end;
}

.message .avatar {
    margin-right: 8px;
    flex-shrink: 0;
}

.message .avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.bubble {
    max-width: 240px;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.received .bubble,
.bot-message .bubble {
    background: #ffffff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.sent .bubble,
.user-message .bubble {
    background: #0D6EFD;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.time {
    margin-top: 6px;
    font-size: 10px;
    opacity: .75;
    text-align: right;
}

/*==================================
ANIMACIÓN "JENNY ESTÁ ESCRIBIENDO..."
==================================*/

.typing-wrapper {
    margin-bottom: 12px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #0D6EFD;
    border-radius: 50%;
    display: inline-block;
    animation: jennyBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes jennyBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/*=========================================
   ÁREA DE ENTRADA / INPUT (UNIFICADA)
==========================================*/

.jenny-input {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #ffffff;
    border-top: 1px solid #ececec;
    gap: 10px;
    flex-shrink: 0;
}

.jenny-input input {
    flex: 1;
    height: 44px;
    border: 1px solid #d9d9d9;
    border-radius: 22px;
    padding: 0 16px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    background-color: #f8fafc;
    color: #333333;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.jenny-input input:focus {
    border-color: #0D6EFD;
    background-color: #ffffff;
    box-shadow: 0 0 5px rgba(13, 110, 253, 0.2);
}

.jenny-input button {
    width: 44px;
    height: 44px;
    background-color: #0D6EFD;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.jenny-input button:hover {
    background-color: #084BB8;
    transform: scale(1.05);
}

.jenny-input button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.jenny-input button i {
    font-size: 15px;
    margin-left: -2px; /* Centra visualmente el icono del avión */
}

/*==================================
SCROLLBAR
==================================*/

.jenny-messages::-webkit-scrollbar {
    width: 6px;
}

.jenny-messages::-webkit-scrollbar-thumb {
    background: #cfd8e5;
    border-radius: 10px;
}

/*==================================
RESPONSIVE
==================================*/

@media(max-width: 768px) {
    .jenny-container {
        right: 15px;
        bottom: 90px;
    }

    .jenny-chat {
        width: 320px;
        height: 560px;
    }
}