html {
  height: 100%;
}

body.dark-theme {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #442F72 0%, #D3627E 100%);
  color: white;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#prejoin-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #442F72;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 0;
}

.prejoin-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  color: white;
}

.avatar-container {
  margin-bottom: 24px;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: #2D1E4A;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.avatar-placeholder {
  width: 90px;
  height: 90px;
  color: rgba(255, 255, 255, 0.3);
}

.avatar video {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  display: none; /* Only show when video is enabled */
  border-radius: 50%;
}

.user-name {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  text-align: center;
}

.status-text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
}

.divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.instruction-text {
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 32px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 300px;
}

.instruction-text strong {
  color: white;
  font-weight: 700;
}

.permission-controls {
  display: flex;
  gap: 40px;
  margin-bottom: 40px;
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100px;
  cursor: pointer;
}

.icon-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.icon-btn svg {
  width: 32px;
  height: 32px;
}

.icon-btn.active {
  background: #22c55e;
  border-color: #22c55e;
}

.control-status {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.control-status.enabled {
  color: #22c55e;
  font-weight: 600;
}

.join-call-btn {
  width: 100%;
  background: #D3627E;
  color: white;
  border: none;
  border-radius: 30px;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 40px;
  transition: background 0.3s ease;
}

.join-call-btn:disabled {
  background: rgb(128, 128, 128);
  cursor: not-allowed;
}

.bottom-support {
  background: rgba(255, 255, 255, 0.05);
  width: 100%;
  padding: 24px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bottom-support p {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
}

.whatsapp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  color: #075E54 !important;
  padding: 10px 20px;
  border-radius: 100px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.95rem;
}

.whatsapp-link img {
  width: 32px;
  height: 32px;
}

#room-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  z-index: 1000;
}

#room {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#active-participant {
  width: 100%;
  height: 100%;
  background: #000;
}

#active-participant .participant.main,
#active-participant .participant.main video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
}

#active-participant .participant.main .avatar-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  color: rgba(255, 255, 255, 0.3);
  display: none;
}

#active-participant .participant.main.video-disabled video {
  display: none;
}

#active-participant .participant.main.video-disabled .avatar-placeholder {
  display: block;
}

#participants {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1010;
}

#participants .participant {
  width: 160px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#participants .participant.local-participant {
  display: block;
}

#participants .participant .avatar-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.3);
  display: none;
  z-index: 1;
}

#participants .participant.video-disabled video {
  display: none;
}

#participants .participant.video-disabled .avatar-placeholder {
  display: block;
}

#participants .participant.hidden-thumbnail {
  display: none !important;
}

#call-ended-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  text-align: center;
}

#signal-strength {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  margin-bottom: 10px;
  justify-content: center;
}

#signal-strength .bar {
  width: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
}

#signal-strength .bar-1 { height: 20%; }
#signal-strength .bar-2 { height: 40%; }
#signal-strength .bar-3 { height: 60%; }
#signal-strength .bar-4 { height: 80%; }
#signal-strength .bar-5 { height: 100%; }

#signal-strength.level-0 .bar { background: rgba(255, 255, 255, 0.3); }
#signal-strength.level-1 .bar-1 { background: #ef4444; }
#signal-strength.level-2 .bar-1, #signal-strength.level-2 .bar-2 { background: #f59e0b; }
#signal-strength.level-3 .bar-1, #signal-strength.level-3 .bar-2, #signal-strength.level-3 .bar-3 { background: #fbbf24; }
#signal-strength.level-4 .bar-1, #signal-strength.level-4 .bar-2, #signal-strength.level-4 .bar-3, #signal-strength.level-4 .bar-4 { background: #10b981; }
#signal-strength.level-5 .bar { background: #10b981; }


#participants .participant video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#participants .participant.active {
  border-color: #D3627E;
}

.room-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1020;
  background: rgba(15, 23, 42, 0.8);
  padding: 12px 24px;
  border-radius: 40px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #442F72;
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #5a3f91;
  transform: scale(1.1);
}

.control-btn.muted,
.control-btn.video-off {
  background: #ef4444;
}

.control-btn.end-call {
  background: #ef4444;
}

.control-btn.end-call:hover {
  background: #dc2626;
}

@media (max-width: 600px) {
  #participants {
    top: auto;
    bottom: 100px;
    right: 20px;
    width: 100px;
  }
  
  #participants .participant {
    width: 100px;
    height: 140px;
  }

  .room-controls {
    bottom: 20px;
    gap: 12px;
    padding: 10px 20px;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* Modals styling update to match theme */
.modal-content {
  background: #1e293b;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary {
  background-color: #D3627E;
  border-color: #D3627E;
}

.btn-primary:hover {
  background-color: #be536d;
  border-color: #be536d;
}

#error-screen {
  display: none;
  height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
  background: #442F72;
  color: white;
  font-size: 24px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3000;
}

#error-screen[style*="display: block"],
#error-screen[style*="display: flex"] {
  display: flex !important;
}

#room-screen {
  width: 100%;
  height: 100%;
}

div.container-fluid {
  height: 100%;
}

div#participants {
  overflow-y: auto;
}

div.participant {
  background: center no-repeat url("data:image/svg+xml;utf8,<svg class='bi bi-person-fill' width='80' height='45' viewBox='0 0 16 16' fill='currentColor' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 100-6 3 3 0 000 6z' clip-rule='evenodd'/></svg>");
  border: 1px solid gray;
  display: inline-flex;
  height: 90px;
  margin: 10px 5px;
  max-width: 160px;
  overflow: hidden;
}

div.participant > video {
  width: 100%;
}

div.participant.main {
  height: inherit;
  margin: 10px 0;
  max-width: 100%;
  width: 100%;
}

div.participant.main > video {
  height: 720px;
}

div.participant.active {
  border: 1px solid crimson;
  box-shadow: 0 0 5px crimson;
}

div.participant.active.pinned {
  border: 1px solid limegreen;
  box-shadow: 0 0 5px limegreen;
}

div.participant:hover {
  cursor: pointer;
}

div.participant::before {
  display: none;
}

div.participant.main::before {
  display: none;
}

@media (max-width: 576px) {
  div#participants {
    overflow-x: auto;
    white-space: nowrap;
  }

  div.participant.main > video {
    height: 180px;
  }
}

@media (max-width: 768px) {
  div.participant.main > video {
    height: 270px;
  }
}

#waiting-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(68, 47, 114, 0.75) 0%, rgba(0, 0, 0, 0.85) 100%);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1015;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#waiting-overlay.visible {
  display: flex !important;
  opacity: 1;
}

.waiting-top {
  position: absolute;
  top: 40px;
  width: 100%;
  text-align: center;
}

.waiting-top span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.waiting-content {
  padding: 2rem;
  max-width: 600px;
  width: 90%;
}

.waiting-content h1 {
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.waiting-content p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  margin-bottom: 0;
}

.room-controls {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 30px;
  z-index: 1020;
}

.control-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #442F72;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.control-btn svg {
  width: 28px;
  height: 28px;
}

.control-btn:hover {
  background: #5a3f91;
  transform: scale(1.05);
}

.control-btn.muted,
.control-btn.video-off {
  background: #ef4444;
}

.control-btn.end-call {
  width: 80px;
  height: 80px;
  background: #ef4444;
}

.control-btn.end-call svg {
  width: 36px;
  height: 36px;
}

.control-btn.end-call:hover {
  background: #dc2626;
  transform: scale(1.05) translateX(-50%); /* Need to be careful with translateX since parent is centered */
}

/* Fix for hover scale with absolute centering */
.control-btn.end-call:hover {
  transform: scale(1.05);
}

@media (max-width: 600px) {
  .waiting-content h1 {
    font-size: 1.8rem;
  }
  
  .waiting-content p {
    font-size: 1rem;
  }

  .room-controls {
    bottom: 40px;
    gap: 20px;
  }

  .control-btn {
    width: 50px;
    height: 50px;
  }

  .control-btn svg {
    width: 24px;
    height: 24px;
  }

  .control-btn.end-call {
    width: 70px;
    height: 70px;
  }

  .control-btn.end-call svg {
    width: 32px;
    height: 32px;
  }
}
