/* ==========================================================================
   IDE Collab — Phase 6 pair-programming UI
   --------------------------------------------------------------------------
   Covers: room dialog panel, invite toast, presence cursors/selections,
   and the merge-conflict banner. All colors use CSS variables only.
   ========================================================================== */

/* ==========================================================================
   Room dialog panel
   ========================================================================== */

.ide-collab-room-panel {
  position: fixed;
  z-index: 200;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ide-collab-room-panel__title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.ide-collab-room-panel__hint {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.ide-collab-room-panel__label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ide-collab-room-panel__select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  transition: border-color var(--transition);
  cursor: pointer;
}

.ide-collab-room-panel__select:focus {
  outline: none;
  border-color: var(--accent);
}

.ide-collab-room-panel__code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ide-collab-room-panel__code-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 3rem;
}

.ide-collab-room-panel__code-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
  background: var(--accent-subtle);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.ide-collab-room-panel__url-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.ide-collab-room-panel__url-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ide-collab-room-panel__url-input:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text-primary);
}

.ide-collab-room-panel__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.ide-collab-room-panel__qr a {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: underline;
}

/* Pair button in the IDE toolbar */
.ide-collab-pair-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 11px;
}

.ide-collab-pair-btn img {
  filter: var(--icon-filter);
}

/* ==========================================================================
   Invite toast
   ========================================================================== */

.ide-collab-invite-toast {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 150;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1rem;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: ide-toast-in 160ms ease;
}

@keyframes ide-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ide-collab-invite-toast__msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.ide-collab-invite-toast__icon {
  flex-shrink: 0;
  filter: var(--icon-filter);
  margin-top: 2px;
}

.ide-collab-invite-toast__text {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.45;
}

.ide-collab-invite-toast__actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.ide-collab-invite-toast__error {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Presence cursors and selections
   ========================================================================== */

/* Cursor widget — rendered as an inline widget by CM6 */
.ide-presence-cursor {
  position: relative;
  display: inline-block;
  pointer-events: none;
  user-select: none;
}

.ide-presence-cursor__caret {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--peer-color, var(--accent));
  vertical-align: text-bottom;
  margin-right: -1px; /* don't push text right */
  border-radius: 1px;
}

.ide-presence-cursor__label {
  position: absolute;
  bottom: 100%;
  left: 0;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.1rem 0.3rem;
  background: var(--peer-color, var(--accent));
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0.92;
  z-index: 10;
  /* Only show on hover of parent CM line to avoid clutter */
  display: none;
}

/* Show label when the cursor is hovered or nearby selection is active */
.cm-line:hover .ide-presence-cursor__label,
.ide-presence-cursor:hover .ide-presence-cursor__label {
  display: block;
}

/* Selection decoration — applied as a mark class by the presence plugin */
.ide-presence-selection {
  border-radius: 1px;
}

/* ==========================================================================
   Merge-conflict banner
   ========================================================================== */

.ide-collab-conflict-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-primary);
  z-index: 20;
  flex-shrink: 0;
  animation: ide-banner-in 140ms ease;
}

@keyframes ide-banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ide-collab-conflict-banner__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.ide-collab-conflict-banner__icon {
  flex-shrink: 0;
  filter: var(--icon-filter);
  opacity: 0.85;
}

.ide-collab-conflict-banner__msg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.ide-collab-conflict-banner__right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
