/**
 * BUSVE 9.1.4.4 — Barra flotante estable, minimalista y sin vibración.
 * No usa transform en ancestros de las ventanas fijas.
 */
#busve-floating-tools {
    --busve-dock-size: 164px;
    --busve-dock-gap: 8px;
    position: fixed;
    right: 12px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 180px;
    z-index: 2147483000;
    pointer-events: none;
    font-family: Inter, Arial, sans-serif;
    overflow: visible;
}

#busve-floating-tools[hidden] { display: none !important; }

#busve-floating-tools .busve-floating-tools-items {
    position: relative;
    left: 0;
    width: var(--busve-dock-size);
    margin-left: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--busve-dock-gap);
    opacity: 1;
    visibility: visible;
    transform: none !important;
    transition: left .28s cubic-bezier(.2,.8,.2,1), opacity .18s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

#busve-floating-tools.is-collapsed .busve-floating-tools-items {
    left: 188px;
    opacity: 0;
    visibility: hidden;
    transform: none !important;
    pointer-events: none;
    transition: left .28s cubic-bezier(.2,.8,.2,1), opacity .18s ease, visibility 0s linear .28s;
}

#busve-floating-tools .busve-floating-tools-toggle {
    position: absolute;
    right: 168px;
    top: 50%;
    width: 28px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(10,76,255,.18);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: #fff;
    color: #0A4CFF;
    box-shadow: -7px 8px 24px rgba(15,23,42,.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transform: translateY(-50%);
    transition: right .28s cubic-bezier(.2,.8,.2,1), background .18s ease, color .18s ease;
    -webkit-tap-highlight-color: transparent;
}

#busve-floating-tools .busve-floating-tools-toggle:hover,
#busve-floating-tools .busve-floating-tools-toggle:focus-visible {
    background: #eff6ff;
    color: #083ebf;
    outline: 2px solid rgba(10,76,255,.22);
    outline-offset: 2px;
}

#busve-floating-tools.is-collapsed .busve-floating-tools-toggle { right: 0; }

#busve-floating-tools .busve-floating-tools-chevron {
    display: block;
    font-size: 18px;
    line-height: 1;
    font-weight: 950;
    transition: transform .28s ease;
}

#busve-floating-tools.is-collapsed .busve-floating-tools-chevron { transform: rotate(180deg); }

#busve-floating-tools .busve-floating-tools-badge {
    position: absolute;
    left: -5px;
    top: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 950;
    line-height: 14px;
    text-align: center;
    box-sizing: border-box;
}

#busve-floating-tools .busve-floating-tools-badge:empty,
#busve-floating-tools .busve-floating-tools-badge[data-count="0"] { display: none; }

/* Los roots originales permanecen completos para conservar sus listeners. */
#busve-floating-tools .busve-task-root:not(.busve-task-inline),
#busve-floating-tools .busve-help-root:not(.busve-help-inline),
#busve-floating-tools .busve-pwa-float {
    position: relative !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    top: auto !important;
    z-index: auto !important;
    width: var(--busve-dock-size) !important;
    max-width: var(--busve-dock-size) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
    transform: none !important;
    transition: opacity .18s ease !important;
}

#busve-floating-tools .busve-floating-tool-button,
#busve-floating-tools .busve-task-fab,
#busve-floating-tools .busve-help-fab,
#busve-floating-tools .busve-pwa-float-btn {
    position: relative !important;
    box-sizing: border-box !important;
    width: var(--busve-dock-size) !important;
    min-width: var(--busve-dock-size) !important;
    max-width: var(--busve-dock-size) !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 15px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    box-shadow: 0 10px 26px rgba(15,23,42,.20) !important;
    transform: none !important;
    transition: box-shadow .16s ease, filter .16s ease, outline-color .16s ease !important;
    -webkit-tap-highlight-color: transparent;
}

/* No mover el botón al hacer hover: moverlo debajo del cursor producía el bucle visual. */
#busve-floating-tools .busve-floating-tool-button:hover,
#busve-floating-tools .busve-floating-tool-button:focus-visible,
#busve-floating-tools .busve-task-fab:hover,
#busve-floating-tools .busve-task-fab:focus-visible,
#busve-floating-tools .busve-help-fab:hover,
#busve-floating-tools .busve-help-fab:focus-visible,
#busve-floating-tools .busve-pwa-float-btn:hover,
#busve-floating-tools .busve-pwa-float-btn:focus-visible {
    width: var(--busve-dock-size) !important;
    min-width: var(--busve-dock-size) !important;
    max-width: var(--busve-dock-size) !important;
    padding: 0 !important;
    border-radius: 15px !important;
    transform: none !important;
    box-shadow: 0 14px 30px rgba(15,23,42,.25) !important;
    filter: brightness(1.035);
    outline: 2px solid rgba(255,255,255,.95) !important;
    outline-offset: 2px !important;
}

#busve-floating-tools .busve-float-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 19px !important;
    line-height: 1 !important;
    margin: 0 !important;
}

#busve-floating-tools .busve-float-label,
#busve-floating-tools .busve-task-fab > strong {
    display: inline-block !important;
    min-width: 0;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
}

#busve-floating-tools .busve-task-fab > em,
#busve-floating-tools .busve-task-fab:hover > em,
#busve-floating-tools .busve-task-fab:focus > em,
#busve-floating-tools .busve-task-fab:active > em {
    position: absolute !important;
    left: -6px !important;
    right: auto !important;
    top: -6px !important;
    min-width: 19px !important;
    width: auto !important;
    height: 19px !important;
    padding: 0 5px !important;
    border: 2px solid #fff !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    line-height: 15px !important;
    z-index: 3;
}

/* Etiqueta informativa: no cambia el tamaño ni la posición del botón. */
#busve-floating-tools .busve-floating-tool-button::after {
    display: none !important;
    content: attr(data-busve-float-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: 8px 10px;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.1;
    white-space: nowrap;
    box-shadow: 0 10px 26px rgba(15,23,42,.22);
    transition: opacity .12s ease, visibility 0s linear .12s;
}

#busve-floating-tools .busve-floating-tool-button:hover::after,
#busve-floating-tools .busve-floating-tool-button:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transition-delay: .12s;
}

/* Tareas y Ayuda se fijan contra la ventana, nunca contra el botón. */
#busve-floating-tools .busve-task-panel,
#busve-floating-tools .busve-help-panel {
    position: fixed !important;
    right: 206px !important;
    left: auto !important;
    top: auto !important;
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    z-index: 2147483600 !important;
    pointer-events: auto !important;
    transform: none !important;
    contain: none !important;
}

body.busve-task-panel-open #busve-floating-tools,
body.busve-help-panel-open #busve-floating-tools,
body.busve-task-panel-open #busve-floating-tools .busve-floating-tools-items,
body.busve-help-panel-open #busve-floating-tools .busve-floating-tools-items,
body.busve-task-panel-open #busve-floating-tools .busve-task-root,
body.busve-help-panel-open #busve-floating-tools .busve-help-root {
    transform: none !important;
    overflow: visible !important;
}

.busve-pwa-modal { z-index: 2147483646 !important; }

@media (max-width: 720px) {
    #busve-floating-tools {
        --busve-dock-size: 44px;
        right: 0;
        --busve-dock-gap: 7px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: 58px;
    }

    #busve-floating-tools .busve-floating-tools-items { margin-left: 5px; }

    #busve-floating-tools .busve-floating-tool-button,
    #busve-floating-tools .busve-task-fab,
    #busve-floating-tools .busve-help-fab,
    #busve-floating-tools .busve-pwa-float-btn {
        height: var(--busve-dock-size) !important;
        min-height: var(--busve-dock-size) !important;
        max-height: var(--busve-dock-size) !important;
        gap: 0 !important;
    }
    #busve-floating-tools .busve-float-label,
    #busve-floating-tools .busve-task-fab > strong { display: none !important; }
    #busve-floating-tools.is-collapsed .busve-floating-tools-items { left: 70px; }

    #busve-floating-tools .busve-floating-tools-toggle {
        right: 50px;
        width: 27px;
        height: 43px;
    }

    #busve-floating-tools.is-collapsed .busve-floating-tools-toggle { right: 0; }
    #busve-floating-tools .busve-float-icon { font-size: 18px !important; }
    #busve-floating-tools .busve-floating-tool-button::after { display: none !important; }

    #busve-floating-tools .busve-task-panel,
    #busve-floating-tools .busve-help-panel {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        top: 12px !important;
        bottom: calc(76px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        border-radius: 18px !important;
    }

    body.busve-floating-widgets-active .busve-app-container .busve-app-main,
    body.busve-floating-widgets-active .busve-app-container.busve-v2-shell .busve-app-main {
        padding-bottom: 88px !important;
    }
}

@media (hover: none), (pointer: coarse) {
    #busve-floating-tools .busve-floating-tool-button::after { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    #busve-floating-tools *,
    #busve-floating-tools *::before,
    #busve-floating-tools *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

/* BUSVE 9.2.6.7 — Academia integrada al dock flotante sin colisiones */
#busve-floating-tools .busve-academia-root:not(.is-inline){
    position:relative!important;right:auto!important;left:auto!important;bottom:auto!important;top:auto!important;
    z-index:auto!important;width:var(--busve-dock-size)!important;max-width:var(--busve-dock-size)!important;
    margin:0!important;padding:0!important;overflow:visible!important;opacity:1!important;transform:none!important;
}
#busve-floating-tools .busve-academia-launch,
#busve-floating-tools .busve-academia-launch:hover,
#busve-floating-tools .busve-academia-launch:focus-visible{
    position:relative!important;right:auto!important;left:auto!important;bottom:auto!important;top:auto!important;
    box-sizing:border-box!important;width:var(--busve-dock-size)!important;min-width:var(--busve-dock-size)!important;max-width:var(--busve-dock-size)!important;
    height:48px!important;min-height:48px!important;max-height:48px!important;padding:0!important;margin:0!important;border-radius:15px!important;
    display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;transform:none!important;
    box-shadow:0 10px 26px rgba(15,23,42,.20)!important;
}
#busve-floating-tools .busve-academia-launch:hover,
#busve-floating-tools .busve-academia-launch:focus-visible{box-shadow:0 14px 30px rgba(15,23,42,.25)!important;filter:brightness(1.035);outline:2px solid rgba(255,255,255,.95)!important;outline-offset:2px!important}
#busve-floating-tools .busve-academia-launch span{display:inline-flex!important;align-items:center;justify-content:center;width:24px;height:24px;font-size:19px!important;line-height:1!important;margin:0!important}
#busve-floating-tools .busve-academia-launch b{display:inline-block!important;min-width:0;max-width:112px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px!important;font-weight:900!important;line-height:1.1!important}
#busve-floating-tools .busve-academia-launch em{position:absolute!important;left:-6px!important;right:auto!important;top:-6px!important;min-width:19px!important;width:auto!important;height:19px!important;padding:0 5px!important;border:2px solid #fff!important;border-radius:999px!important;font-size:10px!important;line-height:15px!important;z-index:3}
#busve-floating-tools .busve-academia-drawer{position:fixed!important;right:206px!important;left:auto!important;top:auto!important;bottom:calc(18px + env(safe-area-inset-bottom))!important;z-index:2147483600!important;pointer-events:auto!important;transform:none!important;contain:none!important}
body.busve-academia-panel-open #busve-floating-tools,
body.busve-academia-panel-open #busve-floating-tools .busve-floating-tools-items,
body.busve-academia-panel-open #busve-floating-tools .busve-academia-root{transform:none!important;overflow:visible!important}
@media(max-width:720px){
    #busve-floating-tools .busve-academia-launch,
    #busve-floating-tools .busve-academia-launch:hover,
    #busve-floating-tools .busve-academia-launch:focus-visible{height:var(--busve-dock-size)!important;min-height:var(--busve-dock-size)!important;max-height:var(--busve-dock-size)!important;gap:0!important}
    #busve-floating-tools .busve-academia-launch b{display:none!important}
    #busve-floating-tools .busve-academia-launch span{font-size:18px!important}
    #busve-floating-tools .busve-academia-drawer{position:fixed!important;left:10px!important;right:10px!important;top:12px!important;bottom:calc(76px + env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;height:auto!important;max-height:none!important;border-radius:18px!important}
}
