* {
  box-sizing: border-box;
}



body.room {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f8f9fa;
  color: #333;
  min-height: 100vh;
}

.chat-box {
  display: flex;
}


@media (max-width: 768px) {
  body.room {
    min-height: 120vh;
    margin-bottom: 150px;
  }
}

.top-bar {
  background: #ffffff;
  padding: 15px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #e9ecef;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.top-bar-title h2 {
  margin: 0;
  color: #495057;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.welcome-message {
  font-size: 14px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.room-info {
  font-size: 11px;
  color: #6c757d;
  margin-top: 0;
  opacity: 0.8;
}

.top-bar-icons {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info {
  display: flex;
  align-items: center;
}

.user-icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
  background: #f8f9fa;
  border-radius: 50%;
  border: 2px solid #e9ecef;
}

.user-icon-container i {
  font-size: 11px;
  color: #6c757d;
}

.user-counter {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #007bff;
  color: white;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 8px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.message-counter {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #28a745;
  color: white;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 8px;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.top-icon-btn {
  background: #f8f9fa;
  color: #6c757d;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
  text-decoration: none;
  position: relative;
  overflow: visible;
}

.top-icon-btn:hover {
  background: #007bff;
  color: white;
  transform: translateY(-1px);
}

.new-room-btn {
  background: #f8f9fa;
  color: #007bff;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
  font-size: 11px;
}

.new-room-btn:hover {
  background: #007bff;
  color: white;
  transform: translateY(-1px);
}

/* WhatsApp button styling - SAME SIZE AS OTHER ICONS */
.top-icon-btn[data-action="openWhatsAppInvite"] {
  background: #f8f9fa;
  color: #25D366;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
  font-size: 11px;
}

.top-icon-btn[data-action="openWhatsAppInvite"]:hover {
  background: #25D366;
  color: white;
  transform: translateY(-1px);
}

/* WhatsApp Modal Styling - Professional WhatsApp-like Design */
.whatsapp-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  animation: modalZoomIn 0.3s ease forwards;
}

.whatsapp-modal-header {
  background: #25D366;
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.whatsapp-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.whatsapp-close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.whatsapp-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.whatsapp-header-left h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.whatsapp-action-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.whatsapp-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.whatsapp-modal-body {
  flex: 1;
  overflow-y: auto;
  background: #f0f2f5;
}

.whatsapp-section {
  display: none;
}

.whatsapp-section.active {
  display: block;
}

/* Loading State */
.whatsapp-loading {
  text-align: center;
  padding: 60px 20px;
  color: #667781;
}

.whatsapp-loading i {
  font-size: 36px;
  color: #25D366;
  margin-bottom: 16px;
}

.whatsapp-loading p {
  margin: 0;
  font-size: 16px;
}

/* Search Section */
.whatsapp-search-section {
  background: white;
  padding: 12px 16px;
  border-bottom: 1px solid #e9ecef;
}

.whatsapp-search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.whatsapp-search-container i {
  position: absolute;
  left: 12px;
  color: #667781;
  font-size: 16px;
  z-index: 1;
}

.whatsapp-search-container input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: none;
  border-radius: 18px;
  background: #f0f2f5;
  font-size: 15px;
  outline: none;
  transition: background 0.2s ease;
}

.whatsapp-search-container input:focus {
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Add Contact Section */
.whatsapp-add-section {
  background: white;
  margin-bottom: 8px;
}

.whatsapp-add-contact {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #e9ecef;
}

.whatsapp-add-contact:hover {
  background: #f5f6f6;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #25D366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  flex-shrink: 0;
  font-size: 20px;
}

.add-avatar {
  background: #128C7E;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 16px;
  font-weight: 400;
  color: #111b21;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-subtitle {
  font-size: 14px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-phone {
  font-size: 14px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Add Contact Form */
.whatsapp-add-form {
  background: white;
  margin: 8px 16px;
  border-radius: 12px;
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-header {
  background: #f0f2f5;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
}

.form-header h4 {
  margin: 0;
  font-size: 16px;
  color: #111b21;
  font-weight: 500;
}

.form-inputs {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-inputs input {
  padding: 12px 16px;
  border: 1px solid #d1d7db;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-inputs input:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.1);
}

.form-buttons {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #f0f2f5;
  border-top: 1px solid #e9ecef;
}

.form-cancel, .form-save {
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-cancel {
  background: #f0f2f5;
  color: #667781;
}

.form-cancel:hover {
  background: #e4e6ea;
}

.form-save {
  background: #25D366;
  color: white;
}

.form-save:hover {
  background: #128C7E;
}

/* Selection Info */
.whatsapp-selection-info {
  background: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 8px;
}

.selection-text {
  font-size: 14px;
  color: #667781;
}

.select-all-btn {
  background: none;
  border: none;
  color: #25D366;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.select-all-btn:hover {
  background: rgba(37, 211, 102, 0.1);
}

/* Contacts List */
.whatsapp-contacts-list {
  background: white;
  flex: 1;
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f0f2f5;
  position: relative;
}

.contact-item:hover {
  background: #f5f6f6;
}

.contact-item input[type="checkbox"] {
  position: absolute;
  right: 20px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #25D366;
}

.contact-item .contact-avatar {
  background: #ddd;
  color: #666;
  font-size: 18px;
}

.contact-item .contact-avatar.has-name {
  background: #25D366;
  color: white;
}

/* Generate avatar colors based on name */
.contact-item .contact-avatar.color-1 { background: #25D366; }
.contact-item .contact-avatar.color-2 { background: #128C7E; }
.contact-item .contact-avatar.color-3 { background: #075E54; }
.contact-item .contact-avatar.color-4 { background: #34B7F1; }
.contact-item .contact-avatar.color-5 { background: #009688; }
.contact-item .contact-avatar.color-6 { background: #00BCD4; }

/* No Results */
.whatsapp-no-results {
  padding: 60px 20px;
  text-align: center;
}

.no-results-content i {
  font-size: 48px;
  color: #d1d7db;
  margin-bottom: 16px;
}

.no-results-content p {
  color: #667781;
  font-size: 16px;
  margin: 0;
}

/* Error State */
.whatsapp-error {
  text-align: center;
  padding: 60px 20px;
}

.whatsapp-error i {
  font-size: 48px;
  color: #dc3545;
  margin-bottom: 16px;
}

.whatsapp-error h4 {
  color: #111b21;
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 500;
}

.whatsapp-error p {
  color: #667781;
  margin: 0 0 24px 0;
  font-size: 14px;
}

.whatsapp-retry {
  background: #25D366;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-retry:hover {
  background: #128C7E;
}

/* Send Button Footer */
.whatsapp-send-footer {
  background: white;
  padding: 16px 20px;
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.whatsapp-send-btn {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.whatsapp-send-btn:hover:not(:disabled) {
  background: #128C7E;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-send-btn:disabled {
  background: #d1d7db;
  color: #667781;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .whatsapp-modal-content {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .whatsapp-modal-header {
    padding: 14px 16px;
  }
  
  .whatsapp-header-left h3 {
    font-size: 17px;
  }
  
  .contact-item {
    padding: 12px 16px;
  }
  
  .whatsapp-add-contact {
    padding: 16px;
  }
  
  .whatsapp-selection-info {
    padding: 12px 16px;
  }
  
  .whatsapp-send-footer {
    padding: 12px 16px;
  }
}

.copy-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
}

.copy-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.main {
  padding: 20px;
  padding-bottom: 120px;
  max-width: 1200px;
  margin: 0 auto;
}

.video-grid {
  display: flex;
  gap: 15px;
  padding: 15px;
  height: calc(100vh - 160px);
  overflow-y: auto;
  align-items: start;
  justify-content: center;
}

/* Default grid layout - all videos same size */
.video-grid.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
  justify-content: center;
}

/* Focused layout - one large video on left, mini videos in right column */
.video-grid.focus-mode {
  display: flex;
  flex-direction: row !important;
  gap: 20px;
  align-items: flex-start;
  height: calc(100vh - 160px);
}

.video-grid.focus-mode .main-video-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  padding-right: 15px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.video-grid.focus-mode .mini-videos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  flex-shrink: 0;
}

.video-wrapper {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Grid mode video sizing - all videos same moderate size */
.video-grid.grid-mode .video-wrapper {
  width: 180px !important;
  height: 180px !important;
  min-width: 180px !important;
  min-height: 180px !important;
  max-width: 180px !important;
  max-height: 180px !important;
}

/* Focused video - takes maximum available space with 16:9 aspect ratio */
.video-wrapper.focused {
  width: 100% !important;
  aspect-ratio: 16/9 !important;
  height: auto !important;
  max-height: 60vh !important;
}

/* Mini video thumbnails in right column */
.video-wrapper.mini {
  width: 120px !important;
  height: 120px !important;
  min-width: 120px !important;
  min-height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  flex-shrink: 0;
}

.video-wrapper:hover:not(.focused) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
  border: 2px solid #007bff;
}

/* ALL regular videos ALWAYS maintain 1:1 aspect ratio */
.video-wrapper {
  aspect-ratio: 1/1 !important;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  aspect-ratio: 1/1 !important;
}

/* Focused videos use 16:9 aspect ratio and contain fit */
.video-wrapper.focused video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Screen sharing videos maintain original aspect ratio */
.video-wrapper.screen-share {
  aspect-ratio: auto !important;
  width: auto !important;
  height: auto !important;
  min-width: auto !important;
  min-height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  cursor: pointer;
}

.video-wrapper.screen-share video {
  object-fit: contain;
  aspect-ratio: auto !important;
}

/* Screen sharing in focused mode */
.video-wrapper.screen-share.focused {
  aspect-ratio: auto !important;
  width: 100% !important;
  height: auto !important;
  min-width: auto !important;
  min-height: auto !important;
  max-width: 100% !important;
  max-height: 70vh !important;
}

/* Screen sharing in mini mode */
.video-wrapper.screen-share.mini {
  aspect-ratio: auto !important;
  width: auto !important;
  height: 80px !important;
  min-width: 120px !important;
  min-height: 80px !important;
  max-width: 200px !important;
  max-height: 80px !important;
}

/* Username labels */
.video-wrapper .username-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  z-index: 10;
  font-weight: 500;
  pointer-events: none;
}

/* Background selector icon */
.background-selector-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 35px;
  height: 35px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  opacity: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.background-selector-icon:hover {
  background: rgba(0, 123, 255, 0.8);
  transform: scale(1.1);
}

/* Show on hover for desktop */
.video-wrapper:hover .background-selector-icon {
  opacity: 1;
}

/* Always show on local video wrapper */
#local-video-wrapper .background-selector-icon {
  opacity: 1;
}

.video-wrapper.mini .username-label {
  font-size: 9px;
  padding: 2px 6px;
  bottom: 5px;
  left: 5px;
}

.video-wrapper.focused .username-label {
  font-size: 14px;
  padding: 6px 12px;
  bottom: 15px;
  left: 15px;
}

/* Responsive design */
@media (max-width: 768px) {
  .video-grid.grid-mode {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px;
    padding: 5px;
    justify-content: center;
    justify-items: center;
  }

  /* MOBILE ONLY - Focus mode changes to column layout */
  .video-grid.focus-mode {
    flex-direction: column !important;
    height: calc(100vh - 140px);
    gap: 10px;
    padding: 5px;
    width: 100%;
  }

  .video-grid.focus-mode .main-video-area {
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    flex: none !important; /* Don't flex on mobile */
    padding-right: 0 !important; /* Remove desktop padding */
  }

  .video-grid.focus-mode .mini-videos {
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    gap: 8px;
    white-space: nowrap;
    display: flex !important;
    flex-wrap: nowrap !important;
    max-width: 100% !important; /* Override desktop width */
    min-width: 100% !important; /* Override desktop width */
  }

  .video-wrapper.mini {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    min-height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    aspect-ratio: 1/1 !important;
    flex-shrink: 0 !important;
  }

  .video-wrapper.focused {
    width: 100% !important;
    aspect-ratio: 16/9 !important;
    height: auto !important;
    max-height: 50vh !important;
    margin: 0 !important;
    border-radius: 8px !important;
  }
}

video {
  width: 100%;
  height: auto;
  display: block;
}

.controls-container {
  display: flex;
  justify-content: center;
  padding: 8px;
  border-top: 1px solid #e9ecef;
  background: white;
}

.controls {
  display: flex;
  gap: 15px;
  background: white;
  padding: 8px 15px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  justify-content: space-evenly;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.control-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
}

.settings-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #f8f9fa;
  color: #6c757d;
  cursor: pointer;
  font-size: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.settings-btn.active {
  background: #007bff;
  color: white;
  transform: rotate(180deg);
}

.settings-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px;
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-bottom: 8px;
}

.settings-dropdown.show {
  display: block;
}

.settings-dropdown h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #495057;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 6px;
}

.settings-dropdown label {
  display: block;
  margin: 6px 0 3px 0;
  font-size: 10px;
  color: #6c757d;
  font-weight: 500;
}

.settings-dropdown select {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid #ced4da;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s ease;
  background: white;
  color: #495057;
  cursor: pointer;
  min-height: 28px;
}

.settings-dropdown select:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.settings-dropdown input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 10px;
  margin-bottom: 6px;
  outline: none;
  transition: border-color 0.2s ease;
}

.settings-dropdown input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.settings-dropdown button {
  width: 100%;
  padding: 6px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  margin-top: 4px;
  transition: background-color 0.2s ease;
}

.settings-dropdown button:hover {
  background: #0056b3;
}

.control-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: 26px;
  max-height: 26px;
  border-radius: 50%;
  border: none;
  background: #007bff;
  color: white;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  padding: 0;
}

.control-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Control button states - RED when deactivated, GREEN when activated */
.control-btn.active {
  background: #dc3545 !important; /* RED for deactivated/off */
  color: white !important;
  border: 2px solid #dc3545 !important;
}

.control-btn.activated {
  background: #28a745 !important; /* GREEN for activated/on */
  color: white !important;
  border: 2px solid #28a745 !important;
}

/* Default state styling */
.control-btn {
  background: #6c757d;
  color: white;
  border: 2px solid #6c757d;
}

.mobile-only {
  display: none;
}

.mobile-camera-switch {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only {
    display: none !important;
  }

  .mobile-camera-switch {
    display: flex !important;
  }
}

button {
  font-family: inherit;
  font-weight: 500;
}

.chat-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.chat-box {
  max-height: 200px;
  overflow-y: auto;
  background: white;
  padding: 15px;
  margin: 0;
  border: none;
  box-shadow: none;
}

.chat-box div {
  margin-bottom: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid #007bff;
}

.chat-input {
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.chat-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 25px;
  border: 1px solid #ced4da;
  padding: 4px;
  transition: border-color 0.2s ease;
}

.chat-input-container:focus-within {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.chat-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f8f9fa;
  color: #6c757d;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.chat-icon-btn:hover {
  background: #007bff;
  color: white;
  transform: scale(1.05);
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  outline: none;
  background: transparent;
  box-sizing: border-box;
}

.chat-input input::placeholder {
  color: #6c757d;
}

/* File and Image Sharing Styles */
.file-message, .image-message {
  margin-bottom: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid #007bff;
}

.file-share, .image-share {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #e9ecef;
}

.file-item:hover {
  background: #e3f2fd;
  border-color: #007bff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.file-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
}

.file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.file-size {
  font-size: 12px;
  color: #666;
}

.download-icon {
  font-size: 18px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.file-item:hover .download-icon {
  opacity: 1;
}

.image-item {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
  max-width: 300px;
}

.image-item:hover {
  transform: scale(1.02);
}

.shared-image-thumbnail {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 12px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.image-item:hover .image-overlay {
  transform: translateY(0);
}

.image-name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
}

.image-size {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.click-hint {
  font-size: 10px;
  opacity: 0.7;
  font-style: italic;
}

/* Remote Control Styles */
.remote-control-btn {
  position: absolute;
  top: 40px;
  right: 10px;
  background: rgba(0, 123, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: white;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.remote-control-btn:hover {
  background: rgba(0, 123, 255, 1);
  transform: scale(1.1);
}

/* Remote Control Full Screen Modal */
.remote-control-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.98);
  z-index: 10000;
  display: none;
  backdrop-filter: blur(5px);
}

.remote-control-modal.open {
  display: block;
}

.remote-control-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #000;
}

.remote-control-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(255, 107, 107, 0.95);
  color: white;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.remote-control-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.remote-control-modal-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.remote-control-shortcut-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.remote-control-shortcut-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.close-remote-control-btn {
  background: rgba(220, 53, 69, 0.8);
  border: 1px solid rgba(220, 53, 69,0.8);
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-remote-control-btn:hover {
  background: rgba(220, 53, 69, 1);
  transform: translateY(-1px);
}

.remote-control-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.remote-control-screen-container {
  flex: 1;
  position: relative;
  background: #111;
  border: 2px solid #333;
  margin: 10px;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remote-control-screen-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.remote-control-screen-container canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.remote-control-instructions {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.8);
  color: #ccc;
  text-align: center;
  border-top: 1px solid #333;
}

.remote-control-instructions p {
  margin: 5px 0;
  font-size: 13px;
}

.remote-control-cursor-indicator {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(255, 107, 107, 0.9);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.1s ease;
}

/* Mobile adjustments for remote control modal */
@media (max-width: 768px) {
  .remote-control-modal-header {
    padding: 12px 15px;
    flex-direction: column;
    gap: 10px;
  }

  .remote-control-modal-header h3 {
    font-size: 16px;
  }

  .remote-control-modal-controls {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }

  .remote-control-shortcut-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .close-remote-control-btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .remote-control-screen-container {
    margin: 5px;
  }

  .remote-control-instructions {
    padding: 10px 15px;
  }

  .remote-control-instructions p {
    font-size: 12px;
  }
}

.remote-control-request-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.remote-control-request-content {
  background: white;
  border-radius: 12px;
  padding: 25px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.remote-control-request-header h3 {
  margin: 0 0 15px 0;
  color: #333;
  text-align: center;
}

.remote-control-request-body {
  margin-bottom: 20px;
  color: #555;
  line-height: 1.5;
}

.remote-control-request-body ul {
  margin: 10px 0;
  padding-left: 20px;
}

.remote-control-request-body li {
  margin: 5px 0;
}

.remote-control-request-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.grant-control-btn, .deny-control-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.grant-control-btn {
  background: #28a745;
  color: white;
}

.grant-control-btn:hover {
  background: #218838;
}

.deny-control-btn {
  background: #dc3545;
  color: white;
}

.deny-control-btn:hover {
  background: #c82333;
}

.remote-control-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 107, 107, 0.95);
  color: white;
  padding: 10px 20px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.remote-control-title {
  font-weight: bold;
  font-size: 16px;
}

.remote-control-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.remote-control-controls button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255,0.3);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
}

.remote-control-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.stop-control-btn {
  background: rgba(220, 53, 69, 0.8) !important;
  border-color: rgba(220, 53, 69, 0.8) !important;
}

.stop-control-btn:hover {
  background: rgba(220, 53, 69, 1) !important;
}

.video-remote-control-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.remote-control-cursor {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(255, 107, 107, 0.8);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.remote-control-status {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 300px;
}

.remote-control-status.controlling {
  background: rgba(255, 107, 107, 0.95);
}

.remote-control-status.controlled {
  background: rgba(255, 193, 7, 0.95);
}

.remote-control-status.waiting {
  background: rgba(108, 117, 125, 0.95);
}

.remote-control-status.denied {
  background: rgba(220, 53, 69, 0.95);
}

.remote-control-status-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.remote-control-status-close {
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.remote-control-status-close:hover {
  opacity: 0.7;
}

/* Image modal styles */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  animation: modalFadeIn 0.3s ease forwards;
}

@keyframes modalFadeIn {
  to {
    opacity: 1;
  }
}

.image-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  animation: modalZoomIn 0.3s ease forwards;
}

@keyframes modalZoomIn {
  to {
    transform: scale(1);
  }
}

.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.image-modal-title {
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.image-modal-close {
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #666;
  transition: color 0.2s ease;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.image-modal-close:hover {
  color: #333;
  background: #e9ecef;
}

.image-modal-body {
  padding: 20px;
  text-align: center;
  max-height: 70vh;
  overflow: auto;
}

.modal-image {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
  text-align: center;
}

.download-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.download-btn:hover {
  background: #0056b3;
}

/* Mobile responsiveness for file/image sharing */
@media (max-width: 768px) {
  .image-modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .image-modal-header {
    padding: 12px 16px;
  }

  .image-modal-title {
    font-size: 14px;
  }

  .image-modal-body {
    padding: 16px;
  }

  .modal-image {
    max-height: 50vh;
  }

  .image-item {
    max-width: 250px;
  }

  .shared-image-thumbnail {
    max-height: 150px;
  }

  .file-item {
    padding: 8px;
    gap: 8px;
  }

  .file-icon {
    font-size: 20px;
    width: 32px;
  }

  .file-name {
    font-size: 13px;
  }

  .file-size {
    font-size: 11px;
  }
}

.main {
  padding-bottom: 280px;
}

/* Landing page styles */
body.landing {
  margin: 0;
  padding: 0;
  width: 100vw;
  min-height: 100vh;
  background: #007bff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.landing-background {
  background: #007bff;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  max-width: 450px;
  width: 100%;
  text-align: center;
  margin: 0 auto;
}

.logo-section {
  margin-bottom: 30px;
}

.logo {
  width: 80px;
  height: 80px;
  margin-bottom: 15px;
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 1);
}

.container h1 {
  color: #007bff;
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 700;
  background: #007bff;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.guest-join-label {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  margin: 10px 0;
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.guest-join-label:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a3f90 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
}

.guest-text {
  font-weight: 600;
}

.tagline {
  color: #6c757d;
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 400;
}

.form-section {
  margin: 30px 0;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 16px;
  z-index: 1;
}

.container input {
  width: 100%;
  padding: 15px 20px 15px 50px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background:white;
}

@media (max-width: 768px) {
  .container input {
    padding: 15px 15px 15px 80px;
    text-indent: 10px;
    text-align: center;
  }

  .input-group .icon {
    left: 25px;
  }
}

.container input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgb(4, 48, 246, 0.1);
}

.primary-btn, .secondary-btn {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

.primary-btn {
  background: #007bff;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.primary-btn:hover {
  background: #0554a8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.secondary-btn {
  background: transparent;
  color: #007bff;
  border: 2px solid #007bff;
}

.secondary-btn:hover {
  background: #007bff;
  color: white;
  transform: translateY(-2px);
  border: 2px solid #007bff;
}

.divider {
  display: flex;
  align-items: center;
  margin: 25px 0;
  color: #6c757d;
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e9ecef;
}

.divider span {
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.95);
}

.features {
  display: flex;
  justify-content: space-around;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6c757d;
}

.feature i {
  font-size: 18px;
  color: #007bff;
}

@media (max-width: 480px) {
  .container {
    padding: 30px 20px;
    margin: 10px;
  }

  .logo {
    width: 60px;
    height: 60px;
  }

  .container h1 {
    font-size: 24px;
  }

  .features {
    flex-direction: row;
    justify-content: space-around;
    gap: 8px;
  }

  .feature {
    flex-direction: column;
    align-items: center;
    font-size: 11px;
  }

  .feature i {
    font-size: 16px;
  }
}

.container input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.container button {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.container button:hover {
  background: #0056b3;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  body.landing {
    padding: 5px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .container {
    max-width: 98%;
    width: 98%;
    padding: 20px 10px;
    margin: 0 auto;
  }

  .container h1 {
    font-size: 24px;
  }

  .container input {
    font-size: 18px;
    padding: 15px;
  }

  .container button {
    font-size: 18px;
    padding: 15px;
  }

  /* Mobile video grid improvements - ALWAYS 1:1 aspect ratio */
  .video-grid {
    padding: 5px;
    height: calc(100vh - 140px);
    gap: 4px;
  }

  .video-grid.grid-mode {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 5px;
  }

  .video-grid.focus-mode {
    flex-direction: column;
    height: calc(100vh - 140px);
    gap: 10px;
  }

  .video-grid.focus-mode .main-video-area {
    width: 100%;
    height: 60%;
    min-height: 200px;
    margin-bottom: 10px;
  }

  .video-grid.focus-mode .mini-videos {
    width: 100%;
    height: 40%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    gap: 8px;
    white-space: nowrap;
  }

  .video-wrapper {
    border-radius: 8px;
    min-height: 120px;
    max-height: 140px;
  }

  .video-wrapper.focused {
    min-height: 200px;
    max-height: 300px;
    width: 100%;
    height: 100%;
  }

  .video-wrapper.mini {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    max-height: 100px;
    flex-shrink: 0;
    display: inline-block;
  }

  /* Mobile controls improvements */
  .controls {
    gap: 6px;
    padding: 8px 12px;
    flex-wrap: nowrap;
    justify-content: space-evenly;
    overflow-x: auto;
    white-space: nowrap;
    width: 95%;
    max-width: 100%;
  }

  .control-group {
    flex-direction: row;
    gap: 3px;
    flex-shrink: 0;
    align-items: center;
  }

  .settings-btn {
    width: 20px;
    height: 20px;
    font-size: 8px;
  }

  .settings-dropdown {
    min-width: 300px;
    max-width: 95vw;
    padding: 15px;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 2000;
  }

  .control-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .main {
    padding: 8px;
    padding-bottom: 140px;
  }

  /* Mobile top bar improvements */
  .top-bar {
    padding: 12px 15px;
  }

  .top-bar-content {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .top-bar-title {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
  }

  .top-bar-title h2 {
    font-size: 16px;
    flex-direction: column;
    gap: 6px;
    align-items: center;
  }

  .welcome-message {
    justify-content: center;
    margin: 2px 0;
  }

  .welcome-message span {
    font-size: 13px !important;
  }

  #username-display {
    font-size: 16px !important;
  }

  .room-info {
    font-size: 10px;
    word-break: break-all;
    opacity: 0.7;
  }

  .top-bar-icons {
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 95%;
    max-width: none;
    overflow-x: auto;
  }

  .user-icon-container {
    width: 36px;
    height: 36px;
  }

  .user-icon-container i {
    font-size: 14px;
  }

  .user-counter {
    width: 14px;
    height: 14px;
    font-size: 8px;
    top: -4px;
    right: -6px;
  }

  .top-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .copy-btn {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  /* Mobile chat improvements */
  .chat-box {
    max-height: 100px;
    font-size: 14px;
  }

  .chat-input {
    padding: 12px 15px;
  }

  .chat-input input {
    font-size: 16px;
    padding: 12px 16px;
  }

  /* Username labels mobile optimization */
  .video-wrapper .username-label {
    font-size: 10px;
    padding: 3px 6px;
    bottom: 6px;
    left: 6px;
  }

  .video-wrapper.mini .username-label {
    font-size: 8px;
    padding: 2px 4px;
    bottom: 3px;
    left: 3px;
  }

  .video-wrapper.focused .username-label {
    font-size: 12px;
    padding: 4px 8px;
    bottom: 10px;
    left: 10px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px 8px;
    max-width: 99%;
    width: 99%;
  }

  /* Very small mobile optimizations - ALWAYS 2 COLUMNS MINIMUM AND 1:1 ASPECT RATIO */
  .video-grid {
    padding: 3px;
    height: calc(100vh - 130px);
  }

  .video-grid.grid-mode {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 3px;
    justify-content: center;
    justify-items: center;
  }

  .video-wrapper {
    min-height: 100px;
    max-height: 120px;
    aspect-ratio: 1/1 !important;
  }

  .video-grid.focus-mode .main-video-area {
    height: 55%;
    min-height: 180px;
  }

  .video-grid.focus-mode .mini-videos {
    height: 45%;
    padding: 3px 0;
    gap: 3px;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)) !important;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .video-wrapper.mini {
    width: 100%;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    aspect-ratio: 1/1 !important;
  }

  .video-wrapper.focused {
    width: 100% !important;
    aspect-ratio: 16/9 !important;
    height: auto !important;
    max-height: 60vh !important;
    }

  .controls {
    gap: 6px;
    padding: 6px 8px;
  }

  .control-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .settings-btn {
    width: 18px;
    height: 18px;
    font-size: 7px;
  }

  .top-bar {
    padding: 8px 12px;
  }

  .top-bar h2 {
    font-size: 14px;
  }

  .video-wrapper {
    border-radius: 6px;
  }

  .main {
    padding: 5px;
    padding-bottom: 120px;  }

  /* Settings dropdown for very small screens */
  .settings-dropdown {    min-width:280px;
    max-width: 90vw;
    bottom: 120px;
    max-height: 60vh;
  }
}

/* PWA specific styles */
@media (display-mode: standalone) {
  body {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .top-bar {
    padding-top: 20px;
  }
}

/* Background Selector Modal */
.background-selector-modal {
  position: fixed;
  top: 0;
  right: -100vw;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.background-selector-modal.open {
  right: 0;
}

.background-modal-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.background-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.8);
}

.background-modal-header h3 {
  margin: 0;
  font-size: 24px;
  color: white;
  font-weight: 600;
}

.close-modal-btn {
  width: 45px;
  height: 45px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  font-size: 24px;
  color: white;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.background-modal-body {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.background-category-filter {
  width: 100%;
  max-width: 300px;
  margin-bottom: 30px;
  text-align: center;
}

.background-category-filter label {
  display: block;
  color: white;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 10px;
}

.background-category-filter select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.background-category-filter select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

.background-category-filter option {
  background: #333;
  color: white;
  padding: 8px;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
  gap: 25px;
  max-width: 1200px;
  width: 100%;
  justify-content: center;
}

.background-category-header {
  grid-column: 1 / -1;
  margin: 10px 0 5px 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 3px solid #007bff;
}

.background-category-header:first-child {
  margin-top: 5px;
}

.background-option {
  position: relative;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 4px solid rgba(255, 255, 255, 0.2);
  aspect-ratio: 16/9;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.background-option:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 123, 255, 0.4);
  border-color: #007bff;
}

.background-option.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
  transform: scale(1.05);
}

.background-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.background-option.airtable-image {
    position: relative;
}

.background-option.airtable-image::after {
    content: 'DB';
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.background-option.error .error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.background-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16/9;
  transition: transform 0.3s ease;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 123, 255, 0.2));
}

.background-option img:not([src]) {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  position: relative;
}

.background-option img:not([src])::before {
  content: "Loading...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-size: 14px;
}

.background-option:hover img {
  transform: scale(1.05);
}

.no-background, .blur-background {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(248, 249, 250, 0.9), rgba(233, 236, 239, 0.9));
  color: #666;
  font-size: 16px;
  font-weight: 500;
  aspect-ratio: 16/9;
}

.blur-background {
  background: linear-gradient(135deg, rgba(227, 242, 253, 0.9), rgba(187, 222, 251, 0.9));
  color: #1976d2;
}

.no-background i, .blur-background i {
  font-size: 32px;
  margin-bottom: 12px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .background-modal-header {
    padding: 20px 25px;
  }

  .background-modal-header h3 {
    font-size: 20px;
  }

  .background-modal-body {
    padding: 25px 20px;
  }

  .background-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 250px));
    gap: 20px;
  }

  /* Always show background selector icon on mobile for local video */
  #local-video-wrapper .background-selector-icon {
    opacity: 1;
  }
}



/* QR Modal Styles */
.qr-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: all 0.3s ease;
}

.qr-modal.open {
  display: flex;
  opacity: 1;
  align-items: center;
  justify-content: center;
}

.qr-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  animation: modalZoomIn 0.3s ease forwards;
  overflow: hidden;
}

.qr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.qr-modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
  font-weight: 600;
}

.qr-modal-body {
  padding: 30px 25px;
  text-align: center;
}

.qr-code-container {
  margin-bottom: 20px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #e9ecef;
}

.qr-instructions {
  margin: 15px 0;
  color: #6c757d;
  font-size: 14px;
}

.qr-link-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  padding: 4px;
  margin-top: 15px;
}

.qr-link-container input {
  flex: 1;
  padding: 8px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #495057;
}

.copy-qr-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-qr-btn:hover {
  background: #0056b3;
}

/* Fullscreen Chat Overlay */
.fullscreen-chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10001;
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.fullscreen-chat-overlay.open {
  display: flex;
  opacity: 1;
}

.fullscreen-chat-container {
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  flex-direction: column;
  animation: slideInFromRight 0.3s ease;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.fullscreen-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.fullscreen-chat-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
  font-weight: 600;
}

.close-chat-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f8f9fa;
  color: #6c757d;
  cursor: pointer;
  border-radius: 50%;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-chat-btn:hover {
  background: #007bff;
  color: white;
  transform: scale(1.1);
}

.fullscreen-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fullscreen-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
}

.fullscreen-chat-messages div {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border-left: 4px solid #007bff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fullscreen-chat-input {
  padding: 20px 25px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.fullscreen-chat-input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  border-radius: 25px;
  border: 2px solid #e9ecef;
  padding: 8px;
  transition: border-color 0.2s ease;
}

.fullscreen-chat-input-container:focus-within {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.fullscreen-chat-input input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  outline: none;
  background: transparent;
  box-sizing: border-box;
}

.fullscreen-chat-input input::placeholder {
  color: #6c757d;
}

/* Mobile adjustments for fullscreen chat */
@media (max-width: 768px) {
  .fullscreen-chat-header {
    padding: 15px 20px;
  }

  .fullscreen-chat-header h3 {
    font-size: 18px;
  }

  .fullscreen-chat-messages {
    padding: 15px;
  }

  .fullscreen-chat-input {
    padding: 15px 20px;
  }

  .fullscreen-chat-input-container {
    gap: 8px;
    padding: 6px;
  }

  .fullscreen-chat-input input {
    font-size: 16px;
    padding: 10px 14px;
  }
}

/* Toggle buttons container positioned above controls container */
.toggle-buttons-container {
  position: fixed;
  bottom: 140px; /* Position above the controls container */
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
  z-index: 999;
  pointer-events: none;
}

/* Small toggle buttons - always visible */
.small-toggle-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(248, 249, 250, 0.95);
  color: #6c757d;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, 0.8);
  padding: 0;
}

.small-toggle-btn:hover {
  background: rgba(0, 123, 255, 0.9);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0, 123, 255, 0.3);
}

.small-toggle-btn.hidden-state {
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border-color: rgba(220, 53, 69, 0.5);
  font-size: 9px;
}

.small-toggle-btn.hidden-state:hover {
  background: rgba(200, 35, 51, 0.9);
  transform: scale(1.1);
}

/* Hidden states - separate controls */
.controls-container.hidden {
  display: none !important;
}

/* Hidden chat input and elements */
.chat-input.hidden {
  display: none !important;
}

.chat-box.hidden {
  display: none !important;
}

/* Adjust main padding when entire chat is hidden */
.main.chat-hidden {
  padding-bottom: 20px !important;
}

/* Mobile adjustments for QR modal */
@media (max-width: 768px) {
  .qr-modal-content {
    max-width: 95%;
  }

  .qr-modal-header {
    padding: 15px 20px;
  }

  .qr-modal-body {
    padding: 20px;
  }

  .qr-code-container {
    min-height: 180px;
  }
}

/* Touch improvements */
.control-btn, .copy-btn, .send-btn, .container button, .video-wrapper {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Prevent zoom on input focus */
input {
  font-size: 16px !important;
}

@media (max-width: 768px) {
  input {
    font-size: 18px !important;
  }
}

/* Landscape mode mobile optimizations */
@media (max-width: 896px) and (orientation: landscape) {
  .top-bar {
    padding: 8px 15px;
  }

  .top-bar h2 {
    font-size: 14px;
  }

  .video-grid {
    height: calc(100vh - 110px);
  }

  .video-grid.grid-mode {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 8px;
  }

  .video-grid.focus-mode {
    flex-direction: row;
    gap: 15px;
  }

  .video-grid.focus-mode .main-video-area {
    flex: 1;
    width: 70%;
    height: 100%;
  }

  .video-grid.focus-mode .mini-videos {
    width: 25%;
    height: 100%;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)) !important;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .video-wrapper.mini {
    width: 100%;
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    aspect-ratio: 1/1 !important;
  }

  .video-wrapper.focused {
   width: 100% !important;
    aspect-ratio: 16/9 !important;
    height: auto !important;
    max-height: 70vh !important;
  }

  .main {
    padding-bottom: 100px;
  }

  .controls {
    padding: 6px 12px;
  }

  .control-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    flex-shrink: 0;
  }
}

/* PWA and iOS Safari improvements */
@supports (-webkit-touch-callout: none) {
  .video-grid {
    height: calc(100vh - 160px);
  }

  .video-grid.focus-mode {
    height: calc(100vh - 160px);
  }

  @media (max-width: 768px) {
    .video-grid {
      height: calc(100vh - 140px);
    }

    .video-grid.focus-mode {
      height: calc(100vh - 140px);
    }
  }
}

/* Focus mode styles */
.video-grid.focus-mode {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.main-video-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  min-height: 0; /* Allow flex shrinking */
}

.main-video-area .video-wrapper.focused {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Regular focused videos maintain 16:9 aspect ratio */
.main-video-area .video-wrapper.focused:not(.screen-share) {
  aspect-ratio: 16/9;
  height: auto;
  max-height: 70vh;
}

/* Screen sharing videos in focus mode - maintain original aspect ratio */
.main-video-area .video-wrapper.focused.screen-share {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: auto !important;
  max-width: 100% !important;
  max-height: 80vh !important;
  min-height: 300px !important;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.main-video-area .video-wrapper.focused.screen-share video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important; /* Preserve aspect ratio, no cropping */
  display: block !important;
  background: #000;
}

.main-video-area .video-wrapper.focused.screen-share canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important; /* Preserve aspect ratio, no cropping */
  display: block !important;
  background: #000;
}

/* Ensure screen sharing videos are visible and clickable */
.video-wrapper.screen-share {
  position: relative;
  background: #000;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.video-wrapper.screen-share video,
.video-wrapper.screen-share canvas {
  position: relative !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}