:root {
  --bg: #1e1e2e;
  --card: #2a2a3e;
  --text: #e0e0e0;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #c4b5fd;
}

input[type="text"], select {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #3f3f5f;
  color: var(--text);
  font-size: 1rem;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:disabled {
  background: #555;
  cursor: not-allowed;
}

.status {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #a0a0a0;
}

.code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

#codeDisplay {
  font-size: 2rem;
  letter-spacing: 4px;
  font-weight: bold;
  color: var(--success);
}

.hidden {
  display: none !important;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.request-item {
  background: #3f3f5f;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.request-item > span {
  overflow-wrap: anywhere;
  min-width: 0;
}

.request-item select {
  width: auto;
  margin: 0;
}

.request-actions {
  display: flex;
  gap: 8px;
}

.btn-success {
  background: var(--success);
}

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

.preview, .remote-container {
  width: 100%;
  background: #000;
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
}

video {
  width: 100%;
  display: block;
}

.remote-container {
  position: relative;
  aspect-ratio: 16 / 9;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.empty {
  color: #888;
  font-style: italic;
}

/* Chat de sesión */
.chat-messages {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: #23233a;
  border-radius: 8px;
  margin-bottom: 10px;
}

.chat-msg {
  display: flex;
}

.chat-msg.self {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 75%;
  background: #3f3f5f;
  border-radius: 10px;
  padding: 6px 10px;
}

.chat-msg.self .chat-bubble {
  background: var(--primary);
}

.chat-meta {
  display: block;
  font-size: 0.7rem;
  color: #b0b0c0;
  margin-bottom: 2px;
}

.chat-msg.self .chat-meta {
  color: #ddd6fe;
}

.chat-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  margin-bottom: 0;
}

/* Transferencia de archivos */
.file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.file-hint {
  font-size: 0.85rem;
  color: #a0a0a0;
}

.drop-zone {
  border: 2px dashed #555;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.15);
  color: var(--text);
}

.drop-zone.disabled {
  opacity: 0.5;
}

.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transfer-item {
  background: #3f3f5f;
  border-radius: 8px;
  padding: 10px 12px;
}

.transfer-info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.transfer-name {
  overflow-wrap: anywhere;
  min-width: 0;
}

.transfer-meta {
  font-size: 0.8rem;
  color: #b0b0c0;
  white-space: nowrap;
}

.transfer-bar {
  height: 6px;
  background: #23233a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.transfer-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s;
}

.transfer-bar-fill.failed {
  background: var(--danger);
}

.transfer-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.85rem;
}

/* Ventanas de video independientes */
body.video-window {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.video-toolbar {
  padding: 8px 12px;
  background: var(--card);
}

.video-toolbar .status {
  margin: 0;
}

body.video-window .remote-container {
  flex: 1;
  margin: 0;
  border-radius: 0;
  aspect-ratio: auto;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
}

.video-placeholder .placeholder-sub {
  color: #a0a0a0;
  font-size: 0.9rem;
  line-height: 1.4;
}

body.video-window .remote-container {
  position: relative;
}

/* Invitado web: ajustes de página única */
.web-note {
  text-align: center;
  color: #a0a0a0;
  margin-top: -12px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.remote-container .video-placeholder {
  position: absolute;
  inset: 0;
}

.remote-container {
  position: relative;
}
