/**
 * Avatar utilisateur Liofo — styles universels.
 *
 * ID chantier : 2026-09-30-USER-AVATAR-U
 * Marqueur    : LIOFO_USER_AVATAR_CSS_2026_09_30
 *
 * Convention BEM :
 *   .liofo-user-avatar             → wrapper rond (span ou a)
 *   .liofo-user-avatar--<variant>  → modifier de taille / contexte
 *   .liofo-user-avatar__img        → image uploadée user (photo)
 *   .liofo-user-avatar__svg        → SVG fallback (personnage "moi")
 *   .liofo-user-avatar__initial    → badge initiale en bas à droite (overlay)
 */

.liofo-user-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #151a2e; /* couleur du disque du SVG fallback pour continuité */
    text-decoration: none;
    line-height: 0;
    flex: 0 0 auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.liofo-user-avatar--clickable { cursor: pointer; }
.liofo-user-avatar--clickable:hover,
.liofo-user-avatar--clickable:focus-visible {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
    outline: none;
}
.liofo-user-avatar__img,
.liofo-user-avatar__svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.liofo-user-avatar__svg {
    /* Le SVG fallback est déjà stylé (fond #151a2e) → objectfit: contain garde
       le personnage centré sans le rogner. */
    object-fit: contain;
}
.liofo-user-avatar__initial {
    position: absolute;
    right: -2px;
    bottom: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #22c55e;
    color: #0a0a0b;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #151a2e; /* halo pour détacher du rond principal */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Variantes : header top-right
   --------------------------------------------------------------------------- */
.liofo-user-avatar--header {
    width: 40px;
    height: 40px;
}
.liofo-user-avatar--header .liofo-user-avatar__initial {
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
    line-height: 16px;
}

/* ---------------------------------------------------------------------------
   Variante : centre du donut /carte-patrimoine
   --------------------------------------------------------------------------- */
.liofo-user-avatar--estate-center {
    width: 82px;
    height: 82px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.liofo-user-avatar--estate-center .liofo-user-avatar__initial {
    min-width: 24px;
    height: 24px;
    font-size: 0.9rem;
    line-height: 24px;
    right: 0;
    bottom: 0;
}

/* ---------------------------------------------------------------------------
   Variante : grande (mon-compte, futur profil)
   --------------------------------------------------------------------------- */
.liofo-user-avatar--large {
    width: 96px;
    height: 96px;
}
.liofo-user-avatar--large .liofo-user-avatar__initial {
    min-width: 28px;
    height: 28px;
    font-size: 1rem;
    line-height: 28px;
}

/* Responsive header (mobile) */
@media (max-width: 640px) {
    .liofo-user-avatar--header {
        width: 34px;
        height: 34px;
    }
    .liofo-user-avatar--header .liofo-user-avatar__initial {
        min-width: 14px;
        height: 14px;
        font-size: 0.6rem;
        line-height: 14px;
    }
}

/* ---------------------------------------------------------------------------
   Header user (rond avatar + "Bonjour <login>" révélé au survol)
   Remplace l'ancien .bulle-utilisateur .texte-complet.
   --------------------------------------------------------------------------- */
.liofo-header-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
}
.liofo-header-user__hello {
    display: none;
    color: inherit;
    font-size: 0.9rem;
    font-family: inherit;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.liofo-header-user:hover .liofo-header-user__hello,
.liofo-header-user:focus-within .liofo-header-user__hello {
    display: inline;
}
@media (max-width: 640px) {
    .liofo-header-user__hello { display: none !important; }
}
