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

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --bg-dark: #0f0f1e;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1e1e35;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
  --border-color: #2d2d44;
  --success: #10b981;
  --error: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

body {
  background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Setup Screen */
#setup {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.setup-container {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 60px 40px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.logo h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 400;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group input {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s ease;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

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

/* Buttons */
.btn {
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.btn-icon {
  padding: 12px;
  min-width: 44px;
  background: var(--primary-color);
  color: white;
  border: none;
}

.btn-icon:hover {
  background: var(--primary-dark);
}

.input-group-inline {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.input-group-inline input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.3s ease;
  outline: none;
}

.input-group-inline input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Room Screen */
#room {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.room-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 40px;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.room-info h2 {
  font-size: 24px;
  font-weight: 600;
}

.room-badge {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s ease-in-out infinite;
}

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

.room-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  padding: 24px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Video Section */
.video-section {
  display: flex;
  flex-direction: column;
}

.video-controls {
  margin-bottom: 20px;
}

.player-wrapper {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9;
  min-height: 400px;
}

.player-wrapper iframe,
.player-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
}

.player-wrapper video {
  background: #000;
}

.player-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 40px;
  text-align: center;
}

.player-wrapper:has(iframe[src]) .player-placeholder {
  display: none;
}

.placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.placeholder-hint {
  font-size: 14px;
  margin-top: 8px;
  opacity: 0.7;
}

/* Users Section */
.users-section {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.users-header {
  background: var(--bg-card);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.users-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.user-count {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.users-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.users-list::-webkit-scrollbar {
  width: 6px;
}

.users-list::-webkit-scrollbar-track {
  background: transparent;
}

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

.user-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  border-left: 3px solid var(--primary-color);
}

.user-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user-item.current-user {
  background: rgba(99, 102, 241, 0.15);
  border-left-color: var(--primary-color);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.user-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.user-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.user-item.muted {
  opacity: 0.6;
}

.user-item.muted .user-indicator {
  background: var(--error);
}

.user-mute-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 16px;
  opacity: 0.7;
}

.user-mute-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.user-mute-btn.muted {
  color: var(--error);
}

.admin-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-video-controls {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn-control {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
  min-width: auto;
}

.btn-control:hover {
  border-color: var(--primary-color);
  background: var(--bg-card-hover);
}

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

.user-admin-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
}

/* Voice Chat Button */
.btn-voice {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.btn-voice:hover {
  border-color: var(--primary-color);
  background: var(--bg-card-hover);
}

.btn-voice.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: var(--primary-color);
  color: white;
}

.btn-voice.active #voiceIcon {
  animation: pulse 1.5s ease-in-out infinite;
}

#voiceStatus {
  font-size: 13px;
  font-weight: 500;
}

/* Invite Button */
.btn-invite {
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.btn-invite:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 32px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.invite-description {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 15px;
}

.invite-link-container {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.invite-link-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: monospace;
  outline: none;
  transition: all 0.3s ease;
}

.invite-link-input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

.btn-copy {
  padding: 14px 24px;
  background: var(--primary-color);
  border: none;
  color: white;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-copy:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.invite-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.btn-share {
  flex: 1;
  min-width: 120px;
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-share.whatsapp:hover {
  background: #25D366;
  border-color: #25D366;
  color: white;
}

.btn-share.email:hover {
  background: #EA4335;
  border-color: #EA4335;
  color: white;
}

.btn-share.telegram:hover {
  background: #0088cc;
  border-color: #0088cc;
  color: white;
}

.room-code-container {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.room-code-label {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 14px;
}

.room-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-code {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 24px;
  font-weight: 700;
  font-family: monospace;
  text-align: center;
  letter-spacing: 4px;
  color: var(--primary-color);
}

.btn-small {
  padding: 12px 16px;
  background: var(--primary-color);
  border: none;
  color: white;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.btn-small:hover {
  background: var(--primary-dark);
}

/* Notification animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Chat Section */
.chat-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-header {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.message-count {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.chat-box {
  background: var(--bg-card);
  border-radius: 0 0 16px 16px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 450px);
  min-height: 300px;
  max-height: 500px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

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

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

.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.message {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 3px solid var(--primary-color);
  animation: slideIn 0.3s ease;
  word-wrap: break-word;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message-user {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 4px;
  font-size: 14px;
}

.message-text {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}

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

.chat-input-wrapper input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

.chat-input-wrapper input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .room-main {
    grid-template-columns: 1fr;
  }

  .chat-section {
    max-height: 500px;
  }

  .chat-box {
    height: 500px;
  }
}

@media (max-width: 768px) {
  .setup-container {
    padding: 40px 24px;
  }

  .logo h1 {
    font-size: 28px;
  }

  .room-header {
    padding: 16px 20px;
  }

  .room-main {
    padding: 16px 20px;
    gap: 16px;
  }

  .input-group-inline {
    flex-direction: column;
  }

  .input-group-inline button {
    width: 100%;
  }

  .player-wrapper {
    min-height: 300px;
  }
}
