/* Volume indicator styles */
.ai-volume-indicator {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-avatar {
  position: relative;
  width: 375px;
  height: 375px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0px 0px 20px rgba(0, 255, 255, 0.5);
}

.ai-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(45deg, #1a1a1a, #2a2a2a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: cyan;
  font-size: 12px;
}

.avatar-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(45deg, #1a1a1a, #2a2a2a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: cyan;
  font-size: 12px;
}

.volume-ring {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 375px;
  height: 375px;
  border-radius: 50%;
  border: 4px solid rgba(0, 255, 255, 0.3);
  box-shadow: 0px 0px 20px rgba(0, 255, 255, 0.8);
  transition: transform 0.1s;
}

.ai-volume-indicator canvas {
  width: 375px;
  height: 50px;
  margin-top: 16px;
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.3), rgba(0, 255, 255, 0.8), rgba(0, 255, 255, 0.3));
  box-shadow: 0px 0px 15px rgba(0, 255, 255, 0.6);
  border-radius: 8px;
  display: block;
}

/* Main AI interaction widget */
#aiVolumeWidget.main-ai-widget {
  position: static;
  background: #111;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
  display: block; /* always visible */
  margin: 2rem 0;
  width: 100%;
  max-width: none;
  min-width: auto;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
}

/* Floating widget in the top‐right (for backward compatibility) */
#aiVolumeWidget:not(.main-ai-widget) {
  position: fixed;
  top: 6.5rem;
  right: 1rem;
  background: #111;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
  display: none; /* hidden by default */
  z-index: 20000; /* Increased from 9999 to be above settings buttons */
  min-width: 400px;
  max-width: 600px;
  width: 600px;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  /* Ensure proper width constraints */
  width: min(600px, calc(100vw - 2rem)) !important;
}

#aiVolumeWidget h2 {
  margin-bottom: 0.5rem;
  text-align: center;
  color: cyan;
}

/* Message input area styles */
.message-input-area {
  background: #1f2937;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
}

.message-input-area input[type="text"] {
  background: #374151;
  border: 1px solid #4b5563;
  color: white;
  transition: border-color 0.2s;
}

.message-input-area input[type="text"]:focus {
  border-color: #60a5fa;
  outline: none;
}

.message-input-area button {
  transition: background-color 0.2s;
}

.message-input-area button:hover {
  background-color: #4b5563;
}

/* Microphone button styles */
#toggleMicBtn {
  transition: all 0.2s;
}

#toggleMicBtn.muted {
  background-color: #ef4444;
}

#toggleMicBtn.muted:hover {
  background-color: #dc2626;
}

#toggleMicBtn:hover {
  background-color: #4b5563;
}

/* Camera button styles */
#toggleCameraBtn {
  transition: all 0.2s;
}

#toggleCameraBtn.muted {
  background-color: #ef4444;
}

#toggleCameraBtn.muted:hover {
  background-color: #dc2626;
}

#toggleCameraBtn:hover {
  background-color: #4b5563;
}

/* Mic and Camera icon styles */
.mic-icon, .mic-off-icon, .camera-icon, .camera-off-icon {
  transition: opacity 0.2s;
}

/* Toggle button in the top‐right corner (hidden for main layout) */
#toggleVolumeBtn {
  display: none;
}

/* GitHub link */
.github-link {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: background-color 0.2s;
}

.github-link:hover {
  background: #374151;
}

.github-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}

/* Custom tooltip styling */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
  --tooltip-color: rgba(26, 32, 44, 0.95);
  opacity: 0;
  visibility: hidden;
  position: absolute;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 10000;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  padding: 8px 12px;
  background-color: var(--tooltip-color);
  color: white;
  border-radius: 4px;
  font-size: 14px;
  white-space: normal;
  min-width: 200px;
  max-width: 300px;
  width: max-content;
  text-align: left;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-bottom: 5px;
}

[data-tooltip]::after {
  content: '';
  bottom: calc(100% - 5px);
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  border-width: 5px;
  border-style: solid;
  border-color: var(--tooltip-color) transparent transparent transparent;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Drawer styles - improved for placement and color */
.drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 340px;
  max-width: 90vw;
  width: auto;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  border-radius: 0.5rem;
  z-index: 20002;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border: 1px solid #374151;
  transition: opacity 0.2s;
  opacity: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  max-height: 90vh;
  /* Ensure proper centering */
  margin: 0;
  /* Prevent any positioning conflicts */
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

/* Modal-specific drawer styles */
#agentSettingsModal .drawer {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin-left: 0;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 20003;
  background: #374151;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  /* Ensure proper centering within modal */
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

.drawer.hidden {
  display: none;
  opacity: 0;
}

.drawer-header {
  border-bottom: 1px solid #374151;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

.drawer-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 20004;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  z-index: 10999;
  /* Ensure backdrop covers entire viewport */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* Modal-specific drawer backdrop */
#agentSettingsModal .drawer-backdrop {
  z-index: 20002;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.5);
}

.drawer-backdrop.hidden {
  display: none;
}

.drawer-content {
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
  z-index: 20003;
  /* Ensure proper scrolling */
  padding-right: 0.5rem;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
  word-wrap: break-word;
}

.drawer-scroll {
  overflow-y: auto;
  max-height: 70vh;
}

/* All tooltips are now handled by the portal system, so hide the regular tooltips */
.tooltip {
  display: none !important;
}

/* Disable hover effects for regular tooltips */
.has-tooltip:hover .tooltip {
  display: none !important;
}

/* Ensure the parent of the button is relative for absolute drawer placement */
.drawer-btn {
  position: relative;
  z-index: 11100;
}

select, .drawer select {
  background-color: #1f2937 !important; /* bg-gray-800 */
  color: #fff !important;
  border: 1px solid #6b7280 !important; /* border-gray-500 */
  border-radius: 0.375rem !important; /* rounded */
  padding: 0.5rem !important;
  font-size: 1rem;
  outline: none !important;
  box-shadow: none !important;
}

select:focus, .drawer select:focus {
  border-color: #3b82f6 !important; /* focus:border-blue-500 */
}

/* Tooltip styles for both main page and drawers */
.has-tooltip {
  position: relative;
}

/* All tooltips are now handled by the portal system */
.tooltip {
  display: none !important;
}

.has-tooltip:hover .tooltip {
  display: none !important;
}

/* Drawer-specific tooltips */
.drawer-has-tooltip .drawer-tooltip {
  z-index: 22000;
}

/* All tooltips are now handled by the portal system - no additional styles needed */

.modal {
  position: fixed;
  /* Prevent text selection and dragging from closing modals */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Allow text selection within modal content areas */
.modal pre,
.modal input,
.modal textarea,
.modal select {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* Prevent modal from closing when dragging text */
.modal * {
  pointer-events: auto;
}

/* Ensure modal backdrop doesn't interfere with content */
.modal > div {
  pointer-events: auto;
}

/* JSON Modal specific styles for proper scrolling */
#jsonDisplayModal .flex-1 {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#jsonDisplayModal pre {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: auto;
}

/* Ensure the modal container has proper height constraints */
#jsonDisplayModal .bg-gray-800 {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* JSON content scrolling styles */
#jsonModalContent {
  scrollbar-width: thin;
  scrollbar-color: #4B5563 #1F2937;
}

#jsonModalContent::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#jsonModalContent::-webkit-scrollbar-track {
  background: #1F2937;
  border-radius: 4px;
}

#jsonModalContent::-webkit-scrollbar-thumb {
  background: #4B5563;
  border-radius: 4px;
}

#jsonModalContent::-webkit-scrollbar-thumb:hover {
  background: #6B7280;
}

#jsonModalContent::-webkit-scrollbar-corner {
  background: #1F2937;
}

.tooltip-right {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 12px;
  max-width: 300px;
  z-index: 9999;
  white-space: normal;
  background: #222;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Subtitle Overlay Styles */
#subtitleOverlay {
  transition: opacity 0.3s ease;
}

#subtitleOverlay.visible {
  opacity: 1;
}

#subtitleOverlay.hidden {
  opacity: 0;
}

#subtitleText {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 90vw;
    overflow-wrap: break-word;
    hyphens: auto;
}

#subtitleSpeaker {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Chat History Styles */
#chatHistory {
  scrollbar-width: thin;
  scrollbar-color: #4B5563 #1F2937;
  /* Aggressive width constraints to prevent horizontal overflow */
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  /* Ensure text wraps properly */
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  /* Prevent flex expansion */
  flex-shrink: 1;
  box-sizing: border-box;
  /* Remove any default spacing */
  padding: 2px !important;
  margin: 0 !important;
  line-height: 1 !important;
  /* Ensure content doesn't overflow horizontally */
  max-width: calc(100% - 4px) !important;
}

#chatHistory::-webkit-scrollbar {
  width: 6px;
}

#chatHistory::-webkit-scrollbar-track {
  background: #1F2937;
  border-radius: 3px;
}

#chatHistory::-webkit-scrollbar-thumb {
  background: #4B5563;
  border-radius: 3px;
}

#chatHistory::-webkit-scrollbar-thumb:hover {
  background: #6B7280;
}

/* Chat Message Styles */
.chat-message {
  margin-bottom: 5px !important;
  padding: 8px 8px 5px 5px !important;
  border-radius: 3px !important;
  background: #374151;
  border-left: 3px solid #6B7280;
  /* Ensure messages don't overflow horizontally */
  width: 100%;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Allow content to wrap instead of hiding it */
  overflow: visible;
  /* Remove any default margins/padding */
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  /* Ensure proper spacing for timestamp */
  padding-bottom: 12px !important;
}

.chat-message.agent {
  background: #1E3A8A;
  border-left-color: #3B82F6;
  margin-right: 8px !important;
  margin-left: 0 !important;
}

.chat-message.user {
  background: #166534;
  border-left-color: #22C55E;
  margin-left: 8px !important;
  margin-right: 0 !important;
  width: calc(100% - 8px);
}

.chat-message .speaker {
  font-weight: bold;
  font-size: 0.8rem !important;
  color: #E5E7EB;
  margin-bottom: 0px !important;
  margin-top: 0px !important;
  line-height: 1.1 !important;
  padding: 0 !important;
}

.chat-message .text {
  color: #F3F4F6;
  font-size: 0.85rem !important;
  line-height: 1.2 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100% !important;
  min-width: 0 !important;
  white-space: pre-wrap;
  hyphens: auto;
  /* Allow text to wrap naturally */
  overflow: visible;
  display: block;
  /* Use normal word breaking instead of aggressive break-all */
  word-break: normal;
  margin-bottom: 0px !important;
  margin-top: 0px !important;
  padding: 0 !important;
}

/* Constrain the chat history container parent */
#aiVolumeWidget .w-full {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden;
  box-sizing: border-box;
}

.chat-message .timestamp {
  font-size: 0.65rem !important;
  color: #9CA3AF;
  margin-top: 2px !important;
  margin-bottom: 0px !important;
  text-align: right;
  line-height: 1 !important;
  padding: 0 !important;
  /* Ensure timestamp is always visible */
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Temporary message styling */
.chat-message.temp {
  opacity: 0.7;
  border-left-style: dashed;
}

.chat-message.temp .timestamp {
  font-style: italic;
  color: #6B7280;
}

/* Image message styling */
.chat-message.image-message {
  border-left-color: #F59E0B;
  background: linear-gradient(135deg, #374151 0%, #4B5563 100%);
}

.chat-message.image-message .text {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem !important;
  color: #FCD34D;
}

.chat-message.image-message.error .text {
  color: #F87171;
}

.chat-message.image-message.success .text {
  color: #34D399;
}

/* Subtitle Animation */
@keyframes subtitleFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subtitle-animation {
  animation: subtitleFadeIn 0.3s ease-out;
}

/* Signaling Requirements Modal */
#signalingRequirementsModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

#signalingRequirementsModal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.signaling-modal-content {
  background: #1f2937;
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid #374151;
  position: relative;
}

.signaling-modal-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #374151;
}

.signaling-modal-icon {
  width: 2rem;
  height: 2rem;
  color: #f59e0b;
  margin-right: 1rem;
  flex-shrink: 0;
}

.signaling-modal-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #f9fafb;
  margin: 0;
}

.signaling-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.signaling-modal-close:hover {
  color: #f9fafb;
}

.signaling-modal-body {
  color: #d1d5db;
  line-height: 1.6;
}

.signaling-modal-section {
  margin-bottom: 1.5rem;
}

.signaling-modal-section h3 {
  color: #f9fafb;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.signaling-modal-section p {
  margin-bottom: 0.75rem;
}

.signaling-modal-requirements {
  background: #374151;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid #f59e0b;
}

.signaling-modal-requirements h4 {
  color: #f9fafb;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.signaling-modal-requirements ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0;
}

.signaling-modal-requirements li {
  margin-bottom: 0.5rem;
  color: #d1d5db;
}

.signaling-modal-requirements strong {
  color: #f9fafb;
}

.signaling-modal-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #374151;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.signaling-modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.9rem;
}

.signaling-modal-btn-primary {
  background: #3b82f6;
  color: white;
}

.signaling-modal-btn-primary:hover {
  background: #2563eb;
}

.signaling-modal-btn-secondary {
  background: #6b7280;
  color: white;
}

.signaling-modal-btn-secondary:hover {
  background: #4b5563;
}

.signaling-modal-btn-success {
  background: #059669;
  color: white;
}

.signaling-modal-btn-success:hover {
  background: #047857;
}

.signaling-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.signaling-modal-note {
  background: #1e3a8a;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid #3b82f6;
}

.signaling-modal-note h4 {
  color: #93c5fd;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.signaling-modal-note p {
  color: #dbeafe;
  margin: 0;
}



/* Ensure drawer content doesn't overflow */
.drawer-content {
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
  z-index: 20003;
  /* Ensure proper scrolling */
  padding-right: 0.5rem;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
  word-wrap: break-word;
}

/* Ensure all form elements in drawers are properly styled */
.drawer input:not([type="checkbox"]),
.drawer select,
.drawer textarea {
  background-color: rgba(30, 41, 59, 0.6) !important;
  color: #fff !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  border-radius: 0.625rem !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem;
  outline: none !important;
  box-shadow: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  backdrop-filter: blur(10px);
}

.drawer input:focus,
.drawer select:focus,
.drawer textarea:focus {
  border-color: rgba(6, 182, 212, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1) !important;
  background: rgba(30, 41, 59, 0.8) !important;
}

.drawer label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #e5e7eb;
}

/* Simple checkbox alignment fix */
.drawer label.flex,
.drawer .flex.items-center {
  display: flex !important;
  align-items: center !important;
}

.drawer input[type="checkbox"] {
  flex: none;
  margin-right: 0.5rem;
}

/* Disabled radio button styling */
input[type="radio"]:disabled + span {
  opacity: 0.5;
  color: #6b7280;
  cursor: not-allowed;
}

input[type="radio"]:disabled {
  cursor: not-allowed;
}

/* Disabled checkbox styling */
input[type="checkbox"]:disabled + span {
  opacity: 0.5;
  color: #6b7280;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

/* Force two-column layout for debugging */
.grid.grid-cols-1.lg\\:grid-cols-2,
div[class*="grid grid-cols-1 lg:grid-cols-2"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
}

/* Alternative: target by structure */
.grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
}

/* Force right section to be in second column */
.grid > div:nth-child(2) {
  grid-column: 2 !important;
}







.drawer .space-y-4 > div {
  margin-bottom: 1rem;
}

.drawer .space-y-4 > div:last-child {
  margin-bottom: 0;
}

/* Camera Preview Overlay - Clean Implementation */
#cameraPreviewOverlay {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 40;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  
  /* Default size - 16:9 aspect ratio */
  width: 320px;
  height: 180px;
  
  /* Size constraints */
  min-width: 160px;
  min-height: 90px;
  max-width: 640px;
  max-height: 360px;
  
  /* Smooth transitions */
  transition: width 0.1s ease, height 0.1s ease, opacity 0.3s ease;
}

#cameraPreviewOverlay.dragging {
  transition: none;
  opacity: 0.8;
}

#cameraPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
  border: 2px solid rgba(0, 255, 255, 0.3);
  transition: border-color 0.3s ease;
}

#cameraPreview:hover {
  border-color: rgba(0, 255, 255, 0.6);
}

/* Drag Handle */
#cameraPreviewDragHandle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: rgba(107, 114, 128, 0.5);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
  border-radius: 8px 8px 0 0;
}

#cameraPreviewOverlay:hover #cameraPreviewDragHandle {
  opacity: 1;
}

#cameraPreviewDragHandle:active {
  cursor: grabbing;
}

/* Resize Handle */
#cameraPreviewResizeHandle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
  background: rgba(107, 114, 128, 0.5);
  border-radius: 0 0 8px 0;
}

#cameraPreviewOverlay:hover #cameraPreviewResizeHandle {
  opacity: 1;
}

/* Close Button */
#closeCameraPreview {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s ease;
  pointer-events: auto;
  z-index: 20;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

#closeCameraPreview:hover {
  background: #b91c1c;
  transform: scale(1.1);
}

/* Muted Indicator */
.muted-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  z-index: 5;
  border-radius: 8px;
}

/* Reopen Button */
#cameraPreviewReopenBtn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 40;
  transition: all 0.2s ease;
}

#cameraPreviewReopenBtn button {
  width: 40px;
  height: 40px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

#cameraPreviewReopenBtn button:hover {
  background: #1d4ed8;
  transform: scale(1.1);
}

#cameraPreviewReopenBtn svg {
  width: 20px;
  height: 20px;
}

/* Camera button styles */