/* =====================================================================
   RoboKali — Mascotte 8-bit guide interactif AI Labs Audit
   Style pixel-art, couleurs brand violet/cyan
   ===================================================================== */

/* ── Container principal ─────────────────────────────────────────── */
#rk-container {
    position: fixed;
    top: 50%;
    right: 20px;
    z-index: 10003;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none; /* enfants réactivent le pointer-events */
    user-select: none;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Robot SVG wrapper ───────────────────────────────────────────── */
#rk-robot-wrap {
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.15s;
    filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.6));
    image-rendering: pixelated;
}

#rk-robot-wrap:hover {
    transform: scale(1.06);
    filter: drop-shadow(0 6px 18px rgba(192, 132, 252, 0.8));
}

#rk-robot-wrap:active {
    transform: scale(0.97);
}

/* Animation idle : léger flottement */
@keyframes rk-float {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-3px); }
    100% { transform: translateY(0px); }
}

#rk-robot-wrap {
    animation: rk-float 3s ease-in-out infinite;
}

#rk-robot-wrap svg {
    width: 110px;
    height: 138px;
}

/* Transitions fluides sur les éléments de bouche SVG — cross-fade rapide */
#rk-mouth-smile, #rk-mouth-half, #rk-mouth-open, #rk-mouth-round {
    transition: opacity 0.03s linear;
}

/* Transition douce sur les pupilles */
#rk-pupil-l, #rk-pupil-r {
    transition: transform 0.15s ease, opacity 0.1s ease;
}

/* Bras fluides — will-change pour GPU acceleration */
#rk-arm-l, #rk-arm-r {
    will-change: transform;
}

#rk-robot-wrap:hover {
    animation: none;
}

/* Antenne clignote */
@keyframes rk-antenna {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

#rk-antenna-light {
    animation: rk-antenna 1.8s ease-in-out infinite;
}

/* ── Bouton mute ─────────────────────────────────────────────────── */
#rk-mute-btn {
    pointer-events: all;
    background: rgba(15, 12, 41, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #c084fc;
    font-size: 0.8rem;
    backdrop-filter: blur(8px);
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#rk-mute-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(192, 132, 252, 0.6);
    color: #e9d5ff;
}

#rk-mute-btn.muted {
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.3);
    opacity: 0.7;
}

/* Bulle supprimée — RoboKali se positionne à droite du tooltip */

/* ── Bouton toggle dans la navbar ────────────────────────────────── */
/* Le bouton est dans nav.html, pas besoin de positionnement fixe */

/* ── Animations entrée/sortie ────────────────────────────────────── */
@keyframes rk-enter-anim {
    0%   { opacity: 0; transform: translateY(20px) scale(0.8); }
    60%  { opacity: 1; transform: translateY(-4px) scale(1.03); }
    80%  { transform: translateY(2px) scale(0.99); }
    100% { opacity: 1; transform: translateY(0)    scale(1);   }
}

@keyframes rk-exit-anim {
    from { opacity: 1; transform: translateY(0)    scale(1);   }
    to   { opacity: 0; transform: translateY(20px) scale(0.8); }
}

#rk-container.rk-enter {
    animation: rk-enter-anim 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#rk-container.rk-exit {
    animation: rk-exit-anim 0.35s ease-in forwards;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (min-width: 1400px) {
    #rk-robot-wrap svg { width: 130px; height: 163px; }
}
@media (max-width: 768px) {
    #rk-robot-wrap svg { width: 60px; height: 75px; }
    #rk-container {
        /* Sur mobile, robot en bas à droite fixe au lieu de suivre le tooltip */
        bottom: 80px !important;
        right: 8px !important;
        top: auto !important;
        left: auto !important;
    }
    #rk-mute-btn { width: 22px; height: 22px; font-size: 0.65rem; }
}
@media (max-width: 480px) {
    #rk-robot-wrap svg { width: 48px; height: 60px; }
    #rk-container {
        bottom: 70px !important;
        right: 4px !important;
    }
}

/* ── Parlant : effet glow sur les yeux ───────────────────────────── */
@keyframes rk-eye-pulse {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.5) drop-shadow(0 0 4px #60a5fa); }
}

/* Classe ajoutée par JS quand speaking */
#rk-container.rk-speaking #rk-eye-l,
#rk-container.rk-speaking #rk-eye-r {
    animation: rk-eye-pulse 0.4s ease-in-out infinite;
}

/* Glow pulse autour du container quand speaking */
@keyframes rk-speak-glow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.3)); }
    50%      { filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.7)) drop-shadow(0 0 30px rgba(96, 165, 250, 0.3)); }
}

#rk-container.rk-speaking #rk-robot-wrap {
    animation: rk-speak-glow 1.2s ease-in-out infinite;
}

/* ── Tour actif : légèrement plus grand ─────────────────────────── */
#globalTourBar ~ #rk-container #rk-robot-wrap svg,
body:has(#globalTourBar) #rk-container #rk-robot-wrap svg {
    width: 120px;
    height: 150px;
}

/* ── Bouton pause dans les tooltips de tour ────────────────────── */
.tour-btn-pause {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.7) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
}
.tour-btn-pause:hover {
    background: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}
.tour-btn-pause.paused {
    background: rgba(139, 92, 246, 0.3) !important;
    border-color: rgba(139, 92, 246, 0.5) !important;
    color: #c084fc !important;
}
