/**
 * Workspace Files Tree - Interactions
 * Drag-and-drop, inline editing, and selection styles
 */

/* ========== Drag-and-drop styles ========== */
.wft-item[draggable="true"] {
  cursor: pointer;
}

.wft-item[draggable="true"]:active {
  cursor: pointer;
}

.wft-item.wft-dragging {
  opacity: 0.5;
  background-color: var(--color-canvas-subtle, rgba(127, 127, 127, 0.2));
}

.wft-folder.wft-drop-target {
  background-color: var(--color-success-subtle, rgba(46, 160, 67, 0.2));
  border: 2px dashed var(--color-success-emphasis, #2ea043);
  outline: none;
}

/* Symlink indicator */
.wft-symlink {
  color: var(--color-fg-muted, rgba(127, 127, 127, 0.7));
  font-style: italic;
  margin-left: 4px;
}

/* ========== Inline create input (VS Code-like new file/folder input) ========== */
.wft-inline-create {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px !important;
  margin: 0;
  background: var(--workspace-bg-secondary);
}

.wft-inline-input-wrapper {
  padding: 2px 8px 2px 24px;
}

/* Symlink source indicator */
.wft-symlink-source {
  background: var(--color-accent-subtle, rgba(47, 129, 247, 0.15)) !important;
  outline: 1px dashed var(--color-accent-fg, #58a6ff);
  outline-offset: -1px;
}

.wft-inline-input {
  flex: 1;
  width: 100%;
  background: var(--workspace-bg-monaco);
  border: 1px solid var(--color-accent-fg, #58a6ff);
  border-radius: 3px;
  color: var(--color-fg-default, #f0f3f6);
  font-family: inherit;
  font-size: inherit;
  padding: 2px 6px;
  outline: none;
  min-width: 0;
}

.wft-inline-input:focus {
  border-color: var(--color-accent-emphasis, #1f6feb);
  box-shadow: 0 0 0 2px var(--color-accent-subtle, rgba(88, 166, 255, 0.3));
}

.wft-inline-input::placeholder {
  color: var(--color-fg-muted, #768390);
  opacity: 0.6;
}

/* Light mode overrides for inline input */
[data-theme="light"] .wft-inline-input,
.light .wft-inline-input {
  background: var(--workspace-bg-monaco);
  border-color: var(--color-accent-fg, #0969da);
  color: var(--color-fg-default, #1f2328);
}

[data-theme="light"] .wft-inline-create,
.light .wft-inline-create {
  background: var(--workspace-bg-secondary);
}

/* Icon colors for inline create rows */
.wft-inline-create-icon-file {
  color: var(--color-fg-muted);
}

.wft-inline-create-icon-folder {
  color: var(--workspace-icon-primary);
}

/* Inline rename input (same style as inline create) */
.wft-inline-rename {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px !important;
  margin: 0;
  background: var(--workspace-bg-secondary);
}

[data-theme="light"] .wft-inline-rename,
.light .wft-inline-rename {
  background: var(--workspace-bg-secondary);
}

/* ========== Multi-Selection Support ========== */

/* Multi-selected items */
.wft-item.multi-selected {
  background-color: var(--color-accent-subtle, rgba(47, 129, 247, 0.2));
  outline: 1px solid var(--color-accent-muted, rgba(47, 129, 247, 0.3));
  outline-offset: -1px;
}

.wft-item.multi-selected:hover {
  background-color: var(--color-accent-subtle, rgba(47, 129, 247, 0.3));
}

/* Selection rectangle (for drag selection) */
.wft-selection-rect {
  position: absolute;
  border: 1px dashed var(--color-accent-fg, #58a6ff);
  background-color: var(--color-accent-subtle, rgba(47, 129, 247, 0.1));
  pointer-events: none;
  z-index: 100;
}

/* ========== Cut/Copy Visual Feedback ========== */

/* Cut items - faded with dashed border (will be moved) */
.wft-item.wft-cut {
  opacity: 0.5;
  border: 1px dashed var(--color-attention-fg, #d29922);
  border-radius: 4px;
  background-color: rgba(210, 153, 34, 0.1);
}

.wft-item.wft-cut .wft-icon,
.wft-item.wft-cut .wft-name {
  opacity: 0.7;
}

/* Copied items - subtle highlight with solid border */
.wft-item.wft-copied {
  border: 1px solid var(--color-accent-fg, #58a6ff);
  border-radius: 4px;
  background-color: rgba(88, 166, 255, 0.1);
}

/* Animation for copy feedback */
@keyframes wft-copy-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(88, 166, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0);
  }
}

.wft-item.wft-copied {
  animation: wft-copy-pulse 0.5s ease-out;
}

/* Animation for cut feedback */
@keyframes wft-cut-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(210, 153, 34, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(210, 153, 34, 0);
  }
}

.wft-item.wft-cut {
  animation: wft-cut-pulse 0.5s ease-out;
}

/* Multi-selection count indicator (shown when multiple items selected) */
.wft-selection-count {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--color-canvas-overlay, #2d333b);
  color: var(--color-fg-default, #e6edf3);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  pointer-events: none;
}

.wft-selection-count strong {
  color: var(--color-accent-fg, #58a6ff);
}

/* Items that are cut (marked for move) */
.wft-item.wft-cut .wft-name {
  color: var(--color-fg-muted, #768390);
  font-style: italic;
}

/* ========== File change flash feedback (create/edit/delete) ========== */
@keyframes wft-flash-create {
  0% {
    background-color: rgba(34, 197, 94, 0.4);
  }
  100% {
    background-color: transparent;
  }
}
@keyframes wft-flash-edit {
  0% {
    background-color: rgba(234, 179, 8, 0.3);
  }
  100% {
    background-color: transparent;
  }
}
@keyframes wft-flash-delete {
  0% {
    background-color: rgba(239, 68, 68, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

.wft-flash-create {
  animation: wft-flash-create 1.5s ease-out;
}
.wft-flash-edit {
  animation: wft-flash-edit 1.5s ease-out;
}
.wft-flash-delete {
  animation: wft-flash-delete 1.5s ease-out;
}
