/* MatrixLive — styles des salles */
.live-cam-slot {
    aspect-ratio: 16 / 10;
    background: #050805;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.live-cam-slot video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.live-cam-placeholder {
    text-align: center;
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-secondary);
    padding: 1rem;
}

/* Boutons de contrôle compacts (micro/caméra/quitter) */
.live-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .4rem .6rem !important;
}
.live-ctrl-btn .ctrl-icon { font-size: 1rem; }
.live-ctrl-btn .ctrl-state { font-size: .8rem; font-weight: bold; }

/* Grille des 2 caméras : TOUJOURS côte à côte (desktop ET mobile) */
.live-cam-grid {
    grid-template-columns: 1fr 1fr !important;
}

/* Bouton Envoyer : label en desktop, icône en mobile */
.chat-send-btn .send-icon { display: none !important; }
.chat-send-btn .send-label { display: inline !important; }

/* Icône micro rouge "muté" — superposée sur la carte vocale ou la case caméra */
.muted-icon {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 1.1rem;
    color: #ff4136;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.8));
    z-index: 5;
    pointer-events: none;
    line-height: 1;
}
.muted-icon.cam-muted {
    font-size: 1.6rem;
}
/* Pour que les positions absolues marchent dans la carte vocale */
.voice-card {
    position: relative;
    min-width: 0;       /* essentiel pour que text-overflow:ellipsis marche dans une grille */
    /* CORRECTIF : overflow:hidden retiré — ça pouvait couper la ligne de boutons
       +/⚙ (invitation caméra / modération) sur mobile quand la hauteur de la
       case était contrainte par la grille. La troncature du nom est déjà gérée
       plus bas par la règle .voice-card > div (overflow:hidden ciblé sur le texte
       uniquement), donc rien n'est perdu en retirant ce overflow global. */
}

/* ─── Couleurs spéciales selon le rôle utilisateur ─── */

/* ADMIN : texte arc-en-ciel animé avec lueur */
.user-admin {
    background-image: linear-gradient(90deg, #ff0080, #ff8000, #ffff00, #00ff00, #00ffff, #0080ff, #8000ff, #ff0080) !important;
    background-size: 200% auto !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    font-weight: bold !important;
    animation: rainbow-shift 3s linear infinite;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}
@keyframes rainbow-shift {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* MODÉRATEUR : rouge avec lueur */
.user-moderator {
    color: #ff4136 !important;
    -webkit-text-fill-color: #ff4136 !important;
    font-weight: bold !important;
    text-shadow: 0 0 6px rgba(255, 65, 54, 0.7), 0 0 12px rgba(255, 65, 54, 0.4) !important;
}

/* Icône haut-parleur en mode muté : trait rouge barré */
#live-radio-volume-icon.radio-muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #ef4444;
    border-radius: 1px;
    transform: rotate(-25deg);
    transform-origin: center;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
    pointer-events: none;
}

/* Barre radio en chargement : effet de pulse sur l'icône + gradient animé en fond */
#live-radio-bar.radio-loading {
    background-image: linear-gradient(
        90deg,
        rgba(0, 170, 0, 0.15) 0%,
        rgba(0, 255, 0, 0.30) 50%,
        rgba(0, 170, 0, 0.15) 100%
    );
    background-size: 200% 100%;
    animation: radio-loading-shimmer 1.5s linear infinite;
}
@keyframes radio-loading-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Animation marquee pour le nom de radio quand trop long */
#live-radio-name {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    position: relative;
}
#live-radio-name .marquee-inner {
    display: inline-block;
    white-space: nowrap;
}
/* Quand le texte dépasse, on active le scroll horizontal */
#live-radio-name.scrolling .marquee-inner {
    animation: marquee-scroll 15s linear infinite;
    /* Petite pause avant de redémarrer en remettant le double-texte */
    padding-right: 3rem;
}
@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* L'icône 📻 pulse pendant le chargement */
#live-radio-bar.radio-loading > span:first-child {
    animation: radio-icon-pulse 1s ease-in-out infinite;
    display: inline-block;
}
@keyframes radio-icon-pulse {
    0%, 100% { transform: scale(1); opacity: .8; }
    50%      { transform: scale(1.25); opacity: 1; }
}

/* Petit indicateur "..." à côté du nom de radio pendant le chargement */
#live-radio-bar.radio-loading #live-radio-name::after {
    content: '⏳';
    animation: radio-loading-dots 1s ease-in-out infinite;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card, #0a0f0a);
    padding-left: .3rem;
    pointer-events: none;
}
@keyframes radio-loading-dots {
    0%, 100% { opacity: .3; }
    50%      { opacity: 1; }
}

/* Nom en bas à gauche de chaque case caméra (toujours visible, sur vidéo ou placeholder) */
.cam-name-label {
    position: absolute;
    bottom: 6px;
    left: 6px;
    max-width: calc(100% - 50px);   /* laisse de la place pour le bouton ⚙ et l'icône micro */
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-family: var(--font-mono);
    font-size: .72rem;
    padding: .2rem .5rem;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 4;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
/* Nom tronqué avec ... si trop long */
.voice-card .voice-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.55);
    padding: .15rem .4rem;
    border-radius: 4px;
    display: inline-block;     /* pour que le fond noir n'occupe que le texte */
    margin: .25rem auto 0;     /* centré sous l'avatar */
}
/* Forcer le nom sur sa propre ligne, sous l'avatar */
.voice-card .voice-avatar { display: block; margin: 0 auto; }
.voice-card .voice-name { /* placé après l'avatar grâce au flux normal */ }

/* Troncature des noms longs partout dans le plugin live */
.voice-card > div,
.live-cam-placeholder > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Carte de participant vocal qui parle : rond bleu pulsant */
.voice-card.speaking {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 14px rgba(59, 130, 246, 0.4);
    animation: speaking-pulse 1.2s ease-in-out infinite;
}
@keyframes speaking-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 14px rgba(59, 130, 246, 0.4); }
    50%      { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.7), 0 0 18px rgba(59, 130, 246, 0.7); }
}

/* Slot caméra dont l'utilisateur parle : gros anneau vert pulsant (style Discord) */
.live-cam-slot.cam-speaking {
    border-color: #00ff41 !important;
    box-shadow: 0 0 0 4px rgba(0, 255, 65, 0.6), 0 0 22px rgba(0, 255, 65, 0.5);
    animation: cam-speaking-pulse 1.2s ease-in-out infinite;
}
@keyframes cam-speaking-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(0, 255, 65, 0.55), 0 0 22px rgba(0, 255, 65, 0.45); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 255, 65, 0.85), 0 0 32px rgba(0, 255, 65, 0.75); }
}

/* Case caméra en cours de connexion : spinner par-dessus */
.live-cam-slot.connecting::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 36px; height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(0, 200, 100, 0.2);
    border-top-color: #2ecc40;
    border-radius: 50%;
    animation: cam-spinner 0.9s linear infinite;
    pointer-events: none;
    z-index: 4;
}
@keyframes cam-spinner {
    to { transform: rotate(360deg); }
}

/* Responsive mobile */
@media (max-width: 700px) {
    /* Barre de chat compacte pour tenir sur l'écran */
    .chat-bar {
        gap: .25rem !important;
        padding: .5rem !important;
    }
    .chat-bar .btn-sm { padding: .35rem .45rem !important; font-size: .75rem !important; }
    .chat-send-btn .send-icon { display: inline !important; }
    .chat-send-btn .send-label { display: none !important; }

    /* Les 2 caméras RESTENT côte à côte sur mobile */
    .live-cam-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: .4rem !important;
        margin-bottom: .35rem !important; /* CORRECTIF : moins d'espace avant la grille vocale */
    }
    .live-cam-slot {
        aspect-ratio: 1 / 1 !important; /* CORRECTIF : cadre caméra plus grand/carré sur mobile (au lieu de 16/10) */
    }
    .live-cam-placeholder {
        font-size: .62rem;
        padding: .4rem;
    }
    .live-cam-placeholder img {
        width: 32px !important;
        height: 32px !important;
    }
    /* Grille vocale : toujours 4 par rangée */
    #voice-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: .3rem !important;
        padding: .3rem !important; /* CORRECTIF : moins de marge interne, cases plus grandes */
        margin-bottom: .35rem !important; /* CORRECTIF : moins d'espace après la grille vocale */
        align-items: start !important; /* ne pas étirer les cartes à la hauteur de la plus haute de la rangée */
    }
    .voice-avatar {
        width: 42px !important; /* CORRECTIF : agrandi (était 36px), profite de l'espace libéré */
        height: 42px !important;
    }
    #voice-grid > div { padding: .3rem !important; }
    #voice-grid > div > div { font-size: .65rem !important; }
}
