* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a1a;
  color: #ffffff;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Main Container */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Remote Videos Container */
.remote-videos-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0f0f;
  position: relative;
  overflow: hidden;
}

.remote-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  grid-template-rows: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
  height: 100%;
  padding: 20px;
  align-items: center;
  justify-items: center;
}

.remote-videos-grid video {
  width: 100%;
  height: 100%;
  max-width: 600px;
  max-height: 400px;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
  border: 2px solid #333;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Local Video PiP - FIXED */
.local-video-pip {
  position: fixed;
  bottom: 100px;
  right: 370px; /* Account for chat panel */
  width: 200px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 3px solid #4CAF50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  z-index: 10;
}

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

.pip-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

/* Controls Bar */
.controls-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  background: rgba(30, 30, 30, 0.95);
  padding: 15px 25px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: #333;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 80px;
}

.control-btn:hover {
  background: #444;
  transform: translateY(-2px);
}

.control-btn.active {
  background: #4CAF50;
}

.control-btn.active:hover {
  background: #45a049;
}

.control-btn.muted {
  background: #f44336;
}

.control-btn.video-off {
  background: #ff9800;
}

.control-btn.leave-btn {
  background: #d32f2f;
}

.control-btn.leave-btn:hover {
  background: #b71c1c;
}

.control-btn .icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.control-btn .label {
  font-size: 12px;
  font-weight: 600;
}

/* Chat Panel - FIXED */
.chat-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 350px;
  height: 100vh;
  background: #1e1e1e;
  border-left: 1px solid #333;
  display: flex;
  flex-direction: column;
  z-index: 30;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.chat-panel.collapsed {
  transform: translateX(100%);
}

.chat-panel .chat-toggle {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  background: #2a2a2a;
  border: 1px solid #333;
  border-right: none;
  border-radius: 10px 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: #4CAF50;
  font-weight: bold;
  font-size: 14px;
}

.chat-panel.collapsed .chat-toggle {
  border-radius: 0 10px 10px 0;
  left: auto;
  right: -40px;
  border-left: none;
  border-right: 1px solid #333;
}

.chat-header {
  padding: 20px;
  background: #2a2a2a;
  border-bottom: 1px solid #333;
  position: relative;
}

.chat-header h3 {
  margin: 0 0 8px 0;
  color: #4CAF50;
  font-size: 18px;
}

.user-info {
  font-size: 12px;
  color: #999;
}

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

.chat-message {
  margin-bottom: 15px;
  padding: 12px;
  background: #2a2a2a;
  border-radius: 8px;
  border-left: 3px solid #4CAF50;
}

.chat-message.own {
  border-left-color: #2196F3;
  background: #1e2a3a;
}

.chat-message .sender {
  font-weight: bold;
  color: #4CAF50;
  margin-bottom: 4px;
  font-size: 14px;
}

.chat-message.own .sender {
  color: #2196F3;
}

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

.chat-message .time {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* Chat Input */
.chat-input-container {
  padding: 20px;
  background: #2a2a2a;
  border-top: 1px solid #333;
  display: flex;
  gap: 10px;
}

#chatInput {
  flex: 1;
  padding: 12px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #1a1a1a;
  color: white;
  font-size: 14px;
  outline: none;
}

#chatInput:focus {
  border-color: #4CAF50;
}

.send-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: #4CAF50;
  color: white;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}

.send-btn:hover {
  background: #45a049;
}

/* No videos placeholder */
.no-videos {
  color: #666;
  font-size: 18px;
  text-align: center;
  padding: 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 2px dashed #333;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-panel {
    width: 100%;
    height: 40vh;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid #333;
  }
  
  .chat-panel.collapsed {
    transform: translateY(100%);
  }
  
  .chat-panel .chat-toggle {
    left: 50%;
    top: -40px;
    transform: translateX(-50%);
    width: 120px;
    height: 40px;
    writing-mode: horizontal-tb;
    border-radius: 10px 10px 0 0;
    border: 1px solid #333;
    border-bottom: none;
  }
  
  .chat-panel.collapsed .chat-toggle {
    top: auto;
    bottom: -40px;
    border-radius: 0 0 10px 10px;
    border-top: 1px solid #333;
    border-bottom: none;
  }
  
  .main-container {
    height: 60vh;
  }
  
  .local-video-pip {
    width: 120px;
    height: 90px;
    bottom: 20px;
    right: 10px;
  }
  
  .controls-bar {
    bottom: 10px;
    padding: 10px 15px;
    gap: 10px;
  }
  
  .control-btn {
    padding: 8px 12px;
    min-width: 60px;
  }
  
  .control-btn .icon {
    font-size: 16px;
  }
  
  .control-btn .label {
    font-size: 10px;
  }
  
  .remote-videos-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
}

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

.chat-messages::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #555;
}