/* v0.121 - Appels audio et video (public/js/call.js) */

#dmModal .dm-call-btn[hidden] { display: none !important; }
/* charte.css masque tout .modal__close qui suit le bouton retour (la croix) :
   les boutons d'appel, eux, doivent rester dans une conversation. */
#dmModal .dm-back:not([hidden]) ~ .dm-call-btn:not([hidden]) { display: grid; }

.call {
  position: fixed; inset: 0; z-index: 5000;
  display: none; flex-direction: column; align-items: center;
  background: #141416; color: #fff;
  overscroll-behavior: none; touch-action: none;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.call.show { display: flex; }
html.call-open, html.call-open body { overflow: hidden; }
html.call-open #autoSaveToast { z-index: 5001; }

/* Video de l'autre en plein ecran (sert aussi a jouer le son en audio). */
.call__remote {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000; opacity: 0; pointer-events: none;
}
.call--video .call__remote { opacity: 1; }

/* Ma camera : plein ecran pendant la sonnerie, vignette une fois connecte. */
.call__local {
  display: none; position: absolute; object-fit: cover; background: #000;
  transform: scaleX(-1);
}
.call--preview .call__local {
  display: block; inset: 0; width: 100%; height: 100%; opacity: .55;
}
.call--video .call__local {
  display: block; width: 104px; height: 150px; border-radius: 14px;
  top: calc(env(safe-area-inset-top) + 16px); right: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4); z-index: 2;
}
.call--camoff .call__local { visibility: hidden; }

.call__info {
  position: relative; z-index: 1;
  margin-top: 18vh; display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.call--video .call__info {
  margin-top: calc(env(safe-area-inset-top) + 20px); align-self: flex-start;
  align-items: flex-start; text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.call--video .call__avatar { display: none; }

.call__avatar .call__avatar-img {
  width: 112px; height: 112px; border-radius: 50%;
  display: grid; place-items: center; font-size: 44px; font-weight: 700;
  background: var(--flame, #e4572e); color: #fff;
}
.call__avatar .avatar-img, .call__avatar .avatar-video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.call__name { font-size: 24px; font-weight: 700; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call__state { font-size: 16px; opacity: .8; font-family: 'Geist Mono', monospace; }

.call__bar {
  position: absolute; z-index: 2; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 40px);
  display: flex; justify-content: center; gap: 14px;
}
.call__btn {
  width: 60px; height: 60px; border-radius: 50%; border: none; position: relative;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 24px;
  display: grid; place-items: center; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.call__btn.is-on { background: #fff; color: #141416; }
.call__btn--red { background: #e5483f; }
.call__btn--green { background: #2fae66; }
.call__btn:active { transform: scale(.94); }

/* Boutons d'appel du chat de coaching */
.coach-chat__head .coach-chat__who { margin-right: auto; }
.call-head-btn {
  width: 40px; height: 40px; border: none; border-radius: 50%; flex: 0 0 auto;
  background: transparent; color: var(--text-primary); font-size: 18px;
  display: grid; place-items: center; cursor: pointer;
}
.call__lvl {
  position: absolute; bottom: 7px; left: 0; right: 0; text-align: center;
  font-size: 8px; letter-spacing: 1px; line-height: 1; opacity: .85;
}
