/* --- CONTENEDOR FLOTANTE ----------------------------------------------- */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: Arial, sans-serif;
    z-index: 9999;
}

/* --- BURBUJA ------------------------------------------------------------ */
#chat-toggle {
    position: absolute;
    /* dentro de #chat-widget */
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: 60px;
    padding: 0;
    background: #1E6EEB;
    color: #fff;
    border: none;
    border-radius: 30px 0 0 30px;
    /* redondeado solo lado izquierdo */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    transition: opacity .2s;
}

#chat-toggle .icon {
    font-size: 22px;
    line-height: 1;
}

#chat-toggle .label {
    white-space: nowrap;
}

#chat-toggle:hover {
    background:#195FD3;
}

#chat-toggle:active {
    opacity: .75;
}

/* Ajusta el contenedor principal para centrar el botón */
#chat-widget {
    bottom: 10%;
    right: 0;
    transform: none;
}

/* Cuando #chat-box esté visible, puedes ocultar la pastilla para no tapar la ventana */
#chat-box:not(.hidden)+#chat-toggle {
    display: none;
}

/* Opcional: elevar z-index por encima de extensiones del navegador */

/* --- CUADRO PRINCIPAL --------------------------------------------------- */
#chat-box {
    width: 300px;
    height: 400px;
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 60px;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
    overflow: hidden;
}

/* oculto/visible */
.hidden {
    display: none;
}

/* --- CABECERA ----------------------------------------------------------- */
#chat-header {
    position: relative;
    z-index: 2;
    background: #0D1540;
    color: #fff;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    pointer-events: auto;
}




/* --- MENSAJES ----------------------------------------------------------- */
#chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #f9f9f9;
}

.bot-message,
.user-message {
    word-break: break-word;   /* corta palabras larguísimas */
    overflow-wrap: anywhere;  /* compatibilidad con todos los navegadores */
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 6px;
    max-width: 80%;
    font-size: 14px;
}

.bot-message {
    background: #eee;
}

.user-message {
    background:#DCEBFF; 
    align-self: flex-end;
    text-align: right;
}

/* --- INPUT -------------------------------------------------------------- */
#chat-input {
    display: flex;
    border-top: 1px solid #ccc;
}

#chat-input input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 14px;
}

#chat-input button {
    background: #1E6EEB;
    color: #fff;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
}

#chat-box.hidden {
    display: none;
}

/* === Botones menú ====================================================== */
#bot-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* align-items: center; */
}

.menu-btn {
    width: 60%;
    margin: 0;
    padding: 6px 10px;
    border: 2px solid #1E6EEB;
    /* rojo claro */
    background: #fff;
    color: #1E6EEB;
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    gap: 6px;
    line-height: 1.2;
}

.menu-btn:hover {
    background:#DCEBFF;
}

.menu-btn:active {
    background: #ffd5c6;
}

/* separa mensajes del input */
#chat-input {
    margin-top: auto;
}

/* GIF dentro del globo */
.bot-gif {
    display: block;
    width: 140px;
    /* o 100% para que se adapte */
    margin: 8px auto 4px;
    /* centra dentro del globo */
}

/* menú deshabilitado */
#bot-menu.disabled {
    opacity: .45;
    pointer-events: none;
}

/* botón “Menú principal” dentro de la respuesta */
.btn-main-menu {
    margin-top: 8px;
    padding: 6px 12px;
    background: #ff9800;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}


/* sugerencias que devuelve el backend */
.quick-replies     { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.qr-btn            { padding:4px 10px; font-size:12px; border:1px solid #1E6EEB;
                     background:#fff; color:#1E6EEB; border-radius:4px; cursor:pointer; }
.qr-btn:hover      { background:#DCEBFF; }




.typing {
    color:#888;
    font-style:normal;
    display:flex;
    align-items:center;
    gap:4px;
}
.typing::after {
    content:'';
    width:6px;
    height:6px;
    border-radius:50%;
    background:#888;
    animation: blink 1s infinite steps(1);
}
@keyframes blink { 0%,20%{opacity:0;} 50%{opacity:1;} 100%{opacity:0;} }

/* Centrar la imagen del saludo */

.bot-gif {
    display: block;               /* quita posible inline-gap */
    margin: 6px auto 8px;         /* top 6 px, bottom 8 px (ajusta a gusto) */
    max-width: 140px;             /* opcional: controla tamaño */
}