/**
 * Byted Platform - Estilos do Mascote ByteBot (Monitor + EVE Body)
 * Animações CSS 60fps com iluminação LED, braços destacados e transições cinemáticas
 */

:root {
    --mascot-screen-bg: #101c24;
    --mascot-screen-border: #233544;
    --mascot-monitor-case: #384b5c;
    --mascot-monitor-bevel: #2a3845;
    --mascot-led-color: #00ff88;
    --mascot-led-glow: rgba(0, 255, 136, 0.75);
    --mascot-led-shadow: rgba(0, 255, 136, 0.5);
    --mascot-eve-body: #ffffff;
    --mascot-eve-shadow: #d5e2ec;
    --mascot-eve-glow: rgba(255, 255, 255, 0.85);
}

/* ========================================================
   CONTAINER DO MASCOTE & FLUTUAÇÃO GERAL
   ======================================================== */
.byted-mascot-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    perspective: 1000px;
}

.byted-mascot-figure {
    position: relative;
    animation: mascot-float 3.6s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

@keyframes mascot-float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }
}

/* Sombra flutuante no chão sincronizada */
.byted-mascot-shadow {
    width: 60%;
    height: 12px;
    background: radial-gradient(ellipse at center, rgba(0, 69, 50, 0.25) 0%, rgba(0, 69, 50, 0) 75%);
    border-radius: 50%;
    margin-top: 6px;
    animation: mascot-shadow-scale 3.6s ease-in-out infinite;
}

@keyframes mascot-shadow-scale {

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

    50% {
        transform: scale(0.72);
        opacity: 0.4;
    }
}

/* ========================================================
   ELEMENTOS DO SVG E TRANSFORMAÇÕES NATIVAS
   ======================================================== */
.robot-assembly {
    transform-box: fill-box;
    transform-origin: center center;
}

/* Cabeça de Monitor */
.mascot-head-group {
    transform-box: fill-box;
    transform-origin: center bottom;
}

/* Braços Magnéticos Flutuantes nas Laterais */
.mascot-arm {
    transform-origin: 0 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mascot-arm-left {
    animation: arm-hover-left 3.6s ease-in-out infinite;
}

.mascot-arm-right {
    animation: arm-hover-right 3.6s ease-in-out infinite;
}

@keyframes arm-hover-left {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(3px) rotate(-6deg);
    }
}

@keyframes arm-hover-right {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(3px) rotate(6deg);
    }
}

/* LED e Luzes */
.pixel-led {
    fill: var(--mascot-led-color);
    filter: drop-shadow(0 0 5px var(--mascot-led-glow)) drop-shadow(0 0 10px var(--mascot-led-shadow));
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.antenna-led {
    animation: antenna-blink 2s infinite ease-in-out;
}

@keyframes antenna-blink {

    0%,
    100% {
        opacity: 0.7;
        filter: drop-shadow(0 0 4px var(--mascot-led-glow));
    }

    50% {
        opacity: 1;
        filter: drop-shadow(0 0 10px var(--mascot-led-glow)) drop-shadow(0 0 14px var(--mascot-led-color));
    }
}

.screen-glare {
    opacity: 0.35;
    pointer-events: none;
}

/* ========================================================
   HUMORES E EXPRESSÕES FACIAIS
   ======================================================== */

/* Piscando Natural */
.byted-mascot-wrapper.is-blinking .face-eye {
    transform: scaleY(0.1);
    transform-origin: center center;
    transform-box: fill-box;
}

/* Humor: Feliz (^ _ ^) - Pulo comemorativo unificado */
.byted-mascot-wrapper.mood-happy .byted-mascot-figure {
    animation: mascot-happy-jump 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
}

@keyframes mascot-happy-jump {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-16px);
    }
}

.byted-mascot-wrapper.mood-happy .mascot-arm-left {
    transform: rotate(-24deg);
}

.byted-mascot-wrapper.mood-happy .mascot-arm-right {
    transform: rotate(24deg);
}

/* Humor: Pensando (~ _ ~) */
.byted-mascot-wrapper.mood-thinking .pixel-led {
    filter: drop-shadow(0 0 4px #38bdf8) drop-shadow(0 0 10px rgba(56, 189, 248, 0.6));
    fill: #38bdf8;
}

.byted-mascot-wrapper.mood-thinking .mascot-arm-right {
    transform: rotate(28deg);
}

/* Humor: Empolgado */
.byted-mascot-wrapper.mood-excited .pixel-led {
    filter: drop-shadow(0 0 6px #f59e0b) drop-shadow(0 0 14px #fde047);
    fill: #fde047;
}

.byted-mascot-wrapper.mood-excited .mascot-arm-left {
    transform: rotate(-32deg);
}

.byted-mascot-wrapper.mood-excited .mascot-arm-right {
    transform: rotate(32deg);
}

.byted-mascot-wrapper.mood-excited .byted-mascot-figure {
    animation: mascot-excited-hover 1.8s ease-in-out infinite;
}

@keyframes mascot-excited-hover {

    0%,
    100% {
        transform: translateY(-4px) scale(1.02);
    }

    50% {
        transform: translateY(-14px) scale(1.05);
    }
}

/* Humor: Dúvida / Erro (o _ O) - Balanço lateral sem alterar altura da cabeça */
.byted-mascot-wrapper.mood-error .pixel-led {
    filter: drop-shadow(0 0 5px #f87171) drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
    fill: #f87171;
}

.byted-mascot-wrapper.mood-error .mascot-arm-left {
    transform: rotate(14deg);
}

.byted-mascot-wrapper.mood-error .mascot-arm-right {
    transform: rotate(-14deg);
}

.byted-mascot-wrapper.mood-error .byted-mascot-figure {
    animation: mascot-shake 0.4s ease-in-out 2;
}

@keyframes mascot-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* Humor: Dormindo (- _ -) */
.byted-mascot-wrapper.mood-sleepy .byted-mascot-figure {
    animation: mascot-sleep-float 4.5s ease-in-out infinite;
}

@keyframes mascot-sleep-float {

    0%,
    100% {
        transform: translateY(2px);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* ========================================================
   CINEMÁTICAS DE MOVIMENTO (ENTRADAS, SAÍDAS & VOOS)
   ======================================================== */

/* 1. Entradas (Fly-In) */
.anim-fly-in-right {
    animation: mascot-enter-right 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes mascot-enter-right {
    0% {
        opacity: 0;
        transform: translate(240px, -20px) rotate(14deg) scale(0.85);
    }

    70% {
        transform: translate(-10px, 4px) rotate(-3deg) scale(1.04);
    }

    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

.anim-fly-in-left {
    animation: mascot-enter-left 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes mascot-enter-left {
    0% {
        opacity: 0;
        transform: translate(-240px, -20px) rotate(-14deg) scale(0.85);
    }

    70% {
        transform: translate(10px, 4px) rotate(3deg) scale(1.04);
    }

    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

.anim-fly-in-top {
    animation: mascot-enter-top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes mascot-enter-top {
    0% {
        opacity: 0;
        transform: translateY(-200px) scale(0.75);
    }

    70% {
        transform: translateY(12px) scale(1.05);
    }

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

.anim-teleport-in {
    animation: mascot-teleport-in 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes mascot-teleport-in {
    0% {
        opacity: 0;
        filter: brightness(3) drop-shadow(0 0 30px #00ff88);
        transform: scale(0.2);
    }

    60% {
        opacity: 1;
        filter: brightness(1.6) drop-shadow(0 0 15px #00ff88);
        transform: scale(1.12);
    }

    100% {
        opacity: 1;
        filter: brightness(1);
        transform: scale(1);
    }
}

/* 2. Saídas (Fly-Out) */
.anim-fly-out-right {
    animation: mascot-exit-right 0.75s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
}

@keyframes mascot-exit-right {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }

    20% {
        transform: translate(-20px, 6px) rotate(-6deg);
    }

    100% {
        opacity: 0;
        transform: translate(320px, -40px) rotate(22deg) scale(0.85);
    }
}

.anim-fly-out-left {
    animation: mascot-exit-left 0.75s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
}

@keyframes mascot-exit-left {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }

    20% {
        transform: translate(20px, 6px) rotate(6deg);
    }

    100% {
        opacity: 0;
        transform: translate(-320px, -40px) rotate(-22deg) scale(0.85);
    }
}

.anim-fly-out-top {
    animation: mascot-exit-top 0.75s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
}

@keyframes mascot-exit-top {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    20% {
        transform: translateY(12px) scale(1.05, 0.95);
    }

    100% {
        opacity: 0;
        transform: translateY(-280px) scale(0.7, 1.25);
    }
}

.anim-teleport-out {
    animation: mascot-teleport-out 0.5s ease-in forwards !important;
}

@keyframes mascot-teleport-out {
    0% {
        opacity: 1;
        filter: brightness(1);
        transform: scale(1);
    }

    40% {
        opacity: 1;
        filter: brightness(2.5) drop-shadow(0 0 25px #00ff88);
        transform: scale(1.1);
    }

    100% {
        opacity: 0;
        filter: brightness(4);
        transform: scale(0.1);
    }
}

/* 3. Acrobacias e Especiais */
.anim-spin {
    animation: mascot-horizontal-spin 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes mascot-horizontal-spin {
    0% {
        transform: translateY(0) rotateY(0deg) scale(1);
    }

    35% {
        transform: translateY(-18px) rotateY(140deg) scale(1.08);
    }

    70% {
        transform: translateY(-8px) rotateY(270deg) scale(1.04);
    }

    100% {
        transform: translateY(0) rotateY(360deg) scale(1);
    }
}

/* Espiada de Perto & Subida em Movimento Único Contínuo Fluido (GPU Acelerado) */
.anim-peek-reveal {
    animation: mascot-peek-zigzag 2.3s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
    will-change: transform, opacity;
}

@keyframes mascot-peek-zigzag {
    0% {
        opacity: 0;
        transform: translate3d(0px, 190px, 0px) scale(1.9) rotate(-3deg);
    }

    15% {
        opacity: 1;
        transform: translate3d(-34px, 135px, 0px) scale(1.68) rotate(-6deg);
    }

    42% {
        transform: translate3d(38px, 75px, 0px) scale(1.42) rotate(6deg);
    }

    70% {
        transform: translate3d(-20px, 25px, 0px) scale(1.2) rotate(-3deg);
    }

    100% {
        opacity: 1;
        transform: translate3d(0px, 0px, 0px) scale(1) rotate(0deg);
    }
}

/* ========================================================
   BALÃO DE FALA INTERATIVO
   ======================================================== */
.mascot-speech-bubble {
    position: absolute;
    bottom: calc(100% + 14px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border: 1.5px solid rgba(0, 69, 50, 0.15);
    box-shadow: 0 10px 28px rgba(0, 69, 50, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    border-radius: 18px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 700;
    color: #111c2d;
    white-space: normal;
    max-width: 240px;
    min-width: 140px;
    text-align: center;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 50;
}

.mascot-speech-bubble.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mascot-speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
}

/* ========================================================
   TAMANHOS DO MASCOTE
   ======================================================== */
.mascot-sm {
    width: 95px;
    height: 115px;
}

.mascot-md {
    width: 145px;
    height: 175px;
}

.mascot-lg {
    width: 210px;
    height: 250px;
}

.mascot-xl {
    width: 280px;
    height: 335px;
}

/* ========================================================
   OVERLAY DE TRANSIÇÃO & LOADING GLOBAL DO BYTEBOT
   ======================================================== */
.bytebot-transition-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    background-color: var(--background, #f9f9ff);
    background-image:
        radial-gradient(at 0% 0%, hsla(158, 100%, 74%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(84, 93%, 62%, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease-in-out;
    box-sizing: border-box;
    /* Margens da página ampliadas com Safe Area do iOS (Notch e Barra Inferior) */
    padding: 28px 24px;
    padding-top: max(80px, calc(env(safe-area-inset-top, 0px) + 50px));
    padding-bottom: max(48px, calc(env(safe-area-inset-bottom, 0px) + 32px));
    padding-left: max(24px, calc(env(safe-area-inset-left, 0px) + 20px));
    padding-right: max(24px, calc(env(safe-area-inset-right, 0px) + 20px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bytebot-transition-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
}

.bytebot-transition-card {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 16px 20px;
    max-width: 440px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    margin: auto 0;
}

.bytebot-transition-mascot-box {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 52px;
    /* Margem superior extra para o balão de fala do ByteBot */
    width: 100%;
}

.bytebot-transition-info {
    width: 100%;
    max-width: 380px;
    margin-top: 20px;
}