/* Chat Discord en bulle, en bas à droite (discord-chat.js). */

.discord-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  justify-items: end;
  gap: 12px;
  /* Le cadre est transparent : il ne doit pas gêner les clics sur la page. */
  pointer-events: none;
}
.discord-chat > * { pointer-events: auto; }
.discord-chat[hidden] { display: none; }

.dc-logo {
  display: inline-block;
  width: 26px;
  height: 26px;
  background: currentColor;
  -webkit-mask: url("img/icons/discord.svg") center / contain no-repeat;
  mask: url("img/icons/discord.svg") center / contain no-repeat;
}

/* La bulle : ronde, à la couleur de Discord, avec sa lueur. */
.dc-bubble {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--discord, #5865f2);
  color: #fff;
  box-shadow: 0 10px 30px rgba(88, 101, 242, 0.45);
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(.2,.8,.2,1.2), box-shadow 0.24s;
}
.dc-bubble:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 38px rgba(88, 101, 242, 0.6); }
.dc-bubble:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.dc-bubble .dc-logo { width: 30px; height: 30px; }
/* Ouvert, la bulle devient un chevron pour replier. */
.is-open .dc-bubble .dc-logo {
  -webkit-mask-image: url("img/icons/chevron-down.svg");
  mask-image: url("img/icons/chevron-down.svg");
}

/* Le panneau : verre sombre au-dessus de la bulle. */
.dc-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 380px;
  height: min(560px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: #15161c;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  transform-origin: bottom right;
  animation: dc-open 0.26s cubic-bezier(.2,.8,.2,1);
}
.dc-panel[hidden] { display: none; }

.dc-head {
  display: grid;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(110deg, rgba(88, 101, 242, 0.28), rgba(88, 101, 242, 0.06));
  color: var(--text, #ededef);
}
.dc-row { display: flex; align-items: center; gap: 10px; }

/* Onglets des salons : notre propre sélection, au style du site. */
.dc-tabs { display: flex; gap: 6px; }
.dc-tabs button {
  flex: 1;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--silver, #a6a8b0);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.dc-tabs button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.dc-tabs button[aria-selected="true"] { border-color: transparent; background: var(--discord, #5865f2); color: #fff; }
.dc-tabs button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.dc-head .dc-logo { width: 22px; height: 22px; color: #fff; }
.dc-head strong { flex: 1; min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.dc-out { white-space: nowrap; }
.dc-out { color: var(--silver, #a6a8b0); font-size: 13px; font-weight: 600; }
.dc-out:hover { color: #fff; }
.dc-min {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #ededef);
  cursor: pointer;
}
.dc-min:hover { background: rgba(255, 255, 255, 0.16); }
.dc-min span { width: 14px; height: 2px; border-radius: 2px; background: currentColor; }

.dc-body { position: relative; min-height: 0; }
.dc-body iframe { display: block; width: 100%; height: 100%; border: 0; background: #313338; }

/* Avant le premier chargement : prévenir des cookies de Discord. */
.dc-consent {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--silver, #a6a8b0);
  font-size: 14px;
}
.dc-consent p { margin: 0; }
.dc-accept {
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--discord, #5865f2);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.dc-accept:hover { background: #4752c4; }
.dc-consent a { color: var(--text, #ededef); font-size: 13px; }

@keyframes dc-open { from { opacity: 0; transform: translateY(12px) scale(0.96); } }

@media (max-width: 620px) {
  .discord-chat { right: 12px; bottom: 12px; left: 12px; }
  .dc-panel { width: 100%; height: min(70vh, 560px); }
}

@media (prefers-reduced-motion: reduce) {
  .dc-panel { animation: none; }
  .dc-bubble { transition: none; }
}
