/* Contenedor flotante base */
.saber11-react-widget {
    position: fixed;
    z-index: 1100;
    right: 28px;
    bottom: 28px;
    pointer-events: none;
}

/* Caja disparadora con dimensiones fijas para evitar cualquier salto horizontal o vertical */
.saber11-trigger-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 190px;
    height: 124px;
    pointer-events: none;
}

/* Píldora superior "¿Necesitas Ayuda?" con flotación suave */
.saber11-pill-badge {
    position: relative;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 18px;
    margin-bottom: 10px;
    white-space: nowrap;
    background: linear-gradient(135deg, #1d68ed 0%, #1754c9 100%);
    border: 2.5px solid #ffffff;
    border-radius: 9999px;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(29, 104, 237, 0.45), 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.22s ease, visibility 0.22s ease;
    animation: saber11-pill-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both, label-float 3.8s ease-in-out infinite;
}

.saber11-pill-badge:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(29, 104, 237, 0.6), 0 2px 8px rgba(0, 0, 0, 0.16);
}

.saber11-pill-badge--hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(6px) scale(0.95);
    animation: none !important;
}

.saber11-pill-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8, 0 0 14px rgba(56, 189, 248, 0.85);
    display: inline-block;
    animation: dot-blink 2.4s ease-in-out infinite;
}

.saber11-pill-text {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.4px;
    line-height: 1;
    color: #ffffff;
    text-transform: none;
    user-select: none;
}

/* Botón flotante circular con animación de flotación y pulso */
.saber11-react-launcher {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    pointer-events: auto;
    color: #ffffff;
    background: radial-gradient(circle at 50% 45%, #38bdf8 0%, #2563eb 55%, #1d4ed8 100%);
    border: 3.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.55),
                0 0 0 7px rgba(125, 211, 252, 0.25),
                0 10px 26px rgba(14, 56, 122, 0.4);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    animation: launcher-float 3.8s ease-in-out infinite, launcher-attention 7s ease-in-out infinite;
}

.saber11-react-launcher:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.75),
                0 0 0 9px rgba(125, 211, 252, 0.35),
                0 14px 30px rgba(14, 56, 122, 0.5);
    animation-play-state: paused;
}

.saber11-react-launcher:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 4px;
}

/* Halo concéntrico con pulso */
.saber11-react-launcher-glow {
    position: absolute;
    inset: -6px;
    border: 1.5px solid rgba(125, 211, 252, 0.65);
    border-radius: 50%;
    animation: launcher-pulse 2.6s ease-in-out infinite;
    pointer-events: none;
}

.saber11-react-launcher-icon {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
}

/* Insignia de notificación */
.saber11-react-notification {
    position: absolute;
    z-index: 3;
    top: -1px;
    right: -1px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: #0f326a;
    border: 2px solid #ffffff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    animation: notification-pop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* =========================================
   Animaciones del personaje Robot Sabi (SVG)
   ========================================= */

/* Brazo izquierdo saludando */
.saber11-svg-arm-wave {
    transform-origin: 14px 23.5px;
    animation: robot-wave-arm 3.2s ease-in-out infinite;
}

/* Antena meciéndose */
.saber11-svg-antenna {
    transform-origin: 24px 16px;
    animation: antenna-wiggle 4s ease-in-out infinite;
}

/* Onda radial emitida por la antena */
.saber11-svg-antenna-wave {
    transform-origin: 24px 9.5px;
    animation: antenna-wave 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

/* Parpadeo natural de los ojos */
.saber11-svg-eyes {
    transform-origin: 24px 23.2px;
    animation: robot-blink 3.8s ease-in-out infinite;
}

/* Sonrisa sutil */
.saber11-svg-smile {
    animation: smile-bounce 3.8s ease-in-out infinite;
}

/* =========================================
   Modal del chat / Iframe independiente
   ========================================= */
.saber11-react-panel {
    position: fixed !important;
    z-index: 1100 !important;
    right: 28px !important;
    bottom: 104px !important;
    width: min(540px, calc(100vw - 20px));
    height: min(650px, calc(100vh - 124px));
    min-height: 400px;
    pointer-events: auto;
    filter: drop-shadow(0 20px 45px rgba(6, 27, 95, 0.18));
    animation: saber11-chat-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    background: transparent !important;
    border-radius: 20px;
    overflow: visible !important;
}

.saber11-react-panel--closed {
    display: none !important;
}

.saber11-react-panel--open {
    display: block !important;
}

.saber11-react-frame {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    background: transparent !important;
    overflow: visible !important;
}

/* =========================================
   Keyframes
   ========================================= */
@keyframes robot-mascot-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(2.5deg);
    }
}

@keyframes launcher-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes label-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes launcher-attention {
    0%, 82%, 100% {
        rotate: 0deg;
    }
    85% {
        rotate: -6deg;
    }
    88% {
        rotate: 6deg;
    }
    91% {
        rotate: -4deg;
    }
    94% {
        rotate: 4deg;
    }
}

@keyframes launcher-pulse {
    0%, 100% {
        opacity: 0.28;
        transform: scale(0.92);
    }
    50% {
        opacity: 0.75;
        transform: scale(1.08);
    }
}

@keyframes dot-blink {
    0%, 100% {
        opacity: 0.55;
        transform: scale(0.88);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@keyframes robot-wave-arm {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-22deg);
    }
    55% {
        transform: rotate(8deg);
    }
    80% {
        transform: rotate(-6deg);
    }
}

@keyframes antenna-wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    30% {
        transform: rotate(-5deg);
    }
    70% {
        transform: rotate(5deg);
    }
}

@keyframes antenna-wave {
    0% {
        opacity: 0.8;
        transform: scale(0.55);
    }
    100% {
        opacity: 0;
        transform: scale(1.6);
    }
}

@keyframes robot-blink {
    0%, 46%, 54%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.12);
    }
}

@keyframes smile-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(0.8px);
    }
}

@keyframes notification-pop {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes saber11-chat-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes saber11-pill-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Pantallas móviles */
@media (max-width: 560px) {
    .saber11-react-widget {
        right: 16px;
        bottom: 16px;
    }
    .saber11-trigger-box {
        width: 160px;
        height: 105px;
    }
    .saber11-pill-badge {
        padding: 5px 14px;
        margin-bottom: 6px;
    }
    .saber11-pill-text {
        font-size: 11.5px;
    }
    .saber11-react-launcher {
        width: 56px;
        height: 56px;
    }
    .saber11-react-panel {
        right: 14px !important;
        bottom: 84px !important;
        width: calc(100vw - 28px);
        height: calc(100vh - 96px);
        min-height: 350px;
        border-radius: 16px;
    }
    .saber11-react-frame {
        border-radius: 16px;
    }
}
