/* ---- Voice Screen Layout ---- */

#voice-screen {
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.voice-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  overflow: hidden;
}

/* Left column: main area on top, controls at the bottom */
.main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 400px;
  position: relative; /* for settings panel positioning */
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.voice-header {
  width: 100%;
  text-align: center;
  padding: 4px 0 10px;
  flex-shrink: 0;
}

#peer-count {
  font-size: 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* ---- Peers area ---- */

#peers-container {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 70vh;
  max-height: 70%;
  flex: 1 1 0;
  min-height: 150px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
}

/* ---- Peer Bubble ---- */

.peer-bubble {
  position: absolute;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 1;
  will-change: transform;
  transition: none; /* physics handles positioning */
}

/* Name label sits above the visual */
.peer-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  order: -1; /* flex order: before visual */
}

/* ---- Default Avatar (circle with initial) ---- */

/* Narrower bubble when using avatar instead of forklift */
.peer-bubble:has(.avatar-container) {
  width: 96px;
}

.avatar-container {
  position: relative;
  width: 56px;
}

.peer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: filter 0.3s, opacity 0.3s;
  user-select: none;
}

/* Speaking glow on avatar */
.peer-bubble.speaking .peer-avatar {
  filter: drop-shadow(0 0 6px var(--success-glow));
  box-shadow: 0 0 0 3px var(--success), 0 0 12px var(--success-glow);
}

/* "You" subtle highlight on avatar */
.peer-bubble.you .peer-avatar {
  box-shadow: 0 1px 6px rgba(78, 201, 160, 0.25);
}

.peer-bubble.you.speaking .peer-avatar {
  box-shadow: 0 0 0 3px var(--success), 0 0 12px var(--success-glow);
}

/* Muted dim on avatar */
.peer-bubble.muted .peer-avatar {
  opacity: 0.45;
}

/* ---- Forklift (construction theme — CSS in construction.css) ---- */

.forklift-container {
  position: relative;
  width: 100px;
}

.forklift-svg {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 0.3s, transform 0.3s;
}

/* Speaking glow on forklift */
.peer-bubble.speaking .forklift-svg {
  filter: drop-shadow(0 0 4px var(--success-glow));
}

/* "You" subtle highlight */
.peer-bubble.you .forklift-svg {
  filter: drop-shadow(0 1px 3px rgba(78, 201, 160, 0.25));
}

.peer-bubble.you.speaking .forklift-svg {
  filter: drop-shadow(0 0 4px var(--success-glow));
}

/* Muted dim */
.peer-bubble.muted .forklift-svg {
  opacity: 0.45;
}

/* ---- Status icon badges ---- */

.peer-icons {
  position: absolute;
  top: -4px;
  left: -2px;
  display: flex;
  gap: 2px;
}

.peer-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-body);
}

.peer-icon svg {
  width: 10px;
  height: 10px;
}

.peer-icon-mute {
  background: var(--danger);
  color: var(--text-bright);
}

.peer-icon-share {
  background: var(--success);
  color: var(--bg-body);
}

/* ---- Fork Tine Animation (construction theme) ---- */

.fork-tines {
  animation: fork-lift 6s ease-in-out infinite;
}

@keyframes fork-lift {
  0%, 75%, 100% { transform: translateY(0); }
  82%            { transform: translateY(-8px); }
  88%            { transform: translateY(-2px); }
  94%            { transform: translateY(-6px); }
}

/* ---- Static mode (animation disabled) ---- */

#peers-container.no-physics {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: center;
  justify-content: center;
  gap: 28px;
  height: auto;
  min-height: 120px;
  max-height: none;
  max-width: none;
  aspect-ratio: auto;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}

#peers-container.no-physics .peer-bubble {
  position: static;
  transform: none !important;
}

#peers-container.no-physics .forklift-svg {
  transform: none !important;
}

/* ---- Call Action Bar (Join / Leave Call) ---- */

.call-action-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 0 4px;
  flex-shrink: 0;
}

.join-call-btn,
.leave-call-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 50px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.3px;
}

.join-call-btn {
  background: var(--primary);
  color: var(--text-bright);
}

.join-call-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.03);
}

.join-call-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.leave-call-btn {
  background: var(--danger);
  color: var(--text-bright);
}

.leave-call-btn:hover {
  background: var(--danger-hover);
  transform: scale(1.03);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .peer-bubble {
    transition: transform 0.5s ease !important;
  }
  .fork-tines {
    animation: none !important;
  }
}
