/* Vue réunion, au niveau de Google Meet (docs/vue-reunion.md) : zoom dans une vignette, sélecteur de
   page de la mosaïque, réactions sur les vignettes et qui montent depuis le bas, plein écran d'un
   écran partagé. Les vignettes elles-mêmes sont dans app.css ; tout ce qui bouge ici bouge en
   transform et opacity. */

/* Un écran partagé est souvent clair (une diapo, un document) : son nom sur une pastille sombre. */
.tile.screen .tile-name {
  background: rgba(20, 16, 32, 0.62);
  border-color: rgba(255, 255, 255, 0.16);
}

/* --- Zoom dans une vignette (tile-zoom.js) : la vidéo grandit dans sa vignette (pas sa propre
   caméra, retournée en miroir autour de son centre) --- */
.tile:not(.mirror) video {
  transform-origin: 0 0;
}
.tile video.zoom-ease {
  transition: transform 220ms var(--ease-out);
}
.tile.zoomed {
  cursor: grab;
}
.tile.zoomed.panning {
  cursor: grabbing;
}
/* Les boutons − et + : en bas au centre, au survol de la scène ou d'un écran, et tant qu'on est zoomé. */
.tile-zoom {
  position: absolute;
  inset-inline: 0;
  bottom: 10px;
  width: max-content;
  margin-inline: auto;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.tile-zoom button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  padding: 0;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.tile-zoom button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}
.tile-zoom button:disabled {
  opacity: 0.38;
  cursor: default;
}
.app.meeting-view .tile.zoomable:hover .tile-zoom,
.app.meeting-view .tile.zoomed .tile-zoom,
.app.meeting-view .tile-zoom:focus-within {
  opacity: 1;
  pointer-events: auto;
}

/* --- Mosaïque : le sélecteur de page, en bas au centre --- */
.pager {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 4px;
  border-radius: var(--r-pill);
  opacity: 0;
  scale: 0.92;
  pointer-events: none;
  transition:
    opacity var(--dur-base) var(--ease-out),
    scale var(--dur-slow) var(--ease-spring);
}
.pager.shown {
  opacity: 1;
  scale: 1;
  pointer-events: auto;
}
.pager-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.pager-btn:hover:not(:disabled) {
  background: var(--fill);
}
.pager-btn:disabled {
  opacity: 0.32;
  cursor: default;
}
.pager-btn svg {
  width: 20px;
  height: 20px;
}
.pager-count {
  min-width: 46px;
  text-align: center;
  font-size: var(--fs-sub);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* --- Réactions : la pastille sur la vignette (3 s) --- */
.tile-react {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font-size: 28px;
  line-height: 1.1;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}
.tile-react.on {
  animation: react-badge 3000ms var(--ease-out) forwards;
}
.tile.big .tile-react {
  right: 12px;
  bottom: 9px;
  font-size: 44px;
}
.tile.huge .tile-react {
  font-size: 56px;
}
@keyframes react-badge {
  0% {
    opacity: 0;
    scale: 0.4;
  }
  9% {
    opacity: 1;
    scale: 1.18;
  }
  18% {
    scale: 1;
  }
  86% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 0.9;
  }
}

/* --- Réactions : en vue réunion, elles montent depuis le bas, avec le nom (comme dans Meet) --- */
.reactions-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}
.react-fly {
  position: absolute;
  left: 0;
  top: 0;
  animation-name: react-rise;
  animation-timing-function: cubic-bezier(0.25, 0.6, 0.4, 1);
  animation-fill-mode: forwards;
}
@keyframes react-rise {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  9% {
    opacity: 1;
    transform: translateY(-24px) scale(1);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift), var(--rise)) scale(0.96);
  }
}
.react-sway {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: react-sway 1.2s ease-in-out infinite alternate;
}
@keyframes react-sway {
  from {
    transform: translateX(calc(var(--sway) * -1));
  }
  to {
    transform: translateX(var(--sway));
  }
}
.react-emoji {
  font-size: 40px;
  line-height: 1.1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}
.react-name {
  max-width: 140px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: var(--fs-caption);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.react-fly.calm {
  animation-name: react-still;
}
.react-fly.calm .react-sway {
  animation: none;
}
@keyframes react-still {
  0%,
  100% {
    opacity: 0;
  }
  10%,
  80% {
    opacity: 1;
  }
}

body.editing .reactions-layer {
  display: none;
}

/* --- Plein écran d'un écran partagé (screen-full.js) : la vidéo est dans un cadre, qui passe en
   plein écran ; le navigateur le pose par-dessus tout, à la taille de l'écran, la page immobile
   dessous --- */
.tile-frame {
  position: absolute;
  inset: 0;
}
.tile-frame.is-full {
  background: #000;
  cursor: default;
  /* (La vignette peut être hors champ, .off : le cadre garde ses clics. Il couvre tout l'écran, mais
     seulement en plein écran, où l'application de bureau n'a plus de bande qui déplace la fenêtre :
     ses clics restent à lui.) */
  pointer-events: auto;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
.tile-frame.is-full video {
  background: transparent;
}
.tile.zoomed .tile-frame.is-full {
  cursor: grab;
}
.tile.zoomed.panning .tile-frame.is-full {
  cursor: grabbing;
}
/* Le pointeur immobile s'efface avec la barre. */
.tile .tile-frame.is-full.idle {
  cursor: none;
}

/* Le bouton : en haut à droite, au survol d'un écran partagé, en vue bureau comme en vue réunion. */
.tile-full {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--r-pill);
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-slow) var(--ease-spring);
}
.tile-full button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: var(--glass-blur, blur(10px));
  backdrop-filter: var(--glass-blur, blur(10px));
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.tile-full button:hover {
  background: rgba(0, 0, 0, 0.62);
}
.tile-full .full-mic {
  display: none;
}
.tile.screen:not(.off):hover .tile-full,
.tile-full:has(:focus-visible) {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.tile.big .tile-full {
  top: 12px;
  right: 12px;
}
.tile.big .tile-full button {
  width: 34px;
  height: 34px;
}

/* En plein écran, la barre, au même coin : le micro, puis le même bouton pour sortir. Elle vient
   quand le pointeur bouge (.awake) et s'efface quand il s'arrête, avec les boutons du zoom. */
.tile .tile-frame.is-full .tile-full {
  top: 18px;
  right: 18px;
  gap: 4px;
  padding: 4px;
  background: rgba(20, 16, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
}
.tile .tile-frame.is-full .tile-full button {
  width: 40px;
  height: 40px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.tile .tile-frame.is-full .tile-full button:hover {
  background: rgba(255, 255, 255, 0.16);
}
.tile .tile-frame.is-full .full-mic {
  display: grid;
}
/* Micro coupé : barré, sur fond rouge (comme sur les vignettes). */
.tile .tile-frame.is-full .full-mic.off {
  background: rgba(255, 59, 48, 0.9);
}
.tile .tile-frame.is-full .full-mic.off:hover {
  background: rgb(255, 59, 48);
}
.full-mic[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}
.tile-frame.is-full .tile-zoom {
  bottom: 22px;
  padding: 4px;
  gap: 4px;
  background: rgba(20, 16, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-slow) var(--ease-spring);
}
.tile-frame.is-full .tile-zoom button {
  width: 36px;
  height: 36px;
}
.tile .tile-frame.is-full:not(.awake) .tile-full {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.tile .tile-frame.is-full:not(.awake) .tile-zoom {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}
.tile .tile-frame.is-full.awake :is(.tile-full, .tile-zoom),
.tile .tile-frame.is-full :is(.tile-full, .tile-zoom):has(:focus-visible) {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
/* Les notifications viennent avec (ui.js, le temps du plein écran), sous la barre. */
.tile-frame.is-full .toasts {
  top: 78px;
  right: 18px;
  transition: none;
}

/* Qui parle : une bulle par personne (trois au plus), sa caméra en petit, empilées dans une bande
   vide de l'écran partagé s'il en laisse une (talkSpot), sinon au coin haut gauche ; elles pâlissent
   quand le pointeur s'en approche. Une bulle fait au plus deux fois la hauteur de l'ancienne pastille. */
.tile-talk {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  transition:
    opacity var(--dur-base) var(--ease-out),
    translate var(--dur-slow) var(--ease-sheet);
}
.tile-frame.is-full .tile-talk {
  display: flex;
}
.tile-talk.on.shy {
  opacity: 0.18;
}
.talk-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 5px 14px 5px 5px;
  border-radius: 16px;
  background: rgba(20, 16, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  backdrop-filter: var(--glass-blur, blur(18px) saturate(1.4));
  color: #fff;
  font-size: var(--fs-footnote);
  font-weight: 600;
  white-space: nowrap;
  animation: talk-in var(--dur-slow) var(--ease-spring);
  transition:
    opacity 220ms var(--ease-out),
    scale 220ms var(--ease-out),
    margin-bottom 300ms var(--ease-sheet);
}
/* Elle s'en va : en fondu, repliée sur sa hauteur (celles du dessous remontent). */
.talk-bubble.out {
  opacity: 0;
  scale: 0.92;
  margin-bottom: calc(-1 * var(--h, 60px) - 6px);
}
@keyframes talk-in {
  from {
    opacity: 0;
    translate: -10px 0;
    scale: 0.92;
  }
}
@keyframes talk-fade {
  from {
    opacity: 0;
  }
}
/* La caméra, en petit (ou l'avatar, caméra coupée). */
.talk-cam {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 48px;
  border-radius: 11px;
  overflow: hidden;
  background: #2e3350;
}
.talk-cam video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.talk-cam canvas {
  image-rendering: pixelated;
}
.talk-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Une petite onde qui bouge : on voit que ça parle, sans compter sur une couleur. */
.talk-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 12px;
}
.talk-bars i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  animation: talk-bar 900ms ease-in-out infinite alternate;
}
.talk-bars i:nth-child(2) {
  animation-delay: -300ms;
}
.talk-bars i:nth-child(3) {
  animation-delay: -600ms;
}
.talk-bubble.quiet .talk-bars i {
  animation-play-state: paused;
}
@keyframes talk-bar {
  from {
    transform: scaleY(0.35);
  }
  to {
    transform: scaleY(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile video.zoom-ease,
  .pager {
    transition: none;
  }
  .tile-react.on {
    animation-name: react-still;
  }
  .tile-talk {
    transition: opacity var(--dur-base) var(--ease-out);
  }
  .talk-bubble {
    animation-name: talk-fade;
  }
  .talk-bubble.out {
    scale: 1;
  }
  .talk-bars i {
    animation: none;
    transform: scaleY(0.7);
  }
}
