* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
  overflow-x: hidden;
}

body.in-call {
  padding: 0;
  background: #000;
  overflow: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.container.fullscreen {
  max-width: 100%;
  height: 100vh;
  margin: 0;
}

.container.fullscreen header {
  display: none;
}

header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
  font-size: 1.1em;
  opacity: 0.9;
}

.section {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#call-section {
  background: #000;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hidden {
  display: none !important;
}

/* Join Section */
.card {
  max-width: 500px;
  margin: 0 auto;
}

.card h2 {
  text-align: center;
  margin-bottom: 25px;
  color: #667eea;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.input-group input {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.input-group input:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
  width: 100%;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Call Section */
.room-info {
  text-align: center;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.room-info p {
  font-size: 1em;
  margin: 0;
  color: white;
}

.room-info strong {
  color: #667eea;
  font-family: monospace;
  font-size: 1.1em;
}

.video-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background: #000;
}

.remote-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
}

.remote-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.local-preview {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: min(320px, 28vw);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
}

.local-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-label {
  position: absolute;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 30;
  letter-spacing: 0.3px;
}

.video-label.primary {
  top: 20px;
  left: 20px;
  font-size: 18px;
}

.video-label.secondary {
  top: 12px;
  left: 12px;
  font-size: 14px;
}

.waiting {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 18px;
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  z-index: 10;
}

.controls {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 10;
}

.control-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  font-size: 28px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.control-btn:hover {
  background: white;
  transform: scale(1.1);
}

.control-btn:active {
  transform: scale(0.95);
}

.status {
  text-align: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.8);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.status p {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

#connection-status {
  font-weight: 600;
  color: #667eea;
  text-transform: capitalize;
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 2em;
  }

  .input-group {
    flex-direction: column;
  }

  .room-info {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .room-info p {
    font-size: 0.9em;
  }

  .btn-small {
    padding: 6px 12px;
    font-size: 12px;
  }

  .control-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .local-preview {
    width: min(260px, 40vw);
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  body.in-call {
    padding: 0;
  }

  .section {
    padding: 20px;
  }

  header h1 {
    font-size: 1.5em;
  }

  .video-label {
    font-size: 14px;
    padding: 6px 12px;
  }

  .local-preview {
    width: 48vw;
    bottom: 15px;
    right: 15px;
    border-radius: 12px;
  }

  .video-label.secondary {
    font-size: 12px;
    padding: 6px 10px;
  }
}
