/*Chat Container*/
.chatbox {
    position: absolute;
    bottom: 30px;
    right: 30px;
}

.chatbox_soporte {
    position: fixed;
    bottom: 25px;
    /* CORRECCIÓN: Alineado a 20px igual que WhatsApp */
    right: 20px;
    display: flex;
    flex-direction: column;
    background: white;
    width: 300px;
    height: 350px;
    z-index: -12345;
    opacity: 0;
    transition: all .5s ease-in-out;
    /* Agregamos sombra para que se vea mejor al flotar */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    border-radius: 10px; 
    overflow: hidden;
}

/*Para el JS*/
.chatbox--active {
    transform: translateY(-40px);
    z-index: 123456;
    opacity: 1;
}

.chatbox_header {
    position: sticky;
    top: 0;
    background: orange;
    padding: 10px; 
    color: white; 
    font-weight: bold;
}

/* =========================================
   BOTÓN DEL CHAT Y ANIMACIONES
   ========================================= */

@keyframes shake-icon {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pulse-orange {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 165, 0, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(255, 165, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 165, 0, 0); }
}

.chatbox_button {
    position: fixed;
    /* text-align: right; -> Ya no es necesario con flex */
    bottom: 15px; /* Ajustado ligeramente */
    
    /* CORRECCIÓN CLAVE: 20px a la derecha */
    right: 5px;
    
    /* CORRECCIÓN DE TAMAÑO: Igualar a WhatsApp */
    width: 60px;
    height: 60px;
    
    /* Centrar imagen */
    display: flex;
    justify-content: center;
    align-items: center;
    
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 50%;
    z-index: 123457;
}

/* Aseguramos que la imagen del botón llene el espacio correctamente */
.chatbox_button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.chatbox_button:hover {
    animation: pulse-orange 1.5s infinite;
}

.chatbox_button:hover img {
    animation: shake-icon 0.5s ease-in-out;
}

/*Mensajes*/
.chatbox_mensajes {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    flex-direction: column-reverse;
    padding: 10px;
}

.mensajes_item {
    background-color: orange;
    color: white;
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 15px;
    max-width: 80%;
    width: fit-content;
}

.mensajes_item-visitante {
    margin-left: auto;
    background-color: #333;
    color: white;
}

.mensajes_item-operador {
    margin-right: auto;
}

/*Footer*/
.chatbox_footer {
    position: sticky;
    bottom: 0;
    justify-content: space-between;
    display: flex;
    padding: 10px;
    background: #f9f9f9;
}