/* Risos Canvas Collaboration Styles
 * Real-time collab toolbar, presence, comments, version history
 */

/* ── Collaboration Toolbar ── */
.rrt-collab-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-elevated, rgba(59, 130, 246,0.04));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
  font-size: 12px;
}

.rrt-collab-avatars {
  display: flex;
  align-items: center;
}
.rrt-collab-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary, #1f2030);
  margin-left: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}
.rrt-collab-avatar:first-child { margin-left: 0; }
.rrt-collab-avatar--more {
  background: rgba(255,255,255,0.1);
  color: var(--text-color, #e5e7eb);
}

.rrt-collab-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted, rgba(255,255,255,0.6));
}
.rrt-collab-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}
.rrt-collab-status-dot.disconnected { background: #ef4444; }
.rrt-collab-status-dot.connecting,
.rrt-collab-status-dot.syncing {
  background: #eab308;
  animation: rrt-pulse 1s infinite;
}
@keyframes rrt-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rrt-mode-toggle {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.rrt-mode-toggle button {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted, rgba(255,255,255,0.6));
}
.rrt-mode-toggle button.active {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.3));
  color: var(--text-color, #e5e7eb);
  font-weight: 500;
}

.rrt-collab-toolbar-spacer { flex: 1; }
.rrt-collab-toolbar button.rrt-icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted, rgba(255,255,255,0.7));
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.rrt-collab-toolbar button.rrt-icon-btn:hover {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.1));
  color: var(--text-color, #e5e7eb);
}

/* ── Collab Cursors ── */
.rrt-collab-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}
.rrt-collab-cursor-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px 3px 3px 0;
  white-space: nowrap;
  color: white;
  pointer-events: none;
  z-index: 6;
}

/* ── Comment Anchors ── */
.rrt-comment-anchor {
  background: rgba(255, 220, 0, 0.18);
  border-bottom: 2px solid rgba(255, 180, 0, 0.7);
  cursor: pointer;
  transition: background 0.12s ease;
}
.rrt-comment-anchor:hover { background: rgba(255, 220, 0, 0.32); }
.rrt-comment-anchor.resolved {
  background: transparent;
  border-bottom: 2px solid rgba(34, 197, 94, 0.4);
  border-bottom-style: dashed;
}

/* ── Suggestion Mode Inline ── */
ins.rrt-suggestion-add {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
  text-decoration: underline;
  text-decoration-color: #15803d;
}
del.rrt-suggestion-del {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  text-decoration: line-through;
}

/* ── Floating Add-Comment Button ── */
.rrt-add-comment-float {
  position: fixed;
  z-index: 9999;
  background: #1f2030;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.rrt-add-comment-float[hidden] { display: none !important; }
.rrt-add-comment-float button {
  background: transparent;
  border: none;
  color: #e5e7eb;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}
.rrt-add-comment-float button:hover {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.2));
}

/* ── Comment Panel (slide-in from right) ── */
.rrt-comment-panel {
  position: fixed;
  right: 0;
  top: 60px;
  bottom: 0;
  width: 360px;
  background: #1f2030;
  border-left: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  color: #e5e7eb;
}
.rrt-comment-panel.is-open {
  transform: translateX(0);
}

.rrt-comment-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}
.rrt-comment-panel__filters {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 2px;
  font-size: 11px;
}
.rrt-comment-panel__filters button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.rrt-comment-panel__filters button.active {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.3));
  color: #e5e7eb;
}

.rrt-cmt-close-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 16px;
}

.rrt-comment-panel__list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rrt-comment-thread {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px;
}
.rrt-comment-thread[data-status="resolved"] {
  opacity: 0.65;
}

.rrt-comment-anchor-preview {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-style: italic;
  border-left: 2px solid rgba(255, 220, 0, 0.5);
  padding: 4px 8px;
  margin-bottom: 8px;
  background: rgba(255, 220, 0, 0.04);
  border-radius: 0 4px 4px 0;
}

.rrt-comment-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}
.rrt-cmt-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 600;
}

.rrt-comment-content {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.rrt-comment-actions {
  display: flex;
  gap: 4px;
  font-size: 11px;
}
.rrt-comment-actions button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.rrt-comment-actions button:hover {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.15));
  color: #e5e7eb;
}

.rrt-comment-replies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rrt-comment-reply {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
  padding: 6px 8px;
}

.rrt-comment-reply-input {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rrt-comment-reply-input textarea {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 6px 8px;
  color: #e5e7eb;
  font-size: 12px;
  resize: vertical;
  min-height: 50px;
}
.rrt-comment-reply-input button {
  align-self: flex-end;
  background: var(--c-app-accent, #3B82F6);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

/* ── Version History Modal ── */
.rrt-version-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.85);
  display: grid;
  grid-template-rows: auto 1fr;
  color: #e5e7eb;
}
.rrt-version-modal[hidden] { display: none !important; }
.rrt-version-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #1f2030;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.rrt-version-modal__header h3 { margin: 0; font-size: 18px; }
.rrt-vm-close {
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 22px;
  cursor: pointer;
}

.rrt-version-modal__layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
}
.rrt-version-list {
  background: #1f2030;
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  padding: 12px;
}

.rrt-version-group { margin-bottom: 16px; }
.rrt-version-group-date {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.rrt-version-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.rrt-version-item:hover { background: var(--c-app-accent-soft, rgba(59, 130, 246,0.08)); }
.rrt-version-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 4px;
}
.rrt-version-time {
  color: rgba(255,255,255,0.6);
  font-family: monospace;
}
.rrt-version-author {
  font-weight: 500;
}
.rrt-version-badge {
  background: var(--c-app-accent, #3B82F6);
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}
.rrt-version-stats {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 4px;
}
.rrt-version-actions {
  display: flex;
  gap: 4px;
}
.rrt-version-actions button {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
}
.rrt-version-actions button:hover {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.15));
  color: white;
}

.rrt-version-preview {
  background: #0f172a;
  overflow-y: auto;
  padding: 24px;
}
.rrt-version-content {
  max-width: 800px;
  margin: 0 auto;
  background: #1f2030;
  padding: 32px;
  border-radius: 8px;
  font-family: 'Times New Roman', serif;
  line-height: 1.7;
}

/* ── Light Theme ── */
body.theme-light .rrt-collab-toolbar {
  background: var(--c-app-accent-soft, rgba(59, 130, 246,0.05));
  border-bottom-color: rgba(0,0,0,0.06);
}
body.theme-light .rrt-comment-panel {
  background: var(--surface-2, #fff);
  border-left-color: rgba(0,0,0,0.08);
  color: #1e293b;
}
body.theme-light .rrt-comment-thread {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
body.theme-light .rrt-version-modal__header,
body.theme-light .rrt-version-list,
body.theme-light .rrt-version-content {
  background: var(--surface-2, #fff);
  border-color: rgba(0,0,0,0.08);
  color: #1e293b;
}
body.theme-light .rrt-version-preview {
  background: rgba(0,0,0,0.03);
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .rrt-comment-panel {
    width: 100%;
    top: 0;
  }
  .rrt-version-modal__layout {
    grid-template-columns: 1fr;
    grid-template-rows: 50% 50%;
  }
  .rrt-version-list { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .rrt-collab-toolbar { font-size: 11px; gap: 6px; }
  .rrt-collab-toolbar button.rrt-icon-btn span { display: none; }
}
