/* ── Real-Time Collaboration Styles ────────────────────────────────── */

/* Remote cursor: coloured vertical bar with name label */
.collab-remote-cursor {
  position: absolute;
  width: 2px;
  border-left: 2px solid #3b82f6;
  pointer-events: none;
  z-index: 50;
  transition: left 0.12s ease, top 0.12s ease;
}

.collab-cursor-label {
  position: absolute;
  bottom: 100%;
  left: -1px;
  padding: 1px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  white-space: nowrap;
  border-radius: 3px 3px 3px 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  opacity: 1;
}

/* Remote selection highlight */
.collab-remote-selection {
  position: absolute;
  pointer-events: none;
  z-index: 40;
  border-radius: 2px;
  transition: all 0.12s ease;
}

/* ── Presence bar (top bar) ──────────────────────────────────────── */

.collab-presence-bar {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: 0.5rem;
}

.collab-editing-indicator {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-dim, #888);
  padding: 2px 8px;
  background: var(--color-surface-raised, rgba(255, 255, 255, 0.06));
  border-radius: 12px;
  white-space: nowrap;
}

.collab-presence-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--color-bg, #1a1a2e);
  margin-left: -6px;
  cursor: default;
  user-select: none;
  transition: transform 0.15s ease;
}

.collab-presence-avatar:first-of-type {
  margin-left: 0;
}

.collab-presence-avatar:hover {
  transform: scale(1.15);
  z-index: 5;
}

.collab-presence-more {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-dim, #888);
  background: var(--color-surface-raised, rgba(255, 255, 255, 0.06));
  border: 2px solid var(--color-bg, #1a1a2e);
  margin-left: -6px;
}

/* ── Connection status indicator ─────────────────────────────────── */

.collab-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-dim, #888);
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 0.5rem;
}

.collab-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  transition: background 0.3s ease;
}

.collab-status.connected .collab-status-dot {
  background: #10b981;
}

.collab-status.connecting .collab-status-dot {
  background: #f59e0b;
  animation: collab-pulse 1s infinite;
}

@keyframes collab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Editor area needs relative positioning for cursor overlays ── */
.editor-panel {
  position: relative;
}

.editor-area {
  position: relative;
}

/* ── Toast animation for join/leave ──────────────────────────────── */

.toast-fade {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
