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

:root {
  --primary-color: #0b8cff;
  --dark-bg: #1a1a1a;
  --darker-bg: #0f0f0f;
  --card-bg: #2a2a2a;
  --border-color: #404040;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --success: #31a24c;
  --danger: #e74c3c;
  --warning: #f39c12;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: var(--darker-bg);
  color: var(--text-primary);
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--dark-bg);
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.meeting-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meeting-title h1 {
  font-size: 20px;
  font-weight: 600;
}

.room-badge {
  background: rgba(11, 140, 255, 0.15);
  color: var(--primary-color);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(11, 140, 255, 0.3);
}

.top-controls {
  display: flex;
  gap: 12px;
}

.room-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.room-input {
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.room-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(11, 140, 255, 0.05);
}

.room-input::placeholder {
  color: var(--text-secondary);
}

/* Main Area */
.main-area {
  display: flex;
  flex: 1;
  gap: 0;
  overflow: hidden;
}

/* Videos Section */
.videos-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.video-grid::-webkit-scrollbar {
  width: 6px;
}

.video-grid::-webkit-scrollbar-track {
  background: transparent;
}

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

.video-grid::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.remote-video-wrapper {
  position: relative;
  background: var(--darker-bg);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.remote-video-wrapper:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 24px rgba(11, 140, 255, 0.2);
}

.remote-video-wrapper.active-speaker {
  border: 2px solid var(--primary-color);
  box-shadow: 0 8px 32px rgba(11, 140, 255, 0.3);
}

.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--darker-bg);
}

/* Local Video */
.local-video-wrapper {
  position: relative;
  background: var(--darker-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 16px rgba(11, 140, 255, 0.2);
  aspect-ratio: 16 / 9;
  min-height: 180px;
}

.local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--darker-bg);
}

.video-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
  width: 300px;
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* Chat */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

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

.chat-message {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 12px;
  word-wrap: break-word;
}

.chat-message-user {
  font-weight: 600;
  color: var(--primary-color);
}

.chat-message-text {
  color: var(--text-primary);
  margin-left: 6px;
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--darker-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(11, 140, 255, 0.05);
}

.chat-input::placeholder {
  color: var(--text-secondary);
}

/* Participants */
.participants-info {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.user-count {
  color: var(--primary-color);
  font-weight: 600;
}

.users-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.users-list li {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.users-list li::before {
  content: "🟢";
  font-size: 8px;
}

/* Recordings Section */
.recordings-section {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  max-height: 150px;
  overflow-y: auto;
  font-size: 11px;
}

.recordings-section a {
  display: block;
  padding: 6px 8px;
  background: rgba(11, 140, 255, 0.1);
  color: var(--primary-color);
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 4px;
  text-align: center;
  transition: all 0.2s ease;
  word-break: break-all;
}

.recordings-section a:hover {
  background: rgba(11, 140, 255, 0.2);
}

/* Bottom Control Bar */
.bottom-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.6);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.control-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-group.end-controls {
  margin-left: auto;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 500;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-icon {
  font-size: 20px;
}

.control-label {
  font-size: 11px;
  white-space: nowrap;
}

.control-btn.exit-btn {
  background: rgba(231, 76, 60, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.control-btn.exit-btn:hover {
  background: rgba(231, 76, 60, 0.3);
}

.control-btn.hidden {
  display: none;
}

/* Compact Buttons */
.btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-compact {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:hover {
  transform: translateY(-1px);
}

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

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

.btn-primary:hover {
  background: #0970d4;
}

/* Picture in Picture */
#pipContainer {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 240px;
  height: 180px;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  background: var(--darker-bg);
  display: none;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(11, 140, 255, 0.3);
  overflow: hidden;
  cursor: grab;
}

#pipContainer:active {
  cursor: grabbing;
}

#cameraPip {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 280px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .bottom-control-bar {
    gap: 16px;
    padding: 12px 16px;
  }
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .main-area {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 200px;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .local-video-wrapper {
    aspect-ratio: auto;
    min-height: 200px;
  }

  .bottom-control-bar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .control-group.end-controls {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .room-controls {
    width: 100%;
    flex-direction: column;
  }

  .room-input {
    width: 100%;
  }

  #pipContainer {
    bottom: 110px;
    right: 10px;
    width: 180px;
    height: 135px;
  }
}

@media (max-width: 480px) {
  .meeting-title h1 {
    font-size: 16px;
  }

  .control-btn {
    padding: 6px 12px;
  }

  .control-icon {
    font-size: 16px;
  }

  .control-label {
    display: none;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: rgba(0, 0, 0, 0.3);
  color: white;
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.room-info {
  font-size: 14px;
  opacity: 0.9;
}

#roomStatus {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 15px;
  border-radius: 20px;
}

.main-content {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.video-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.local-video-wrapper {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  aspect-ratio: 16 / 9;
  border: 3px solid #667eea;
}

.local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1a1a;
}

.video-label {
  position: absolute;
  bottom: 15px;
  left: 15px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.remote-videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.remote-video-wrapper {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.remote-video-wrapper:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1a1a;
}

.controls-panel {
  width: 300px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 20px;
}

.control-section:last-child {
  border-bottom: none;
}

.control-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(-1px);
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-success {
  background: #48bb78;
  color: white;
}

.btn-success:hover {
  background: #38a169;
}

.btn-danger {
  background: #f56565;
  color: white;
}

.btn-danger:hover {
  background: #e53e3e;
}

.input-field {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.recordings-section {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.recordings-section a {
  display: block;
  padding: 10px;
  background: #f7fafc;
  color: #667eea;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.recordings-section a:hover {
  background: #e2e8f0;
}

#pipContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 280px;
  height: 210px;
  border: 3px solid #667eea;
  border-radius: 8px;
  background: #000;
  display: none;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

#cameraPip {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }
  
  .controls-panel {
    width: 100%;
    max-height: 250px;
  }
  
  .remote-videos {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .remote-videos {
    grid-template-columns: 1fr;
  }
  
  .controls-panel {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
  
  .control-section {
    flex: 1;
    min-width: 150px;
    padding-bottom: 15px;
  }
  
  header h1 {
    font-size: 24px;
  }
  
  .local-video-wrapper {
    aspect-ratio: auto;
    max-height: 300px;
  }
}

.chat-messages { 
  height: 150px; 
  overflow-y: auto; 
  background: #f5f5f5; 
  border: 1px solid #ddd; 
  border-radius: 4px; 
  padding: 10px; 
  margin-bottom: 10px; 
  font-size: 12px;
}

.chat-message {
  padding: 5px 0;
  border-bottom: 1px solid #eee;
  word-wrap: break-word;
}

.chat-message-user {
  font-weight: bold;
  color: #4caf50;
}

.chat-message-text {
  color: #333;
  margin-left: 5px;
}

.chat-input-wrapper {
  display: flex;
  gap: 5px;
}

.chat-input-wrapper input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.chat-input-wrapper button {
  flex: 0 0 70px;
}

.users-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.users-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  font-size: 12px;
}

.users-list li::before {
  content: "🟢 ";
}
