/* =====================================================
 * Plume — mascotte OPLC (loutre tenant un crayon)
 * Composant: app/Views/components/plume.php
 * ===================================================== */

.plume {
    display: inline-block;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Tailles fixes (correspond aux $plumeSizes du composant PHP) */
.plume--sm {
    width: 64px;
    height: 64px;
}
.plume--md {
    width: 120px;
    height: 120px;
}
.plume--lg {
    width: 200px;
    height: 200px;
}
.plume--xl {
    width: 320px;
    height: 320px;
}

/* Responsive : sur mobile, plume xl se réduit pour ne pas écraser le contenu */
@media (max-width: 768px) {
    .plume--xl {
        width: 200px;
        height: 200px;
    }
    .plume--lg {
        width: 140px;
        height: 140px;
    }
}
@media (max-width: 480px) {
    .plume--xl {
        width: 150px;
        height: 150px;
    }
}

/* Animation float subtile (option $plumeFloat = true) */
.plume-float {
    animation: plume-float-anim 4s ease-in-out infinite;
    transform-origin: center bottom;
}
@keyframes plume-float-anim {
    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-12px) rotate(-2deg);
    }
}
@media (prefers-reduced-motion: reduce) {
    .plume-float {
        animation: none;
    }
}

/* =====================================================
 * Plume compagne du FAB : positionnee a gauche du bouton +
 * (FAB = right:2rem, width:60px → on se place a droite du FAB + gap)
 * ===================================================== */
.plume-fab-companion {
    position: fixed;
    bottom: 2rem;
    /* Plume md (120px) colle au FAB reduit (48px) : sa patte gauche surplombe le + */
    right: calc(2rem + 48px - 8px);
    z-index: 998; /* juste sous le FAB (999) pour ne pas le masquer */
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}
.plume-fab-companion .plume {
    pointer-events: auto; /* l'image accepte le hover pour la bulle */
}

/* Bulle au survol — cachee par defaut, apparait au hover de Plume */
.plume-fab-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 8px;
    background: white;
    color: #1e1b4b;
    padding: 0.45rem 0.8rem;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.15);
    opacity: 0;
    transform: translateY(4px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    pointer-events: none;
}
.plume-fab-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border-right: 1px solid rgba(99, 102, 241, 0.15);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    transform: rotate(45deg);
}
.plume-fab-companion:hover .plume-fab-bubble,
.plume-fab-companion:focus-within .plume-fab-bubble {
    opacity: 1;
    transform: translateY(0);
}

/* Theme sombre */
[data-theme='dark'] .plume-fab-bubble {
    background: #1e1b4b;
    color: #e0e7ff;
    border-color: rgba(167, 139, 250, 0.3);
}
[data-theme='dark'] .plume-fab-bubble::after {
    background: #1e1b4b;
    border-color: rgba(167, 139, 250, 0.3);
}

/* Masquage quand le FAB est ouvert (Plume est le sibling suivant de #fab-menu) */
#fab-menu.active + .plume-fab-companion {
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
}

/* Mobile etroit : on retire Plume pour ne pas encombrer */
@media (max-width: 480px) {
    .plume-fab-companion {
        display: none;
    }
}
