/* ===== FILE LIST WITH DRAG AND DROP ===== */

/* File list container */
.file-list {
  margin-top: 24px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* File list header */
.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f3f4f6;
}

.file-list-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.btn-clear {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-clear:hover {
  background-color: #fef2f2;
}

/* File items list */
#fileItems {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual file item */
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: grab;
  position: relative;
}

.file-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-item:active {
  cursor: grabbing;
}

/* Drag states */
.file-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.file-item.drag-over {
  border-color: #6C63FF;
  background: #eef2ff;
}

/* Drop indicators */
.file-item.drag-over-top::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: #6C63FF;
  border-radius: 3px;
  animation: pulse 0.5s ease infinite;
}

.file-item.drag-over-bottom::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: #6C63FF;
  border-radius: 3px;
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Drag handle */
.file-drag-handle {
  cursor: grab;
  color: #9ca3af;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  user-select: none;
  flex-shrink: 0;
}

.file-drag-handle:hover {
  color: #6C63FF;
  background: #eef2ff;
}

.file-item:active .file-drag-handle {
  cursor: grabbing;
}

/* File icon */
.file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* File info */
.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-size {
  font-size: 12px;
  color: #9ca3af;
}

/* File actions */
.file-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.file-actions button {
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #6b7280;
  font-size: 16px;
  font-weight: 600;
}

.file-actions button:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #6C63FF;
  color: #6C63FF;
}

.file-actions button:active:not(:disabled) {
  transform: scale(0.95);
}

.file-actions button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-remove {
  border-color: #fecaca !important;
  color: #ef4444 !important;
}

.btn-remove:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #dc2626 !important;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .file-list {
    padding: 16px;
  }

  .file-item {
    padding: 10px;
    gap: 8px;
  }

  .file-drag-handle {
    display: none;
  }

  .file-name {
    font-size: 13px;
  }

  .file-size {
    font-size: 11px;
  }

  .file-actions button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* Hide move buttons on mobile, only show remove */
  .btn-move-up,
  .btn-move-down {
    display: none;
  }
}

@media (max-width: 480px) {
  .file-list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn-clear {
    align-self: flex-end;
  }
}

/* Touch devices - larger touch targets */
@media (hover: none) and (pointer: coarse) {
  .file-actions button {
    width: 44px;
    height: 44px;
  }
}

/* Accessibility */
.file-item:focus-within {
  outline: 2px solid #6C63FF;
  outline-offset: 2px;
}

.file-actions button:focus {
  outline: 2px solid #6C63FF;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .file-list,
  .file-item,
  .file-actions button {
    animation: none;
    transition: none;
  }

  .file-item.drag-over-top::before,
  .file-item.drag-over-bottom::after {
    animation: none;
  }
}