/* Asesoría Técnica — única implementación del chatbot */
.chatbot-anchor {
    position: fixed;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chatbot-launcher {
    position: relative;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.chatbot-panel {
    --chatbot-blue: var(--color-primary, #1565c0);
    --chatbot-blue-dark: var(--color-primary-dark, #0d47a1);
    --chatbot-blue-soft: var(--color-primary-soft, #f2f7fd);
    --chatbot-border: #d7e2ee;
    --chatbot-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    position: fixed;
    right: 16px;
    bottom: 88px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 32px));
    height: min(620px, calc(100dvh - 112px));
    min-height: min(430px, calc(100dvh - 112px));
    overflow: hidden;
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 24px 56px rgba(13, 71, 161, 0.18), 0 8px 20px rgba(13, 71, 161, 0.08);
    font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transform-origin: 92% 100%;
}

.chatbot-panel--entrando {
    animation: chatbot-panel-entrar 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-panel--saliendo {
    animation: chatbot-panel-salir 380ms ease-in forwards;
}

@keyframes chatbot-panel-entrar {
    0% {
        opacity: 0;
        transform: scale(0.86) translateY(18px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes chatbot-panel-salir {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.9) translateY(14px);
    }
}

.chatbot-panel__efecto-quimico {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.chatbot-panel__efecto-quimico span {
    position: absolute;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(100, 196, 255, 0.42) 0%, rgba(21, 101, 192, 0.14) 52%, transparent 72%);
    opacity: 0;
    animation: chatbot-quimica-pulso 480ms ease-out forwards;
}

@keyframes chatbot-quimica-pulso {
    0% {
        opacity: 0.85;
        transform: scale(0.25);
    }

    65% {
        opacity: 0.4;
    }

    100% {
        opacity: 0;
        transform: scale(2.1);
    }
}

.chatbot-panel__header,
.chatbot-body,
.chatbot-panel__quick-options,
.chatbot-panel__input-area {
    position: relative;
    z-index: 1;
}

.chatbot-panel[hidden] {
    display: none !important;
}

.chatbot-panel__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
    min-height: 48px;
    padding: 8px 10px 8px 14px;
    background: var(--chatbot-blue-dark);
    color: #ffffff;
}

.chatbot-panel__titulo {
    min-width: 0;
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.chatbot-panel__cerrar {
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 160ms ease, border-color 160ms ease, transform 140ms var(--chatbot-ease-out);
}

.chatbot-panel__cerrar {
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    border-radius: 9px;
}

.chatbot-panel__cerrar .material-symbols-outlined {
    font-size: 20px;
}

@media (hover: hover) and (pointer: fine) {
    .chatbot-panel__cerrar:hover {
        border-color: rgba(255, 255, 255, 0.72);
        background: rgba(255, 255, 255, 0.24);
    }
}

.chatbot-panel__cerrar:active,
.chatbot-panel__opcion:active,
.chatbot-panel__enviar:active {
    transform: scale(0.97);
}

.chatbot-panel__cerrar:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.chatbot-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    background: #f6f8fb;
    scrollbar-color: #9fb3c8 transparent;
    scrollbar-width: thin;
}

.chatbot-panel__mensaje {
    max-width: 85%;
    padding: 11px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.chatbot-panel__fila--bot {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    align-self: flex-start;
    max-width: 92%;
}

.chatbot-panel__avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.chatbot-panel__fila--bot .chatbot-panel__mensaje {
    max-width: 100%;
}

.chatbot-panel__mensaje--bot {
    align-self: flex-start;
    border: 1px solid #dbe6f1;
    border-bottom-left-radius: 6px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.06);
    color: #173a60;
}

.chatbot-panel__mensaje--usuario {
    align-self: flex-end;
    max-width: 80%;
    border-bottom-right-radius: 6px;
    background: var(--chatbot-blue);
    box-shadow: 0 5px 12px rgba(21, 101, 192, 0.16);
    color: #ffffff;
}

.chatbot-panel__mensaje-texto {
    display: block;
    color: inherit;
    white-space: pre-line;
}

.chatbot-panel__correo {
    color: inherit;
    font-weight: 800;
}

.chatbot-panel__mensaje-introduccion {
    margin-bottom: 10px;
}

.chatbot-panel__pasos {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: chatbot-paso;
}

.chatbot-panel__pasos li {
    position: relative;
    min-height: 28px;
    padding-left: 36px;
    color: inherit;
    counter-increment: chatbot-paso;
}

.chatbot-panel__pasos li::before {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 8px;
    background: var(--chatbot-blue-soft);
    color: var(--chatbot-blue-dark);
    content: counter(chatbot-paso);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.chatbot-panel__mensaje--producto {
    display: grid;
    gap: 7px;
    padding: 13px 14px;
}

.chatbot-panel__mensaje-titulo {
    display: block;
    color: var(--chatbot-blue-dark);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.chatbot-panel__mensaje-codigo {
    justify-self: start;
    padding: 3px 8px;
    border: 1px solid #c7dbef;
    border-radius: 999px;
    background: var(--chatbot-blue-soft);
    color: var(--chatbot-blue-dark);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: 0.04em;
}

.chatbot-options {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-height: 116px;
    overflow-y: auto;
    padding: 6px 10px;
    border-top: 1px solid #e1e8f0;
    background: #ffffff;
}

.chatbot-panel__opcion {
    display: flex;
    width: auto;
    flex: 0 0 auto;
    max-width: 100%;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid var(--chatbot-blue);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(21, 101, 192, 0.06);
    color: var(--chatbot-blue-dark);
    cursor: pointer;
    font-family: inherit;
    font-size: 12.75px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 140ms var(--chatbot-ease-out);
}

.chatbot-panel__opcion[data-action="enlace"]::after {
    margin-left: 6px;
    content: '\2192';
    font-size: 1em;
    line-height: 1;
}

.chatbot-panel__opcion--secundaria {
    width: auto;
    min-height: 30px;
    padding: 5px 9px;
    border-color: #c7d5e4;
    border-radius: 999px;
    background: #f5f8fb;
    box-shadow: none;
    color: #405a77;
    font-size: 12.5px;
}

@media (hover: hover) and (pointer: fine) {
    .chatbot-panel__opcion:not(.chatbot-panel__opcion--secundaria):hover {
        border-color: #0e56a8;
        background: #0e5eb8;
        color: #ffffff;
        box-shadow: 0 5px 12px rgba(14, 94, 184, 0.16);
    }

    .chatbot-panel__opcion--secundaria:hover {
        border-color: #8da9c5;
        background: #e8f0f8;
        color: #173b66;
    }
}

.chatbot-panel__opcion:focus-visible,
.chatbot-panel__input:focus-visible,
.chatbot-panel__enviar:focus-visible,
.chatbot-launcher:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.chatbot-panel__input-area {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    padding: 9px 12px;
    border-top: 1px solid #e1e8f0;
    background: #ffffff;
}

.chatbot-panel__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    padding: 8px 11px;
    border: 1px solid #bdcad8;
    border-radius: 10px;
    background: #ffffff;
    color: #102d4d;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.chatbot-panel__input::placeholder {
    color: #70859c;
}

.chatbot-panel__input:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.chatbot-panel__enviar {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: var(--chatbot-blue);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 160ms ease, transform 140ms var(--chatbot-ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .chatbot-panel__enviar:hover {
        background: #0d4f99;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .chatbot-panel__mensaje {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 180ms var(--chatbot-ease-out), transform 180ms var(--chatbot-ease-out);
    }

    @starting-style {
        .chatbot-panel__mensaje {
            opacity: 0;
            transform: translateY(4px);
        }
    }
}

@media (max-width: 480px) {
    .chatbot-panel {
        right: 8px;
        bottom: 80px;
        width: calc(100vw - 16px);
        height: min(570px, calc(100dvh - 96px));
        min-height: min(410px, calc(100dvh - 96px));
        border-radius: 16px;
    }

    .chatbot-panel__header {
        min-height: 48px;
        padding-block: 8px;
    }

    .chatbot-panel__mensaje {
        max-width: 88%;
        font-size: 13.5px;
    }

    .chatbot-panel__mensaje--usuario {
        max-width: 80%;
    }

    .chatbot-options {
        max-height: 112px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-panel__mensaje,
    .chatbot-panel__cerrar,
    .chatbot-panel__opcion,
    .chatbot-panel__enviar {
        transition-duration: 0.01ms;
        transform: none;
    }
}

.bottom-margin-desktop { bottom: 24px !important; }
.right-margin-desktop { right: 24px !important; }

.chatbot-anchor__base {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0;
}

.chatbot-welcome {
    --chatbot-welcome-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    width: min(248px, calc(100vw - 120px));
    margin-bottom: 10px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(14px) scale(0.94);
    transition: opacity 280ms ease-out, transform 320ms var(--chatbot-welcome-ease);
}

.chatbot-welcome--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-welcome__decoracion {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
}

.chatbot-welcome__burbuja {
    position: absolute;
    border-radius: 999px;
    background: rgba(21, 101, 192, 0.18);
    opacity: 0;
}

.chatbot-welcome__burbuja--1 {
    right: 18px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    animation: chatbot-burbuja-subir 2.6s ease-out infinite;
}

.chatbot-welcome__burbuja--2 {
    right: 42px;
    bottom: 4px;
    width: 7px;
    height: 7px;
    animation: chatbot-burbuja-subir 2.6s ease-out 0.5s infinite;
}

.chatbot-welcome__burbuja--3 {
    right: 8px;
    bottom: 14px;
    width: 5px;
    height: 5px;
    animation: chatbot-burbuja-subir 2.6s ease-out 1s infinite;
}

@keyframes chatbot-burbuja-subir {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.6);
    }

    18% {
        opacity: 0.75;
    }

    100% {
        opacity: 0;
        transform: translateY(-36px) scale(1.15);
    }
}

.chatbot-welcome__bocadillo {
    position: relative;
}

.chatbot-welcome__cerrar {
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d7e2ee;
    border-radius: 999px;
    background: #ffffff;
    color: #0d47a1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.12);
    transition: background-color 160ms ease, transform 140ms var(--chatbot-welcome-ease);
}

.chatbot-welcome__cerrar .material-symbols-outlined {
    font-size: 18px;
}

.chatbot-welcome__contenido {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #d7e2ee;
    border-radius: 18px;
    background: #ffffff;
    color: #0d47a1;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 16px 40px rgba(13, 71, 161, 0.16), 0 6px 16px rgba(13, 71, 161, 0.08);
    transition: box-shadow 180ms ease, transform 180ms var(--chatbot-welcome-ease);
}

.chatbot-welcome__contenido::after {
    content: '';
    position: absolute;
    right: 22px;
    bottom: -9px;
    width: 16px;
    height: 16px;
    border-right: 1px solid #d7e2ee;
    border-bottom: 1px solid #d7e2ee;
    background: #ffffff;
    transform: rotate(45deg);
}

.chatbot-welcome__mensaje {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
}

.chatbot-welcome__mascota {
    flex: 0 0 auto;
    width: 104px;
    height: auto;
    margin-right: -4px;
    margin-bottom: -2px;
    object-fit: contain;
    opacity: 0;
    transform: translateX(18px) translateY(10px) scale(0.82);
    transform-origin: 90% 100%;
    transition: transform 360ms var(--chatbot-welcome-ease) 100ms, opacity 260ms ease-out 100ms;
    pointer-events: none;
}

.chatbot-anchor--welcome .chatbot-welcome__mascota {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
    animation: chatbot-mascota-flotar 2.8s ease-in-out 0.4s infinite;
}

@keyframes chatbot-mascota-flotar {
    0%,
    100% {
        transform: translateX(0) translateY(0) scale(1);
    }

    50% {
        transform: translateX(0) translateY(-4px) scale(1);
    }
}

@media (hover: hover) {
    .chatbot-welcome__cerrar:hover {
        background: #f2f7fd;
    }

    .chatbot-welcome__contenido:hover {
        box-shadow: 0 20px 44px rgba(13, 71, 161, 0.2), 0 8px 18px rgba(13, 71, 161, 0.1);
        transform: translateY(-1px);
    }
}

.chatbot-welcome__cerrar:focus-visible,
.chatbot-welcome__contenido:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .chatbot-welcome {
        width: min(220px, calc(100vw - 104px));
    }

    .chatbot-welcome__mascota {
        width: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-panel--entrando,
    .chatbot-panel--saliendo,
    .chatbot-panel__efecto-quimico span {
        animation: none;
    }

    .chatbot-welcome,
    .chatbot-welcome__mascota,
    .chatbot-welcome__cerrar,
    .chatbot-welcome__contenido,
    .chatbot-welcome__burbuja {
        animation: none;
        transition-duration: 0.01ms;
        transform: none;
    }

    .chatbot-anchor--welcome .chatbot-welcome__mascota {
        opacity: 1;
    }
}
