/* Gavi — asistente de NewBird */
#gavi { --g-tinta: #2e2725; --g-naranja: #e57c0b; --g-verde: #2f8f84; font-family: 'Montserrat', 'Segoe UI', sans-serif; }

.gavi-lanzador {
    position: fixed; right: 20px; bottom: 92px; z-index: 1600;
    width: 62px; height: 62px; padding: 0; border: 3px solid #fff; border-radius: 50%;
    background: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.28);
    transition: transform .2s ease;
    animation: gavi-entra .5s ease both;
}
.gavi-lanzador:hover { transform: scale(1.07) rotate(-4deg); }
.gavi-lanzador:focus-visible { outline: 3px solid var(--g-naranja); outline-offset: 3px; }
.gavi-lanzador img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.gavi-punto { position: absolute; right: 1px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%; background: #2ecc71; border: 2px solid #fff; }
#gavi.fuera .gavi-punto { background: var(--g-naranja); }
#gavi.abierto .gavi-lanzador { transform: scale(.92); }
@keyframes gavi-entra { from { opacity: 0; transform: translateY(16px) scale(.8); } to { opacity: 1; transform: none; } }

.gavi-aviso {
    position: fixed; right: 92px; bottom: 100px; z-index: 1600; max-width: 250px;
    background: #fff; color: var(--g-tinta); border-radius: 14px 14px 4px 14px;
    padding: .8rem 2rem .8rem .95rem; box-shadow: 0 8px 24px rgba(0,0,0,.18);
    font-size: .88rem; line-height: 1.4; cursor: pointer; animation: gavi-entra .4s ease both;
}
.gavi-aviso p { margin: 0; }
.gavi-aviso-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 1.2rem; line-height: 1; color: #888; cursor: pointer; padding: 2px 4px; }

.gavi-panel {
    position: fixed; right: 20px; bottom: 166px; z-index: 1700;
    width: 360px; max-width: calc(100vw - 32px); height: min(540px, calc(100vh - 190px));
    background: #f6f3ef; border-radius: 16px; overflow: hidden;
    box-shadow: 0 16px 40px rgba(0,0,0,.28);
    display: flex; flex-direction: column;
    animation: gavi-entra .25s ease both;
}
.gavi-panel[hidden] { display: none; }

.gavi-cab { background: var(--g-tinta); color: #fff; display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; }
.gavi-cab img { border-radius: 50%; background: #fff; flex: none; }
.gavi-cab div { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.gavi-cab strong { font-size: 1rem; }
.gavi-cab span { font-size: .75rem; opacity: .8; }
.gavi-cerrar { border: 0; background: none; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }

.gavi-mensajes { flex: 1; overflow-y: auto; padding: .9rem .8rem; display: flex; flex-direction: column; gap: .55rem; }
.gavi-msg { max-width: 86%; padding: .6rem .8rem; border-radius: 14px; font-size: .9rem; line-height: 1.45; word-wrap: break-word; }
.gavi-msg.bot { background: #fff; color: var(--g-tinta); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.gavi-msg.yo { background: var(--g-naranja); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.gavi-msg.escribe { display: flex; gap: 4px; padding: .75rem .9rem; }
.gavi-msg.escribe span { width: 7px; height: 7px; border-radius: 50%; background: #bbb; animation: gavi-punto 1s infinite ease-in-out; }
.gavi-msg.escribe span:nth-child(2) { animation-delay: .15s; }
.gavi-msg.escribe span:nth-child(3) { animation-delay: .3s; }
@keyframes gavi-punto { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.gavi-acciones { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.gavi-acciones a, .gavi-acciones button {
    font: 600 .78rem 'Montserrat', sans-serif; color: var(--g-tinta); background: #f6f3ef;
    border: 1px solid #e0d8cf; border-radius: 16px; padding: .4rem .7rem; text-decoration: none; cursor: pointer;
}
.gavi-acciones a.wa { background: #25D366; border-color: #25D366; color: #fff; }
.gavi-acciones a:hover, .gavi-acciones button:hover { border-color: var(--g-naranja); }

.gavi-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .35rem .8rem .55rem; max-height: 132px; overflow-y: auto; border-top: 1px solid #ece6df; }
.gavi-chips:empty { display: none; }
.gavi-chips button {
    flex: none; font: 500 .78rem 'Montserrat', sans-serif; color: var(--g-naranja); background: #fff;
    border: 1px solid var(--g-naranja); border-radius: 16px; padding: .4rem .75rem; cursor: pointer; white-space: normal; max-width: 100%; text-align: left; line-height: 1.25;
}
.gavi-chips button:hover { background: var(--g-naranja); color: #fff; }

.gavi-form { display: flex; gap: .4rem; padding: .55rem .6rem; background: #fff; border-top: 1px solid #eee; }
.gavi-form input { flex: 1; border: 1px solid #ddd; border-radius: 20px; padding: .6rem .9rem; font: 400 .9rem 'Montserrat', sans-serif; min-width: 0; }
.gavi-form input:focus { outline: none; border-color: var(--g-naranja); }
.gavi-form button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--g-naranja); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.gavi-wa { display: block; text-align: center; font-size: .75rem; color: #1a8f4c; background: #fff; padding: 0 0 .55rem; text-decoration: none; }
.gavi-wa:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .gavi-lanzador { right: 16px; bottom: 86px; width: 56px; height: 56px; }
    .gavi-aviso { right: 82px; bottom: 92px; max-width: calc(100vw - 110px); }
    .gavi-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: none; height: 82vh; border-radius: 16px 16px 0 0; }
    .gavi-msg { font-size: .92rem; }
    #gavi.abierto .gavi-lanzador { display: none; }
}
/* pantallas bajas: el chat usa toda la altura, al lado del ave */
@media (max-height: 680px) and (min-width: 601px) {
    .gavi-panel { bottom: 20px; right: 96px; height: calc(100vh - 40px); }
}
@media (prefers-reduced-motion: reduce) {
    .gavi-lanzador, .gavi-aviso, .gavi-panel { animation: none; }
    .gavi-msg.escribe span { animation: none; }
}
