/* ==========================================================================
   DR. FLUXO - Mascote IA da FluxoMed
   Sistema de animacao pseudo-3D usando multiplos sprites + CSS transforms
   ========================================================================== */

.dr-fluxo {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 180px;
    perspective: 800px;
    user-select: none;
    -webkit-user-drag: none;
}

.dr-fluxo--sm  { width:  80px; height:  80px; }
.dr-fluxo--md  { width: 120px; height: 120px; }
.dr-fluxo--lg  { width: 240px; height: 240px; }
.dr-fluxo--xl  { width: 320px; height: 320px; }

.dr-fluxo__sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    transition: opacity .3s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
    transform-origin: bottom center;
    will-change: transform;
}

/* ===== Animacao base: respiracao + flutuacao ===== */
@keyframes dr-fluxo-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-8px) scale(1.015); }
}
@keyframes dr-fluxo-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.025); }
}
@keyframes dr-fluxo-bounce-in {
    0%   { transform: scale(.3) translateY(40px); opacity: 0; }
    60%  { transform: scale(1.08) translateY(-6px); opacity: 1; }
    80%  { transform: scale(.96) translateY(2px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes dr-fluxo-wave {
    0%, 100% { transform: rotate(-3deg); }
    50%      { transform: rotate(3deg); }
}
@keyframes dr-fluxo-shadow-pulse {
    0%, 100% { transform: translateX(-50%) scaleX(1); opacity: .25; }
    50%      { transform: translateX(-50%) scaleX(.85); opacity: .15; }
}

.dr-fluxo--floating .dr-fluxo__sprite {
    animation: dr-fluxo-float 3.2s ease-in-out infinite;
}
.dr-fluxo--breathing .dr-fluxo__sprite {
    animation: dr-fluxo-breathe 2.5s ease-in-out infinite;
}
.dr-fluxo--waving .dr-fluxo__sprite {
    animation: dr-fluxo-wave 1.8s ease-in-out infinite;
    transform-origin: bottom center;
}
.dr-fluxo--bounce-in .dr-fluxo__sprite {
    animation: dr-fluxo-bounce-in .9s cubic-bezier(.34, 1.56, .64, 1) both;
}

/* Sombra dinamica embaixo (parece flutuando) */
.dr-fluxo::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 60%;
    height: 14px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 30, .3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translateX(-50%);
    animation: dr-fluxo-shadow-pulse 3.2s ease-in-out infinite;
    z-index: -1;
}

/* Tilt 3D ao mover mouse (script JS aplica --rx e --ry) */
.dr-fluxo--tilt .dr-fluxo__sprite {
    transform:
        rotateX(var(--ry, 0deg))
        rotateY(var(--rx, 0deg));
    transition: transform .15s ease-out;
}

/* Balao de fala (estilo HQ) */
.dr-fluxo-balloon {
    position: relative;
    background: #fff;
    border: 2px solid #4338ca;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px -4px rgba(67, 56, 202, .3);
    max-width: 280px;
    font-size: 14px;
    line-height: 1.5;
    color: #1e1b4b;
    font-weight: 500;
    animation: dr-fluxo-bounce-in .6s cubic-bezier(.34, 1.56, .64, 1) both;
}
.dr-fluxo-balloon::before,
.dr-fluxo-balloon::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}
/* Balao a DIREITA do personagem - seta apontando para esquerda */
.dr-fluxo-balloon--right::before {
    left: -14px; top: 24px;
    border-width: 8px 14px 8px 0;
    border-color: transparent #4338ca transparent transparent;
}
.dr-fluxo-balloon--right::after {
    left: -10px; top: 26px;
    border-width: 6px 11px 6px 0;
    border-color: transparent #fff transparent transparent;
}
/* Balao a ESQUERDA do personagem - seta apontando para direita */
.dr-fluxo-balloon--left::before {
    right: -14px; top: 24px;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #4338ca;
}
.dr-fluxo-balloon--left::after {
    right: -10px; top: 26px;
    border-width: 6px 0 6px 11px;
    border-color: transparent transparent transparent #fff;
}

/* Avatar redondo (chat header) */
.dr-fluxo-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    overflow: hidden;
    box-shadow: 0 4px 14px -2px rgba(99, 102, 241, .5);
}
.dr-fluxo-avatar img {
    width: 110%;
    height: 110%;
    object-fit: cover;
    object-position: top center;
    pointer-events: none;
    transition: transform .3s ease;
}
.dr-fluxo-avatar:hover img {
    transform: scale(1.1) rotate(-3deg);
}
.dr-fluxo-avatar--xl { width: 96px; height: 96px; box-shadow: 0 8px 24px -4px rgba(99, 102, 241, .6); }
.dr-fluxo-avatar--lg { width: 72px; height: 72px; }
.dr-fluxo-avatar--md { width: 56px; height: 56px; }
.dr-fluxo-avatar--sm { width: 40px; height: 40px; box-shadow: 0 2px 8px -2px rgba(99, 102, 241, .4); }

/* Indicador de "online" verde no avatar */
.dr-fluxo-avatar--online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2.5px solid #fff;
    border-radius: 50%;
    animation: dr-fluxo-online-pulse 2s ease-in-out infinite;
}
@keyframes dr-fluxo-online-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* Modal especial Dr. Fluxo - background animado em tons claros (combina com sticker) */
.dr-fluxo-modal-bg {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 40%, #c7d2fe 100%);
    position: relative;
    overflow: hidden;
}
.dr-fluxo-modal-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, .15) 0%, transparent 35%),
        radial-gradient(circle at 80% 70%, rgba(167, 139, 250, .12) 0%, transparent 35%),
        radial-gradient(circle at 50% 100%, rgba(139, 92, 246, .1) 0%, transparent 50%);
    animation: dr-fluxo-bg-drift 15s ease-in-out infinite;
}
.dr-fluxo-modal-bg .dr-fluxo h4,
.dr-fluxo-modal-bg h4 {
    color: #312e81 !important;
}
.dr-fluxo-modal-bg p {
    color: #6366f1 !important;
}
@keyframes dr-fluxo-bg-drift {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-20px, 20px); }
}

/* Confetes quando exibe pose joinha */
@keyframes dr-fluxo-confetti {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(120px) rotate(720deg); opacity: 0; }
}
