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

:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --danger-color: #dc2626;
  --success-color: #16a34a;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #e5e7eb;
  --border-color: #d1d5db;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}

.modal-content h1 {
  margin-bottom: 1.5rem;
  font-size: 1.875rem;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: var(--primary-color);
  color: white;
}

.btn-small:hover {
  background: var(--secondary-color);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
  width: 100%;
  margin-top: auto;
}

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

/* Conference View */
#conferenceView {
  display: flex;
  height: 100vh;
  gap: 1rem;
  padding: 1rem;
}

/* Video Container */
.video-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  background: #1a1a1a;
}

.video-card {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-card.local {
  border: 3px solid var(--primary-color);
}

.video-label {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
}

.video-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(37, 99, 235, 0.9);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s;
}

.control-btn:hover {
  background: rgba(37, 99, 235, 1);
  transform: scale(1.1);
}

.control-btn.disabled {
  background: rgba(220, 38, 38, 0.9);
}

.control-btn .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.control-btn.screen-btn {
  background: rgba(99, 102, 241, 0.9);
}

.control-btn.screen-btn:hover {
  background: rgba(99, 102, 241, 1);
}

.control-btn.screen-btn.active {
  background: rgba(34, 197, 94, 0.9);
}

.control-btn.screen-btn.active:hover {
  background: rgba(34, 197, 94, 1);
}

.screen-share-indicator {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.screen-status {
  background: rgba(0, 0, 0, 0.7);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.screen-status.active {
  background: rgba(34, 197, 94, 0.8);
  color: white;
}

.video-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: white;
}

.audio-status,
.video-status-badge {
  background: rgba(0, 0, 0, 0.7);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.info-panel,
.users-panel,
.chat-panel {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.info-panel h3,
.users-panel h3,
.chat-panel h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.info-item {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.info-item strong {
  font-weight: 600;
}

.users-list {
  list-style: none;
  max-height: 150px;
  overflow-y: auto;
}

.users-list li {
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.users-list li:before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--success-color);
  border-radius: 50%;
}

.kick-btn {
  margin-left: auto;
  background: var(--danger-color);
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.kick-btn:hover {
  background: #b91c1c;
}

/* Chat Panel */
.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding-bottom: 0;
  border-bottom: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.chat-message {
  font-size: 0.875rem;
  line-height: 1.4;
}

.chat-message-header {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.chat-message-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.chat-message-text {
  color: var(--text-primary);
  word-break: break-word;
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

.chat-input-group {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
}

.chat-input-group input {
  flex: 1;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
}

.chat-input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
  #conferenceView {
    flex-direction: column-reverse;
  }

  .sidebar {
    width: 100%;
    max-height: 300px;
  }

  .videos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .videos-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: 250px;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
