/* ══════════════════════════════════════════════════════════════════
   ZWORLD — PROFZ STAGE INTELLIGENT
   Interface média indépendante : vocal, caméra et stream
   ══════════════════════════════════════════════════════════════════ */

#profz-stage[hidden] {
  display: none !important;
}

#profz-stage {
  --stage-green: #3ddc84;
  --stage-purple: #a855f7;
  --stage-danger: #ff4d67;
  --stage-bg: #050807;
  --stage-panel: rgba(13, 20, 17, 0.94);
  --stage-line: rgba(61, 220, 132, 0.18);

  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 15% 10%, rgba(168, 85, 247, 0.18), transparent 34%),
    radial-gradient(circle at 85% 90%, rgba(61, 220, 132, 0.14), transparent 38%),
    var(--stage-bg);
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

#profz-stage-header {
  min-height: 58px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(5, 8, 7, 0.86);
  border-bottom: 1px solid var(--stage-line);
  backdrop-filter: blur(16px);
}

#profz-stage-header > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#profz-stage-title {
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profz-stage-status {
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
}

#profz-stage-chat-toggle {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 12px;
  color: #fff;
  background: rgba(168, 85, 247, 0.14);
  cursor: pointer;
}

#profz-stage-layout {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#profz-stage-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.34);
}

#profz-stage-chat {
  width: min(360px, 38vw);
  min-width: 280px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--stage-panel);
  border-left: 1px solid rgba(168, 85, 247, 0.25);
  backdrop-filter: blur(18px);
}

#profz-stage-chat[hidden] {
  display: none !important;
}

#profz-stage-chat-messages {
  flex: 1;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
}

#profz-stage-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--stage-line);
}

#profz-stage-chat-input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--stage-line);
  border-radius: 12px;
  outline: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

#profz-stage-chat-input:focus {
  border-color: var(--stage-purple);
}

#profz-stage-chat-form button {
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #07110c;
  font-weight: 700;
  background: var(--stage-green);
  cursor: pointer;
}

#profz-stage-participants {
  min-height: 96px;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  background: rgba(5, 8, 7, 0.88);
  border-top: 1px solid var(--stage-line);
}

#profz-stage-controls {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 16px);
  padding: 8px 12px;
  flex-shrink: 0;
  background: rgba(5, 8, 7, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#profz-stage-controls button {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #fff;
  font-size: 19px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

#profz-stage-controls button[aria-pressed="true"] {
  background: rgba(255, 77, 103, 0.9);
  border-color: rgba(255, 77, 103, 0.7);
}

#profz-stage-leave {
  background: var(--stage-danger) !important;
}

@media (max-width: 720px) {
  #profz-stage-chat {
    position: absolute;
    inset: auto 0 0;
    z-index: 5;
    width: 100%;
    min-width: 0;
    height: min(58vh, 520px);
    border-top: 1px solid rgba(168, 85, 247, 0.35);
    border-left: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.55);
  }

  #profz-stage-participants {
    min-height: 82px;
    padding: 7px 8px;
  }

  #profz-stage-controls {
    min-height: 66px;
    gap: 8px;
    padding: 7px 8px;
  }

  #profz-stage-controls button {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   PROFZ STAGE — scène active et participants
   ══════════════════════════════════════════════════════════════════ */

.profz-stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.profz-stage-empty span {
  font-size: clamp(42px, 8vw, 72px);
}

.profz-stage-empty strong {
  color: #fff;
  font-size: clamp(20px, 4vw, 34px);
}

.profz-stage-empty small {
  font-size: 13px;
}

.profz-participant {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  outline: none;
  background:
    radial-gradient(circle at 50% 35%, rgba(168, 85, 247, 0.2), transparent 48%),
    #090d0b;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}

.profz-participant:focus-visible {
  border-color: var(--stage-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

.profz-participant.is-featured {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  cursor: default;
}

.profz-participant.is-speaking {
  border-color: var(--stage-green);
  box-shadow:
    0 0 0 2px rgba(61, 220, 132, 0.22),
    0 0 28px rgba(61, 220, 132, 0.18);
}

.profz-participant.is-pinned {
  border-color: var(--stage-purple);
  box-shadow:
    0 0 0 2px rgba(168, 85, 247, 0.25),
    0 0 24px rgba(168, 85, 247, 0.18);
}

.profz-participant video,
.profz-participant-fallback {
  width: 100%;
  height: 100%;
}

.profz-participant video {
  display: block;
  object-fit: cover;
  background: #000;
}

.profz-participant.is-local video {
  transform: scaleX(-1);
}

.profz-participant-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(61, 220, 132, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(168, 85, 247, 0.14), rgba(5, 8, 7, 0.95));
}

.profz-participant-fallback[hidden] {
  display: none;
}

.profz-participant-initial {
  width: clamp(70px, 18vw, 150px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(61, 220, 132, 0.32);
  border-radius: 50%;
  color: #fff;
  font-size: clamp(34px, 9vw, 72px);
  font-weight: 700;
  background: rgba(61, 220, 132, 0.1);
  box-shadow: 0 0 40px rgba(61, 220, 132, 0.12);
}

.profz-participant-information {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(10px);
}

.profz-participant-nick {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profz-participant-indicators {
  flex-shrink: 0;
  font-size: 12px;
}

#profz-stage-participants .profz-participant {
  width: 130px;
  min-width: 130px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 12px;
}

#profz-stage-participants .profz-participant:hover {
  transform: translateY(-2px);
}

#profz-stage-participants .profz-participant-initial {
  width: 42px;
  font-size: 20px;
}

#profz-stage-participants .profz-participant-information {
  right: 5px;
  bottom: 5px;
  left: 5px;
  padding: 4px 6px;
  border-radius: 7px;
}

#profz-stage-participants .profz-participant-nick {
  font-size: 10px;
}

#profz-stage-participants .profz-participant-indicators {
  font-size: 10px;
}

#profz-stage[data-mode="stream"] .profz-participant.is-featured {
  inset: 8px;
  border-color: rgba(255, 255, 255, 0.16);
}

@media (max-width: 720px) {
  .profz-participant.is-featured {
    inset: 5px;
    border-radius: 14px;
  }

  .profz-participant-information {
    right: 7px;
    bottom: 7px;
    left: 7px;
  }

  #profz-stage-participants .profz-participant {
    width: 104px;
    min-width: 104px;
    height: 68px;
  }
}
