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: linear-gradient(135deg, #442F72 0%, #D3627E 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.video-wrapper {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  background: #1e293b;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  margin-bottom: 24px;
  border: 4px solid #D3627E;
}

.user-info {
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
}

.permission-notice {
  width: 90%;
  max-width: 400px;
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.support-link {
  margin-top: 32px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25D366;
  color: white !important;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none !important;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.whatsapp-btn:hover {
  transform: scale(1.05);
}

.whatsapp-btn img {
  width: 20px;
  height: 20px;
}

#local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.controls {
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.controls button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid #D3627E;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  touch-action: manipulation;
}

.controls button.enabled {
  background: #D3627E;
  border-color: #D3627E;
}

#join-btn {
  width: 90%;
  max-width: 400px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #D3627E;
  color: white;
  touch-action: manipulation;
}

#join-btn:disabled {
  background: #475569;
  color: #94a3b8;
  opacity: 0.6;
  cursor: not-allowed;
}

#join-btn:not(:disabled):hover {
  filter: brightness(1.1);
}

#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;
}

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

#participants .participant {
  width: 120px;
  height: 160px;
  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 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 {
  background-color: black;
  color: white !important;
  content: attr(data-identity);
  font-size: 10px;
  padding: 0 5px;
  position: absolute;
  z-index: 1000;
}

div.participant.main::before {
  font-size: 14px;
  padding: 0 10px;
}

@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: rgba(15, 23, 42, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1015;
  text-align: center;
}

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

.waiting-content {
  padding: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 90%;
}

.waiting-content h2 {
  color: #D3627E;
  margin-bottom: 1rem;
  font-weight: 700;
}

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