/* ═══════════════════════════════════════════════════════════
   FICHE UTILISATEUR — popup au clic

   Cliquer un nom ouvrait une page entière : on quittait le salon
   pour lire une bio. Cette popup garde le contexte, et reste
   ouverte pendant qu'on continue à lire les messages.

   Elle affiche exactement les mêmes données que profil.html, et
   « Ouvrir la page » reste disponible : la page n'est pas perdue,
   elle n'est plus imposée.
   ════════════════════════════════════════════════════════════ */

.bc-profile {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(3px);
  z-index: 300;
}
.bc-profile.open { display: flex; }

.bc-profile-box {
  position: relative;
  width: min(430px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  box-shadow: var(--shadow, 0 24px 60px -20px rgba(0,0,0,.65));
  padding: 1.1rem;
  animation: bcProfileIn .16s ease-out;
}
@keyframes bcProfileIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
html:not(.anim-on) .bc-profile-box { animation: none; }

.bc-profile-close {
  position: absolute;
  top: .5rem; right: .5rem;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.bc-profile-close:hover { background: var(--hover); color: var(--ink); }

/* ── En-tête ───────────────────────────────────────────── */
.bc-profile-head { display: flex; gap: .85rem; align-items: center; }
.bc-profile-av {
  position: relative;
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.4rem;
  color: var(--ink);
}
.bc-profile-av img { width: 100%; height: 100%; object-fit: cover; }
.bc-profile-av .bc-pp-discord {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: var(--accent);
  border-radius: 50%;
  color: #fff;
}
.bc-profile-av .bc-pp-discord svg { width: 11px; height: 11px; }

.bc-profile-id { min-width: 0; }
.bc-profile-id h2 {
  margin: 0 0 .1rem;
  font-size: 1.16rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.bc-profile-id .bc-profile-handle {
  color: var(--muted);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.bc-profile-pill {
  display: inline-block;
  margin-top: .3rem;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--border);
  font-size: .72rem;
  color: var(--amber, var(--accent2));
}

.bc-profile-bio {
  margin: .85rem 0 .6rem;
  padding: .55rem .7rem;
  border-radius: 8px;
  background: var(--bubble, var(--panel));
  border: 1px solid var(--border);
  font-size: .86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bc-profile-bio.empty { color: var(--muted); font-style: italic; }

.bc-profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin: .7rem 0;
}
.bc-profile-stat {
  padding: .5rem .6rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.bc-profile-stat .n {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.bc-profile-stat .l {
  display: block;
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.bc-profile-badges {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin: .5rem 0;
}
.bc-profile-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .16rem .45rem;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border2);
  font-size: .72rem;
  cursor: help;
}
.bc-profile-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.bc-profile-badge img { width: 13px; height: 13px; }

.bc-profile-foot {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
}
.bc-profile-foot button {
  flex: 1 1 auto;
  padding: .45rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--panel);
  color: var(--ink);
  font-size: .82rem;
  cursor: pointer;
}
.bc-profile-foot button:hover { background: var(--hover); }

.bc-profile-err {
  padding: .7rem;
  color: var(--err);
  font-size: .85rem;
}

/* Sur petit écran la popup occupe presque tout : sinon elle devient
   illisible, et c'est justement là que le profil est le plus cherché. */
@media (max-width: 520px) {
  .bc-profile { padding: .5rem; align-items: flex-end; }
  .bc-profile-box { width: 100%; max-height: 88vh; border-radius: 14px 14px 8px 8px; }
  .bc-profile-stats { grid-template-columns: 1fr 1fr; }
}