
.videos-container {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 1rem;
  padding-top: 2rem;
}
.videos-container.large {
  gap: 2rem;
  padding-top: 3rem;
}

.user-container {
  display: flex;
  position: relative;
  flex: 0 0 auto; /* Prevent containers from growing or shrinking */
  width: var(--user-container-width);
  height: var(--user-container-height);
  justify-content: center;
}
.user-container.large {
  --video-border: 0.2rem;
  --video-border-radius: 0.4rem;
  --username-font-size: 1.2rem;
  --username-padding: 0.2rem 0.4rem;
  --icon-size: 1.4rem;
  --icon-padding: 0.1em;
}
.user-container.square {
  --user-container-width: calc(var(--user-container-dl));
  --user-container-height: calc(var(--user-container-dl));
}
.user-container.portrait {
  --user-container-width: calc(var(--user-container-ds));
  --user-container-height: calc(var(--user-container-dl));
}
.user-container.landscape {
  --user-container-width: calc(var(--user-container-dl));
  --user-container-height: calc(var(--user-container-ds));
}
.user-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background-color: black;
}
.user-container.fullscreen video {
    width: 100%;
    height: 100%;
}

.profile-picture,
video,
canvas {
  position: absolute;
  display: block;
  z-index: 1;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: cover; /* Ensure they cover the entire container */
  border: var(--user-container-border) solid var(--dark-color);
  border-radius: var(--user-container-border-radius);
}
video {
  z-index: 2;
  visibility: hidden;
  /* left: 120px; */
}
canvas {
  z-index: 3;
  visibility: hidden;
  /* left: 240px; */
}

.speaking {
  box-shadow: 0 0 2rem rgba(255, 0, 0, 1); /* Optional for a glowing effect */
}

.username-button {
  position: absolute;
  z-index: 9;
  width: fit-content;
  padding: var(--username-padding);
  border-radius: var(--user-container-container-border-radius);
  color: #fff;
  background-color: rgba(0,0,0,0.3);
  font-size: var(--username-font-size);
  top: 0.4rem;
  left: 0.4rem;
}

.icon-wrapper {
  position: absolute;
  z-index: 9;
  width: var(--icon-size);
  height: var(--icon-size);
  padding: var(--icon-padding);
  border-radius: 0.2rem;
  color: #fff;
  background-color: rgba(255,255,255,0.5);
}
.icon-wrapper img {
  height: var(--icon-size);
  width: var(--icon-size);
  margin: auto;
}

.icon-mic,
.icon-audio {
  top: 2.4rem;
  left: 0.4rem;
}

.icon-camera,
.icon-video {
  top: 4.4rem;
  left: 0.4rem;
}


/* status wrapper placed top-left of each user container */
.user-status {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  pointer-events: none;
  z-index: 20;
}
.user-status {
  top: 5px;
  right: 5px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: red; /* gets updated by JS to green/yellow/etc */
}


/* the dot */
.user-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f00; /* default red */
  box-shadow: 0 0 6px rgba(255,0,0,0.6);
  transform-origin: center;
}

.user-status.disconnected {
  pointer-events: none; /* do not block control clicks */
  z-index: 20;
  width: fit-content;
  position: absolute;
  right: 5px;
}

/* pulsing heartbeat animation for connecting */
@keyframes heartbeat {
  0%   { transform: scale(1); opacity: 0.9; box-shadow: 0 0 2px rgba(255,0,0,0.25); }
  25%  { transform: scale(1.25); opacity: 1;   box-shadow: 0 0 8px rgba(255,0,0,0.45); }
  50%  { transform: scale(1); opacity: 0.9; box-shadow: 0 0 2px rgba(255,0,0,0.25); }
  100% { transform: scale(1); opacity: 0.9; box-shadow: 0 0 2px rgba(255,0,0,0.25); }
}

/* states */
.user-status.connecting .status-dot {
  background: #ff3b30;
  animation: heartbeat 1s infinite;
}
.user-status.connected .status-dot {
  background: #00c853;
  animation: none;
  box-shadow: 0 0 6px rgba(0,200,83,0.45);
}
.user-status.disconnected .status-dot {
  background: #9e9e9e;
  animation: none;
  box-shadow: 0 0 4px rgba(0,0,0,0.25);
}

.local-controls {
  position: absolute;
  left: 5px;
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 3;
}

.audio-btn {
  width: 30px;
  border: none;
  border-radius: 5px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.audio-img, .video-img {
  height: 20px;
  width: 20px;
}

.video-btn {
  width: 30px;
  border: none;
  border-radius: 5px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.media-area {
  width: 160px;
  height: 120px;
  position: relative;
  background: #000;
  display: none;
}
