/**
 * 3devotion - Collaborative Canvas Split View Styles
 * GPU-accelerated split-screen layout, magic selection popover, and inline diff styles.
 */

:root {
  --split-handle-width: 8px;
  --split-handle-hover-color: #6366f1;
  --split-handle-active-color: #4f46e5;
  --split-right-width: 50%;
  --split-right-translate: 0px;
  
  --diff-orig-bg: rgba(239, 68, 68, 0.12);
  --diff-orig-border: rgba(239, 68, 68, 0.4);
  --diff-orig-text: #f87171;
  --diff-sugg-bg: rgba(16, 185, 129, 0.12);
  --diff-sugg-border: rgba(16, 185, 129, 0.4);
  --diff-sugg-text: var(--accent-mint);
}

/* 主分屏容器 */
.split-workspace-container {
  display: flex;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  background-color: var(--surface-bg, #0f172a);
  color: var(--text-primary, #f8fafc);
}

/* 左栏：对话流与大纲面板 */
.split-pane-left {
  flex: 1 1 0%;
  height: 100%;
  min-width: 320px;
  overflow-y: auto;
  position: relative;
  contain: layout style;
  transition: opacity 0.2s ease;
  padding: 1.5rem;
  box-sizing: border-box;
}

/* 分屏中轴拖拽手柄 */
.split-divider-handle {
  width: var(--split-handle-width);
  height: 100%;
  position: relative;
  cursor: col-resize;
  background-color: transparent;
  flex-shrink: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.split-divider-handle::before {
  content: '';
  width: 2px;
  height: 100%;
  background-color: var(--border-color, rgba(255, 255, 255, 0.1));
  transition: all 0.15s ease;
}

.split-divider-handle:hover::before,
.split-divider-handle.is-dragging::before {
  width: 4px;
  background-color: var(--split-handle-hover-color);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.split-divider-handle::after {
  content: '⋮';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.split-divider-handle:hover::after,
.split-divider-handle.is-dragging::after {
  opacity: 1;
  color: #ffffff;
}

/* 右栏：3D 课件与黑板画布 */
.split-pane-right {
  width: var(--split-right-width, 50%);
  min-width: 320px;
  height: 100%;
  transform: translateX(var(--split-right-translate, 0px));
  position: relative;
  contain: strict;
  background-color: var(--canvas-bg, #090d16);
  border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* 画布顶栏：时光机与状态工具 */
.canvas-header-bar {
  height: 52px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.canvas-time-machine-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #94a3b8;
}

.time-machine-slider {
  appearance: none;
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.time-machine-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
  cursor: grab;
}

/* 画布可编辑内容区 */
.canvas-editable-area {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 2.5rem;
  font-size: 1.0625rem;
  line-height: 1.75;
  position: relative;
  user-select: text;
}

/* 划词重构浮动工具条 (Selection Pin Popover) */
.magic-refactor-popover {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.2);
  padding: 0.5rem;
  gap: 0.375rem;
  min-width: 260px;
  max-width: 420px;
  animation: popover-fade-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translate(-50%, -100%);
  margin-top: -10px;
}

@keyframes popover-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -90%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}

.magic-refactor-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  padding: 0.375rem 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.magic-refactor-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
}

.magic-refactor-submit-btn {
  background: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.magic-refactor-submit-btn:hover {
  background: #4f46e5;
}

.magic-refactor-shortcuts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.shortcut-pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.shortcut-pill-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

/* 双态差异对比渲染节点 (Inline Diff Dual Nodes) */
.inline-diff-group {
  margin: 0.75rem 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.4);
}

.inline-diff-orig {
  background: var(--diff-orig-bg);
  border-left: 3px solid var(--diff-orig-border);
  color: var(--diff-orig-text);
  padding: 0.5rem 0.875rem;
  text-decoration: line-through;
  opacity: 0.8;
  font-size: 0.95rem;
}

.inline-diff-sugg {
  background: var(--diff-sugg-bg);
  border-left: 3px solid var(--diff-sugg-border);
  color: var(--diff-sugg-text);
  padding: 0.625rem 0.875rem;
  font-weight: 500;
  position: relative;
  font-size: 1rem;
}

.inline-diff-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.diff-action-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.diff-btn-accept {
  background: var(--accent-mint);
  color: #ffffff;
}
.diff-btn-accept:hover {
  background: #059669;
}

.diff-btn-reject {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}
.diff-btn-reject:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* 底部快捷工具盘 (Quick Action Bar) */
.canvas-bottom-action-bar {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 0.375rem 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 30;
}
