/* =========================================================================
   BIOPOINT - LE PANNEAU DES MESSAGES (panneau_messages.css)
   =========================================================================
   Sur un ordinateur, la bulle ouvre un panneau de 380 x min(600 px,
   100vh - 120 px), ancre au-dessus d'elle a 24 px du bord : la liste des
   conversations, puis la conversation (panneau_messages.js). Les lignes, le
   fil, les bulles et la saisie sont ceux de la messagerie (discussion.css) ;
   ce fichier ne pose que le cadre, ses deux en-tetes et le passage de
   l'un a l'autre.

   Jetons de la charte seulement ; le mouvement ne touche que transform et
   opacity, et s'efface quand le systeme le demande.
   ========================================================================= */
:root {
    --pm-largeur: 380px;
    --pm-hauteur: min(600px, calc(100vh - 120px));
    --pm-bord: 24px;
    --pm-ecart: 12px;
    --pm-fond: var(--bp-surface, #111115);
    --pm-survol: var(--bp-surface-2, #18181d);
    --pm-duree: var(--bp-duree-2, 180ms);
    --pm-courbe: var(--bp-courbe, cubic-bezier(.2, 0, 0, 1));
}

.pm-panneau {
    /* Le fil, la saisie et les en-tetes prennent le fond du panneau. */
    --dsc-fond: var(--pm-fond);
    --dsc-largeur-bulle: 80%;
    position: fixed;
    inset-inline-end: var(--pm-bord);
    bottom: calc(var(--pm-bord) + var(--bm-taille, 56px) + var(--pm-ecart));
    z-index: 1045;
    display: flex;
    flex-direction: column;
    width: var(--pm-largeur);
    height: var(--pm-hauteur);
    overflow: hidden;
    border: 1px solid var(--bp-border-strong);
    border-radius: var(--bp-r-lg);
    background: var(--pm-fond);
    color: var(--bp-text);
    box-shadow: var(--bp-shadow-lg);
    font-size: var(--bp-fs-ui);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    transform-origin: bottom right;
    transition: opacity var(--pm-duree) var(--pm-courbe),
                transform var(--pm-duree) var(--pm-courbe);
}
[dir="rtl"] .pm-panneau { transform-origin: bottom left; }
.pm-panneau.est-ouvert { opacity: 1; transform: none; }
.pm-panneau[hidden] { display: none; }

/* Les deux vues : la liste, la conversation. */
.pm-vue {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    animation: pm-entree var(--pm-duree) var(--pm-courbe) both;
}
.pm-vue[hidden] { display: none; }
.pm-vue--fil { animation-name: pm-entree-fil; }
@keyframes pm-entree { from { opacity: 0; } to { opacity: 1; } }
@keyframes pm-entree-fil {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: none; }
}

/* LES EN-TETES : 60 px, le titre a gauche, les gestes a droite. */
.pm-tete {
    display: flex;
    align-items: center;
    gap: var(--bp-2, .5rem);
    min-height: 60px;
    padding: 10px 10px 10px 18px;
    border-bottom: 1px solid var(--bp-border);
    flex-shrink: 0;
}
.pm-tete--fil { padding-inline-start: 6px; gap: 10px; }
.pm-titre {
    flex: 1;
    margin: 0;
    font-size: var(--bp-fs-h1, 1.25rem);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--bp-text);
    outline: none;
}
.pm-qui {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.pm-nom {
    margin: 0;
    overflow: hidden;
    font-size: var(--bp-fs-h3, 1rem);
    font-weight: 600;
    color: var(--bp-text);
    white-space: nowrap;
    text-overflow: ellipsis;
}
.pm-sous {
    color: var(--bp-success-soft);
    font-size: var(--bp-fs-micro, .75rem);
}
.pm-sous[hidden] { display: none; }
.pm-tete .dsc-avatar { width: 36px; height: 36px; font-size: .8125rem; }

/* LES BOUTONS RONDS : 36 px a l'oeil, 44 px sous le doigt. */
.pm-icone {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--bp-r-pill);
    background: transparent;
    color: var(--bp-text-2);
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--bp-duree-1, 120ms) var(--pm-courbe),
                transform var(--bp-duree-1, 120ms) var(--pm-courbe);
}
.pm-icone::after { content: ""; position: absolute; inset: -4px; }
.pm-icone:hover { background: var(--pm-survol); color: var(--bp-text); }
.pm-icone:active { transform: scale(.94); }
.pm-icone:focus-visible { outline: 2px solid var(--bp-focus, var(--bp-primary-soft)); outline-offset: 1px; }
/* « Ouvrir en grand » : la fleche montante vers le coin. */
.pm-grand i { transform: rotate(-45deg); }
[dir="rtl"] .pm-retour i, [dir="rtl"] .pm-suite { transform: scaleX(-1); }
[dir="rtl"] .pm-grand i { transform: rotate(-135deg); }

/* LA LISTE : les lignes de la messagerie, un peu resserrees. */
.pm-liste {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    scrollbar-width: thin;
}
.pm-conv { min-height: 68px; padding: 10px; gap: 12px; border-radius: var(--bp-r); }
.pm-conv:hover { background: var(--pm-survol); }
.pm-conv:focus-visible { outline: 2px solid var(--bp-focus, var(--bp-primary-soft)); outline-offset: -2px; }
.pm-conv .dsc-avatar { width: 48px; height: 48px; font-size: .9375rem; }
.pm-conv .dsc-pastille { align-self: center; margin-bottom: 0; }
.pm-avatar-icone { font-size: 18px; color: var(--bp-text-2); }
.pm-conv .pm-avatar-icone { font-size: 20px; }
.pm-suite { color: var(--bp-text-3); font-size: 14px; }
.pm-etat {
    margin: 0;
    padding: var(--bp-4, 1.5rem) var(--bp-3, 1rem);
    color: var(--bp-text-3);
    text-align: center;
}
.pm-etat[hidden] { display: none; }

/* LA CONVERSATION : le fil et la saisie de la messagerie. */
.pm-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.pm-main .dsc-fil { padding: 12px 12px 8px; }
.pm-saisie { padding: 8px 10px 12px; border-top: 1px solid var(--bp-border); }
.pm-saisie[hidden] { display: none; }
.pm-saisie .dsc-zone { font-size: var(--bp-fs-ui); min-height: 40px; padding: 9px 6px 9px 16px; }
.pm-note[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
    .pm-panneau, .pm-icone { transition: none; }
    .pm-panneau { transform: none; }
    .pm-vue, .pm-vue--fil { animation: none; }
    .pm-icone:active { transform: none; }
}

/* Sur un telephone, jamais : la bulle n'y est pas (bulle_messages.css). */
@media (max-width: 991.98px) {
    .pm-panneau { display: none; }
}

@media print {
    .pm-panneau { display: none !important; }
}
