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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #64748b;
  --danger: #ef4444;
  --success: #22c55e;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 30px 0;
}

header h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 8px;
}

/* Screens */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.main-card {
  text-align: center;
  padding: 40px 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text);
}

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

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

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

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
  width: 100%;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
}

.icon {
  font-size: 1.3rem;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 16px;
}

/* Join form */
.join-form {
  display: flex;
  gap: 12px;
}

.join-form input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

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

/* Room header */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

.room-label {
  color: var(--text-muted);
}

.room-code {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* QR Section */
.qr-card {
  text-align: center;
}

.qr-card h3 {
  margin-bottom: 20px;
  color: var(--text-muted);
}

#qr-container {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 16px;
}

#qr-image {
  display: block;
  width: 220px;
  height: 220px;
}

.qr-url {
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* Devices */
.devices-card h3 {
  margin-bottom: 16px;
}

.devices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.no-devices {
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.device-icon {
  font-size: 1.5rem;
}

.device-info {
  flex: 1;
}

.device-name {
  font-weight: 600;
}

.device-type {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.device-status {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* Actions panel */
.actions-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.action-icon {
  font-size: 2rem;
}

.action-btn span:last-child {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--border);
}

.modal-content h3 {
  margin-bottom: 20px;
}

.modal-content textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  resize: vertical;
  margin-bottom: 20px;
}

.modal-content textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-fullscreen {
  max-width: 95vw;
  max-height: 95vh;
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

#remote-video {
  width: 100%;
  max-height: 80vh;
  background: #000;
  border-radius: 8px;
}

/* Progress */
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  width: 0%;
  transition: width 0.3s ease;
}

/* Notifications */
.notifications {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1001;
}

.notification {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 300px;
}

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

.notification.error {
  border-color: var(--danger);
}

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

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  header h1 {
    font-size: 2rem;
  }

  .actions-panel {
    grid-template-columns: 1fr;
  }

  .action-btn {
    flex-direction: row;
    padding: 16px;
  }

  .action-icon {
    font-size: 1.5rem;
  }

  .qr-card {
    display: none;
  }

  .room-header {
    flex-direction: column;
    gap: 12px;
  }
}

/* Hide QR on mobile */
@media (max-width: 768px) {
  #qr-section {
    display: none;
  }
}
