/* Google Meet Style Video Conference Interface */
:root {
  --primary-color: #1a73e8;
  --success-color: #34a853;
  --warning-color: #fbbc04;
  --error-color: #ea4335;
  --background-dark: #202124;
  --background-darker: #171717;
  --surface-color: #2d2e30;
  --text-primary: #ffffff;
  --text-secondary: #e8eaed;
  --text-muted: #9aa0a6;
  --border-color: #3c4043;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background-dark);
  color: var(--text-primary);
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--background-darker);
  border-bottom: 1px solid var(--border-color);
  height: 60px;
  flex-shrink: 0;
}

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

  .header-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
  }

.room-info {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface-color);
  padding: 6px 12px;
  border-radius: var(--border-radius);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Connection Quality Indicator */
.connection-indicator {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: var(--surface-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.signal-bar {
  width: 3px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: var(--transition);
}

.signal-bar.active {
  background: var(--text-primary);
}

.signal-bar:nth-child(1) {
  height: 8px;
}

.signal-bar:nth-child(2) {
  height: 10px;
}

.signal-bar:nth-child(3) {
  height: 12px;
}

/* Quality levels */
.connection-indicator.excellent .signal-bar {
  background: var(--text-primary);
}

.connection-indicator.good .signal-bar:nth-child(1),
.connection-indicator.good .signal-bar:nth-child(2) {
  background: var(--text-primary);
}

.connection-indicator.poor .signal-bar:nth-child(1) {
  background: var(--text-primary);
}

.connection-indicator.unknown .signal-bar {
  background: var(--text-muted);
}

.connection-indicator.offline .signal-bar {
  background: var(--error-color);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Notification styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  z-index: 10000;
  font-size: 14px;
  max-width: 300px;
  word-wrap: break-word;
  animation: slideIn 0.3s ease-out;
}

.notification-success {
  background: var(--success-color);
  color: white;
}

.notification-warning {
  background: var(--warning-color);
  color: #333;
}

.notification-error {
  background: var(--error-color);
  color: white;
}

.notification-info {
  background: var(--primary-color);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.name-input {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  font-size: 14px;
  min-width: 200px;
  transition: var(--transition);
  cursor: text;
}

.name-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
  background: var(--background-darker);
}

.name-input:hover:not(:focus) {
  border-color: var(--text-muted);
  background: var(--background-darker);
}

.name-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px - 80px); /* Header + Controls */
  overflow: hidden;
}

/* Participants Grid - Default Mode */
.participants-container {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  /* Center grid content vertically and horizontally when it doesn't fill container */
  justify-content: center;
  align-content: center;
}

/* Single participant - full screen */
.participants-container.single-participant {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  padding: 0;
  gap: 0;
}

/* Single participant fills the whole container */
.participants-container.single-participant .participant {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

/* Two participants - main + thumbnail */
.participants-container.two-participants {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  padding: 0;
  gap: 0;
  position: relative;
}

/* In two-participants layout, make the main (non-thumbnail) participant fill container */
.participants-container.two-participants .participant:not(.thumbnail) {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

/* Multiple participants - adaptive grid */
.participants-container.multiple-participants {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  grid-auto-rows: minmax(240px, auto);
  max-width: 100%;
  /* Center the grid block vertically when there is extra space */
  justify-content: center;
  align-content: center;
}

/* Screen sharing layout */
.participants-container.screen-sharing {
  display: flex;
  flex-direction: row;
  gap: 16px;
  height: calc(100vh - 120px);
  padding: 16px;
  box-sizing: border-box;
  align-items: stretch;
}

.screen-share-container {
  flex: 1;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
  border: 2px solid var(--success-color);
  min-height: 0;
}

.participants-list {
  width: 20%;
  min-width: 200px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100vh - 120px - 32px); /* Полная высота минус header/controls и padding */
  overflow-y: auto;
  padding: 8px;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  box-sizing: border-box;
}

.screen-share-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen-share-info {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(52, 168, 83, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.participants-list .participant {
  min-height: 120px;
  aspect-ratio: 16/9;
  flex-shrink: 0;
  position: relative;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* Thumbnail for two participants */
.participant.thumbnail {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 200px;
  height: 112px; /* 16:9 aspect ratio */
  z-index: 10;
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.participant.thumbnail .participant-info {
  font-size: 10px;
  padding: 4px 6px;
}

.participant.thumbnail .participant-name {
  font-size: 10px;
}

.participant.thumbnail .participant-status {
  font-size: 8px;
}

/* Screen Share Mode Layout */
.participants-container.screen-share-mode {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  height: 100%;
}

/* Screen Share Container */
.screen-share {
  flex: 1;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 2px solid var(--success-color);
  position: relative;
  min-height: 0; /* Важно для flex */
}

.screen-share video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--background-darker);
  border-radius: var(--border-radius);
}

.screen-share-info {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(52, 168, 83, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  z-index: 10;
}


/* Participant Card */
.participant {
  position: relative;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  min-height: 200px;
  transition: var(--transition);
  border: 2px solid transparent;
}

.participant:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.participant.speaking {
  border-color: var(--success-color);
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.3);
}

.participant.local {
  border-color: var(--primary-color);
}

/* Video Elements */
.participant video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Заполняет блок, сохраняя пропорции */
  background: var(--background-darker);
  border-radius: var(--border-radius);
  transform: scaleX(-1); /* Зеркальное отражение для локального видео */
}

/* Participant Placeholder (when no video) */
.participant-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--background-darker);
  border-radius: var(--border-radius);
  color: var(--text-primary);
}

.participant-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 12px;
  color: white;
}

.participant-name-large {
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  color: var(--text-primary);
}

/* Participant Info Overlay */
.participant-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  display: inline-flex; /* Shrink to content width */
  align-items: center;
}

.participant-name {
  font-weight: 500;
  color: var(--text-primary);
}

/* Removed legacy participant-status text block */

.status-icon {
  font-size: 12px;
}

.status-muted {
  color: var(--error-color);
}

.status-camera-off {
  color: var(--warning-color);
}

.status-speaking {
  color: var(--success-color);
}

/* Controls Bar */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--background-darker);
  border-top: 1px solid var(--border-color);
  height: 80px;
  flex-shrink: 0;
}

.control-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  min-width: 48px;
  height: 48px;
}

.control-button:hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-button.active {
  background: var(--primary-color);
  color: white;
}

.control-button.danger {
  background: var(--error-color);
  color: white;
}

.control-button.danger:hover:not(:disabled) {
  background: #d33b2c;
  transform: scale(1.05);
}

/* Control Groups */
.control-group {
  position: relative;
  display: flex;
  align-items: center;
}

/* Screen Share Button - Google Meet Style */
.control-group:has(#shareBtn) {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 0;
  transition: var(--transition);
}

.control-group:has(#shareBtn):hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.control-group:has(#shareBtn):disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-group:has(#shareBtn) .control-button {
  background: transparent;
  border: none;
  border-radius: 50px;
  padding: 12px;
  min-width: 48px;
  height: 48px;
  color: var(--text-primary);
  transition: var(--transition);
}

.control-group:has(#shareBtn) .control-button:hover:not(:disabled) {
  background: transparent;
  transform: none;
  box-shadow: none;
}

.control-group:has(#shareBtn) .control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Screen Share Button States */
.control-group:has(#shareBtn).sharing {
  background: #87CEEB; /* Light blue background when sharing */
  border-color: #87CEEB;
}

.control-group:has(#shareBtn).sharing .control-button {
  color: white;
}

.control-group:has(#shareBtn).sharing .status-icon {
  position: relative;
}

/* Tooltip for screen share button when sharing */
.control-group:has(#shareBtn).sharing .control-button::after {
  content: 'Ваш экран виден другим участникам. Нажмите кнопку для остановки показа';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.control-group:has(#shareBtn).sharing .control-button:hover::after {
  opacity: 1;
}

/* Control Button Group - Google Meet Style */
.control-button-group {
  display: flex;
  align-items: center;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  overflow: hidden;
  transition: var(--transition);
}

.control-button-group:hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.control-button-group:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Control Buttons - Google Meet Style */
.control-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  min-width: 48px;
  height: 48px;
  position: relative;
}

/* Dropdown Button */
.dropdown-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 12px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
  width: 32px;
  height: 48px;
  border-left: 1px solid var(--border-color);
}

.dropdown-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.dropdown-button.active .dropdown-arrow {
  transform: rotate(180deg);
}

.control-button:hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* End Call Button */
.control-button.end-call {
  background: #dc3545;
  color: white;
}

.control-button.end-call:hover:not(:disabled) {
  background: #c82333;
  color: white;
}

.control-button.end-call .status-icon {
  color: white;
}

/* Button States - Google Meet Style */
.control-button-group.muted {
  background: #ea4335;
  border-color: #ea4335;
}

.control-button-group.muted .control-button {
  color: white;
}

.control-button-group.muted .dropdown-button {
  color: white;
  border-left-color: rgba(255, 255, 255, 0.3);
}

/* Removed pseudo overlay for muted icons; now using dedicated -off SVGs */

.control-button-group.enabled {
  background: var(--surface-color);
  border-color: var(--border-color);
}

.control-button-group.enabled .control-button {
  color: var(--text-primary);
}

.control-button-group.enabled .dropdown-button {
  color: var(--text-primary);
  border-left-color: var(--border-color);
}

/* Device Dropdown - Google Meet Style */
.device-dropdown {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  z-index: 1000;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  max-width: 300px;
  display: none;
}

.device-dropdown.show {
  display: block !important;
}

.device-list {
  padding: 8px 0;
}

.device-header {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.device-options {
  max-height: 200px;
  overflow-y: auto;
}

.device-option {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 14px;
  color: var(--text-primary);
}

.device-option:hover {
  background: var(--background-hover);
}

.device-option.selected {
  background: var(--primary-color);
  color: white;
}

.device-option .device-icon {
  margin-right: 12px;
  font-size: 16px;
}

.device-option .device-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Quality dropdown specific styles */
.device-option[data-quality="auto"].selected {
  background: var(--primary-color);
  color: white;
}

.device-option[data-quality="auto"].selected .device-name {
  font-weight: 600;
}

/* Quality indicator for auto mode */
.quality-indicator {
  color: #888;
  font-size: 12px;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.device-option:hover .quality-indicator {
  opacity: 1;
}


/* Join Button */
.join-button {
  background: var(--primary-color);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-width: 120px;
}

.join-button:hover:not(:disabled) {
  background: #1557b0;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.join-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
  .participants-container {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
  }
  
  .participant {
    min-height: 150px;
  }
  
  .header {
    padding: 8px 12px;
    height: 50px;
  }
  
  .header-title {
    font-size: 16px;
  }
  
  .name-input {
    min-width: 150px;
    font-size: 13px;
  }
  
  .controls-bar {
    padding: 12px;
    height: 70px;
  }
  
  .control-button {
    padding: 10px 12px;
    font-size: 12px;
    min-width: 40px;
    height: 40px;
  }
  
  .main-content {
    height: calc(100vh - 50px - 70px);
  }
  
  .participants-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-height: 150px;
  }
  
  .participants-list .participant {
    min-height: 100px;
  }
}

@media (max-width: 480px) {
  .participants-container {
    padding: 4px;
    gap: 4px;
  }
  
  .participant {
    min-height: 120px;
  }
  
  .participant-info {
    padding: 6px 8px;
    font-size: 11px;
  }
  
  .controls-bar {
    gap: 8px;
    padding: 8px;
  }
  
  .control-button {
    padding: 8px 10px;
    font-size: 11px;
    min-width: 36px;
    height: 36px;
  }
  
  .participants-list {
    grid-template-columns: 1fr;
    max-height: 120px;
  }
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.participant {
  animation: fadeIn 0.3s ease;
}

/* Focus States for Accessibility */
.control-button:focus {
  outline: none;
}

.control-button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.dropdown-button:focus {
  outline: none;
}

.dropdown-button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.join-button:focus,
.name-input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Device Note */
.device-note {
  padding: 8px 12px;
  background: rgba(255, 193, 7, 0.1);
  border-top: 1px solid rgba(255, 193, 7, 0.3);
  color: #ffc107;
  font-size: 11px;
  line-height: 1.4;
}

/* Test Sound Container */
.test-sound-container {
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
}

.test-sound-btn {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.test-sound-btn:hover:not(:disabled) {
  background: #1976d2;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.test-sound-btn:disabled {
  background: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.test-sound-btn:active {
  transform: translateY(0);
}

/* Custom Scrollbar for Participants List */
.participants-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.participants-list::-webkit-scrollbar-track {
  background: var(--background-darker);
  border-radius: 3px;
}

.participants-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.participants-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
.participants-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--background-darker);
}

/* Start Screen */
.start-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.start-screen-content {
  background: var(--background-darker);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.start-screen-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.start-screen-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 32px 0;
}

.start-screen-form {
  text-align: left;
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 16px;
  transition: var(--transition);
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.device-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.device-control {
  flex: 1;
}

.device-button {
  width: 100%;
  padding: 8px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--surface-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.device-button:hover {
  border-color: var(--primary-color);
  background: var(--background-darker);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.device-button.active {
  border-color: var(--success-color);
  background: rgba(52, 168, 83, 0.1);
  color: var(--success-color);
}

.device-button.inactive {
  border-color: var(--error-color);
  background: rgba(234, 67, 53, 0.1);
  color: var(--error-color);
}

.device-icon {
  font-size: 24px;
}

.device-text {
  font-size: 12px;
  font-weight: 500;
}

.join-meeting-btn {
  width: 100%;
  padding: 16px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.join-meeting-btn:hover:not(:disabled) {
  background: #1557b0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.join-meeting-btn:disabled {
  background: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  font-size: 18px;
}

/* Participant Status Icons - Top Right Corner */
.participant-status-icons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.participant-status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: var(--transition);
}

.participant-status-icon.mic-muted {
  background: rgba(234, 67, 53, 0.9);
  color: white;
}

.participant-status-icon.cam-off {
  background: rgba(255, 193, 7, 0.9);
  color: #000;
}

.participant-status-icon.active {
  background: rgba(52, 168, 83, 0.9);
  color: white;
}

/* End Call Screen */
.end-call-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.end-call-content {
  background: var(--background-darker);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.end-call-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.end-call-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.end-call-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 32px 0;
  line-height: 1.5;
}

.end-call-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.return-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  min-width: 180px;
  justify-content: center;
}

.return-btn:hover {
  background: #1a73e8;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.return-btn .btn-icon {
  font-size: 18px;
}

/* ==================== CHAT STYLES ==================== */

/* Chat Sidebar */
.chat-sidebar {
  position: fixed;
  top: 0;
  left: -20%;
  width: 20%;
  height: 100vh;
  background: #2b2d31;
  border-right: 1px solid #404249;
  display: flex;
  flex-direction: column;
  transition: left 0.3s ease;
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.chat-sidebar.open {
  left: 0;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #404249;
  background: #36393f;
}

.chat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #ffffff;
}

.close-chat-btn {
  background: none;
  border: none;
  color: #b9bbbe;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.close-chat-btn:hover {
  background: #404249;
  color: #ffffff;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #2b2d31;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: #404249;
  border-radius: 8px;
  max-width: 85%;
  word-wrap: break-word;
}

.chat-message.own-message {
  background: #5865f2;
  align-self: flex-end;
  margin-left: auto;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #b9bbbe;
}

.chat-message.own-message .chat-message-header {
  color: rgba(255, 255, 255, 0.8);
}

.chat-message-sender {
  font-weight: 600;
  color: #ffffff;
}

.chat-message.own-message .chat-message-sender {
  color: white;
}

.chat-message-time {
  font-size: 11px;
  opacity: 0.7;
}

.chat-message-content {
  color: #ffffff;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 14px;
}

.chat-message.own-message .chat-message-content {
  color: white;
}

/* Chat Links */
.chat-message-content a {
  color: #00b0f4;
  text-decoration: underline;
  word-break: break-all;
}

.chat-message.own-message .chat-message-content a {
  color: #87ceeb;
}

.chat-message-content a:hover {
  color: #00d4ff;
}

/* File Messages */
.chat-file-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #36393f;
  border-radius: 8px;
  border: 1px solid #404249;
  cursor: pointer;
  transition: var(--transition);
}

.chat-file-message:hover {
  background: #404249;
  border-color: #5865f2;
}

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

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

.chat-file-name {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Chat Input */
.chat-input-container {
  padding: 16px;
  border-top: 1px solid #404249;
  background: #36393f;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 12px;
  background: #404249;
  border: 1px solid #404249;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  transition: var(--transition);
}

.chat-input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.chat-input::placeholder {
  color: #b9bbbe;
}

.send-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: #5865f2;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.send-chat-btn:hover {
  background: #4752c4;
}

.send-chat-btn:disabled {
  background: #b9bbbe;
  cursor: not-allowed;
}

/* File Upload */
.chat-file-upload { display: none; }

.chat-file-input {
  display: none;
}

.attach-file-btn {
  padding: 10px 12px;
  background: #404249;
  border: 1px solid #404249;
  border-radius: 8px;
  color: #b9bbbe;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.attach-file-btn:hover {
  background: #36393f;
  color: #ffffff;
  border-color: #5865f2;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 100%;
    left: -100%;
  }
  
  .chat-sidebar.open {
    left: 0;
  }
}

/* Chat Animation */
@keyframes slideInMessage {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message {
  animation: slideInMessage 0.3s ease;
}

/* Drag & Drop overlay */
.chat-drop-hint {
  position: absolute;
  inset: 60px 0 80px 0; /* below header, above input */
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed #5865f2;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  pointer-events: none;
}

.chat-drop-hint-content { text-align: center; opacity: 0.95; }
.chat-drop-icon { font-size: 28px; margin-bottom: 8px; }
.chat-drop-text { font-size: 14px; color: #e8eaed; }

.chat-sidebar.drag-over .chat-drop-hint { display: flex; }

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--background-dark);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Chat Notification Indicator */
.chat-notification {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #ed4245;
  font-size: 12px;
  font-weight: bold;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Control button with notification */
.control-group {
  position: relative;
}

.control-button.active {
  background: #5865f2;
}