/* KNIGHT ASSISTANT --------------------------------------------------------- */
.lrp-knight-home {
    margin-top: 1rem;
}

.lrp-knight-assistant {
    --lrp-primary: #7c3aed;
    --lrp-primary-dark: #5b21b6;
    position: relative;
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
    gap: .9rem;
    padding: .85rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(255, 255, 255, .08);
    transition:
        width .25s ease,
        padding .25s ease,
        background .25s ease,
        box-shadow .25s ease,
        transform .25s ease;
}

.lrp-knight-mascot {
    position: relative;
    width: 104px;
    height: 104px;
    flex: 0 0 104px;
    padding: 0;
    border: 0;
    outline: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .18));
    transition: width .25s ease, height .25s ease, transform .2s ease, filter .2s ease;
}

.lrp-knight-mascot:hover {
    transform: translateY(-2px) scale(1.02);
    filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .22));
}

.lrp-knight-mascot:focus-visible {
    border-radius: 18px;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, .22);
}

.lrp-knight-sprite {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: 50% 50%;
    transition: opacity .08s linear;
}

.lrp-knight-reaction {
    opacity: 0;
}

.lrp-knight-bubble {
    position: relative;
    min-width: 0;
    padding: .75rem .8rem .8rem;
    border-radius: 15px;
    color: #2f2939;
    background: #fff;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .14);
    transform-origin: right bottom;
    transition:
        opacity .22s ease,
        transform .22s ease,
        max-width .22s ease,
        padding .22s ease;
}

.lrp-knight-bubble::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 34px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
}

.lrp-knight-close {
    position: absolute;
    top: .45rem;
    right: .45rem;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: #8c8596;
    background: #f4f1f8;
    font-size: .68rem;
    transition: color .2s ease, background .2s ease;
}

.lrp-knight-close:hover {
    color: var(--lrp-primary-dark);
    background: #eee8f8;
}

.lrp-knight-kicker {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    padding-right: 1.7rem;
    color: var(--lrp-primary-dark);
    font-size: .67rem;
    font-weight: 900;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.lrp-knight-status {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .10);
    animation: lrpKnightStatus 2.2s ease-in-out infinite;
}

.lrp-knight-message {
    margin: .42rem 0 .65rem;
    color: #625b6d;
    font-size: .78rem;
    line-height: 1.55;
    transition: opacity .18s ease, transform .18s ease;
}

.lrp-knight-message.is-changing {
    opacity: 0;
    transform: translateY(3px);
}

.lrp-knight-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    padding: .48rem .7rem;
    border-radius: 10px;
    color: #fff !important;
    background: #16a34a;
    font-size: .72rem;
    font-weight: 850;
    box-shadow: 0 8px 18px rgba(22, 163, 74, .18);
    transition: transform .2s ease, background .2s ease;
}

.lrp-knight-whatsapp:hover {
    transform: translateY(-1px);
    background: #15803d;
}

.lrp-knight-assistant.is-booping .lrp-knight-mascot {
    animation: lrpKnightBoop .42s ease;
}

/* Al abandonar el hero, el asistente se desacopla del panel y pasa a una
   versión compacta en la esquina inferior derecha. */
.lrp-knight-assistant.is-docked {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1045;
    display: flex;
    align-items: flex-end;
    gap: .65rem;
    width: auto;
    max-width: min(360px, calc(100vw - 24px));
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.lrp-knight-assistant.is-docked .lrp-knight-mascot {
    order: 2;
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    border-radius: 22px;
    background:
        radial-gradient(circle at 45% 30%, rgba(255, 255, 255, .95), rgba(245, 240, 255, .92) 58%, rgba(227, 216, 255, .88));
    border: 1px solid rgba(124, 58, 237, .14);
    box-shadow:
        0 12px 30px rgba(61, 43, 100, .18),
        inset 0 0 0 1px rgba(255, 255, 255, .45);
    filter: none;
    backdrop-filter: blur(10px);
}

.lrp-knight-assistant.is-docked .lrp-knight-bubble {
    order: 1;
    width: 260px;
    max-width: calc(100vw - 112px);
    padding: .75rem .8rem .8rem;
    border: 1px solid rgba(124, 58, 237, .12);
    box-shadow: 0 16px 38px rgba(45, 31, 72, .16);
}

.lrp-knight-assistant.is-docked .lrp-knight-bubble::before {
    left: auto;
    right: -7px;
    top: auto;
    bottom: 27px;
}

.lrp-knight-assistant.is-docked.is-collapsed .lrp-knight-bubble {
    display: none;
}

.lrp-knight-assistant.is-docked.is-collapsed .lrp-knight-bubble::before {
    display: none;
}

.lrp-knight-assistant:not(.is-docked).is-collapsed {
    display: inline-flex;
    width: auto;
    min-height: 0;
    padding: .55rem;
    gap: 0;
    align-items: center;
}

.lrp-knight-assistant:not(.is-docked).is-collapsed .lrp-knight-bubble {
    display: none;
}

@keyframes lrpKnightStatus {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, .10);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, .035);
    }
}

@keyframes lrpKnightBoop {
    0%, 100% {
        transform: scale(1);
    }
    24% {
        transform: scale(1.08, .88) translateY(4px);
    }
    55% {
        transform: scale(.95, 1.08) translateY(-3px);
    }
    78% {
        transform: scale(1.025, .98);
    }
}


@media (max-width: 575.98px) {
    .lrp-knight-assistant {
        grid-template-columns: 84px minmax(0, 1fr);
        gap: .65rem;
        padding: .7rem;
    }

    .lrp-knight-mascot {
        width: 84px;
        height: 84px;
        flex-basis: 84px;
    }

    .lrp-knight-message {
        font-size: .73rem;
    }

    .lrp-knight-whatsapp {
        font-size: .68rem;
        padding: .45rem .6rem;
    }

    .lrp-knight-assistant.is-docked {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        max-width: calc(100vw - 18px);
        gap: .45rem;
    }

    .lrp-knight-assistant.is-docked .lrp-knight-mascot {
        width: 64px;
        height: 64px;
        flex-basis: 64px;
        border-radius: 19px;
    }

    .lrp-knight-assistant.is-docked .lrp-knight-bubble {
        width: 220px;
        max-width: calc(100vw - 92px);
        padding: .68rem .72rem .72rem;
    }

    .lrp-knight-assistant.is-docked .lrp-knight-bubble::before {
        bottom: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lrp-knight-assistant *,
    .lrp-knight-assistant *::before,
    .lrp-knight-assistant *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* Commercial landing: fixed, compact help that leaves the purchase action available. */
.commercial-knight-assistant { --lrp-primary:#7c3aed; --lrp-primary-dark:#5624d0; --knight-rgb:124,58,237; --knight-tint:#f5f0ff; }
.commercial-knight-assistant.commercial-knight-hotmart { --lrp-primary:#e66a13; --lrp-primary-dark:#ac4300; --knight-rgb:230,106,19; --knight-tint:#fff2e8; }
.commercial-knight-assistant[hidden] { display:none!important; }
.commercial-knight-assistant.is-docked { right:clamp(12px,2vw,24px); bottom:18px; z-index:1045; }
.commercial-knight-assistant.is-docked .lrp-knight-mascot {
    background:radial-gradient(circle at 45% 30%,#fff,var(--knight-tint) 68%);
    border-color:rgba(var(--knight-rgb),.23);
    box-shadow:0 10px 28px rgba(var(--knight-rgb),.15),inset 0 0 0 1px #fff;
}
.commercial-knight-assistant.is-docked .lrp-knight-bubble { border-color:rgba(var(--knight-rgb),.18); }
.commercial-knight-assistant .lrp-knight-whatsapp { background:#117c46; text-decoration:none; min-height:40px; }
.commercial-knight-assistant .lrp-knight-whatsapp:hover { background:#0b6538; }
.commercial-knight-assistant .lrp-knight-close:focus-visible,.commercial-knight-assistant .lrp-knight-whatsapp:focus-visible { outline:2px solid var(--lrp-primary-dark); outline-offset:3px; }
body.glightbox-open .commercial-knight-assistant,
body.modal-open .commercial-knight-assistant,
body:has(.offcanvas.show) .commercial-knight-assistant { visibility:hidden; pointer-events:none; }
@media(max-width:767px) {
    .commercial-knight-assistant.is-docked { right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); max-width:calc(100vw - 24px); gap:.5rem; }
    body:has(.commercial-mobile-bar:not([hidden])) .commercial-knight-assistant.is-docked { bottom:calc(var(--knight-purchase-height,85px) + 10px); }
    .commercial-knight-assistant.is-docked .lrp-knight-mascot { width:56px; height:56px; flex-basis:56px; border-radius:17px; }
    .commercial-knight-assistant.is-docked .lrp-knight-bubble { width:250px; max-width:calc(100vw - 88px); padding:.8rem; }
    .commercial-knight-assistant .lrp-knight-message { font-size:.8rem; }
    .commercial-knight-assistant .lrp-knight-whatsapp { font-size:.73rem; }
}
