<script setup>
import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';

// Props for the explorer
const props = defineProps({
  initialPath: {
    type: String,
    default: '/'
  },
  viewMode: {
    type: String,
    default: 'list', // list, grid, details
  }
});

// Emits for events
const emit = defineEmits(['itemSelected', 'viewModeChanged', 'pathChanged']);

// Component state
const currentPath = ref(props.initialPath);
const selectedItem = ref(null);
const viewMode = ref(props.viewMode);
const isLoading = ref(true);
const treeExpanded = ref({});

// Mock data - replace with actual API calls
const allItems = ref([]);
const router = useRouter();

// Computed properties
const currentItems = computed(() => {
  // Filter items based on current path
  return allItems.value.filter(item => item.parentPath === currentPath.value);
});

const breadcrumbs = computed(() => {
  // Split the path and create breadcrumb items
  if (currentPath.value === '/') return [{ name: 'Home', path: '/' }];
  
  const paths = currentPath.value.split('/').filter(Boolean);
  let breadcrumbPath = '';
  
  return [
    { name: 'Home', path: '/' },
    ...paths.map(segment => {
      breadcrumbPath += `/${segment}`;
      return {
        name: segment.charAt(0).toUpperCase() + segment.slice(1),
        path: breadcrumbPath
      };
    })
  ];
});

// Methods
const loadItems = async () => {
  isLoading.value = true;
  try {
    // Replace with actual API call
    // const { data } = await useFetch('/api/dms/items', { 
    //   params: { path: currentPath.value } 
    // });
    // allItems.value = data.value;
    
    // Mock data for development
    await new Promise(resolve => setTimeout(resolve, 500)); // Simulate API delay
    
    // Example item structure
    allItems.value = [
      { id: 'cabinet1', name: 'Cabinet 1', type: 'cabinet', parentPath: '/' },
      { id: 'cabinet2', name: 'Cabinet 2', type: 'cabinet', parentPath: '/' },
      { id: 'drawer1', name: 'Drawer 1', type: 'drawer', parentPath: '/cabinet1' },
      { id: 'drawer2', name: 'Drawer 2', type: 'drawer', parentPath: '/cabinet1' },
      { id: 'folder1', name: 'Folder 1', type: 'folder', parentPath: '/cabinet1/drawer1' },
      { id: 'folder2', name: 'Folder 2', type: 'folder', parentPath: '/cabinet1/drawer1' },
      { id: 'subfolder1', name: 'Subfolder 1', type: 'subfolder', parentPath: '/cabinet1/drawer1/folder1' },
      { id: 'file1', name: 'Document 1.pdf', type: 'file', parentPath: '/cabinet1/drawer1/folder1/subfolder1', extension: 'pdf', size: '1.2 MB', modified: '2023-10-15' },
      { id: 'file2', name: 'Spreadsheet.xlsx', type: 'file', parentPath: '/cabinet1/drawer1/folder1/subfolder1', extension: 'xlsx', size: '0.5 MB', modified: '2023-10-16' }
    ];
  } catch (error) {
    console.error('Failed to load items:', error);
    // Show error notification
  } finally {
    isLoading.value = false;
  }
};

const selectItem = (item) => {
  selectedItem.value = item;
  emit('itemSelected', item);
};

const navigateTo = (path) => {
  currentPath.value = path;
  selectedItem.value = null;
  emit('pathChanged', path);
  loadItems();
};

const navigateToItem = (item) => {
  if (item.type === 'file') {
    selectItem(item);
    return;
  }
  
  let newPath;
  if (item.type === 'cabinet') newPath = `/${item.id}`;
  else if (item.type === 'drawer') newPath = `/cabinet1/${item.id}`;
  else if (item.type === 'folder') newPath = `/cabinet1/drawer1/${item.id}`;
  else if (item.type === 'subfolder') newPath = `/cabinet1/drawer1/folder1/${item.id}`;
  else newPath = currentPath.value;
  
  navigateTo(newPath);
};

const toggleTreeItem = (path) => {
  treeExpanded.value[path] = !treeExpanded.value[path];
};

const changeViewMode = (mode) => {
  viewMode.value = mode;
  emit('viewModeChanged', mode);
};

// Format file size
const formatSize = (size) => {
  return size;
};

// Get icon for item type
const getItemIcon = (item) => {
  switch (item.type) {
    case 'cabinet': return 'cabinet';
    case 'drawer': return 'folder';
    case 'folder': return 'folder';
    case 'subfolder': return 'folder';
    case 'file':
      if (item.extension === 'pdf') return 'pdf';
      if (['doc', 'docx'].includes(item.extension)) return 'doc';
      if (['xls', 'xlsx'].includes(item.extension)) return 'sheet';
      return 'file';
    default: return 'folder';
  }
};

// Get SVG path based on icon type
const getSvgIcon = (iconType) => {
  switch (iconType) {
    case 'cabinet':
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/></svg>`;
    case 'folder':
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>`;
    case 'pdf':
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><path d="M9 15h6"></path><path d="M9 11h6"></path></svg>`;
    case 'doc':
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`;
    case 'sheet':
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><rect x="8" y="12" width="8" height="6"></rect><line x1="8" y1="16" x2="16" y2="16"></line><line x1="11" y1="12" x2="11" y2="18"></line></svg>`;
    default:
      return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`;
  }
};

// Render SVG from string
const renderSvgIcon = (iconType, size = 24) => {
  const svgString = getSvgIcon(iconType);
  return svgString.replace('width="24"', `width="${size}"`).replace('height="24"', `height="${size}"`);
};

// Lifecycle hooks
onMounted(() => {
  loadItems();
});
</script>

<template>
  <div class="dms-explorer bg-gray-50 dark:bg-gray-900 h-full flex flex-col">
    <!-- Toolbar -->
    <div class="dms-toolbar p-2 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between">
      <div class="flex items-center space-x-2">
        <button class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
        </button>
        <button class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>
        </button>
        <div class="dms-breadcrumbs flex items-center space-x-1">
          <template v-for="(crumb, index) in breadcrumbs" :key="index">
            <span v-if="index > 0" class="text-gray-400">/</span>
            <button 
              @click="navigateTo(crumb.path)" 
              class="text-primary hover:underline p-1 rounded" 
              :class="index === breadcrumbs.length - 1 ? 'font-medium' : ''"
            >
              {{ crumb.name }}
            </button>
          </template>
        </div>
      </div>
      
      <div class="flex items-center space-x-2">
        <button 
          @click="changeViewMode('list')" 
          class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700"
          :class="viewMode === 'list' ? 'bg-gray-200 dark:bg-gray-700' : ''"
        >
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>
        </button>
        <button 
          @click="changeViewMode('grid')" 
          class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700"
          :class="viewMode === 'grid' ? 'bg-gray-200 dark:bg-gray-700' : ''"
        >
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>
        </button>
        <button 
          @click="changeViewMode('details')" 
          class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700"
          :class="viewMode === 'details' ? 'bg-gray-200 dark:bg-gray-700' : ''"
        >
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="3" y2="18"></line></svg>
        </button>
      </div>
    </div>
    
    <!-- Main content area -->
    <div class="flex-1 flex overflow-hidden">
      <!-- Tree navigation -->
      <div class="dms-tree w-64 border-r border-gray-200 dark:border-gray-700 overflow-y-auto p-2">
        <div class="tree-item p-1">
          <div 
            @click="navigateTo('/')"
            class="flex items-center space-x-1 p-1 rounded cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700"
            :class="currentPath === '/' ? 'bg-primary/20 text-primary' : ''"
          >
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
            <span>Home</span>
          </div>
        </div>
        
        <!-- Tree items, recursive component would be better in production -->
        <div v-for="cabinet in allItems.filter(i => i.type === 'cabinet')" :key="cabinet.id" class="tree-item p-1">
          <div 
            @click="toggleTreeItem(cabinet.id)"
            class="flex items-center space-x-1 p-1 rounded cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700"
          >
            <svg v-if="treeExpanded[cabinet.id]" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>
            <svg v-else xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/></svg>
            <span>{{ cabinet.name }}</span>
          </div>
          
          <div v-if="treeExpanded[cabinet.id]" class="pl-5">
            <div 
              v-for="drawer in allItems.filter(i => i.parentPath === `/${cabinet.id}`)" 
              :key="drawer.id" 
              class="tree-item"
            >
              <div 
                @click="toggleTreeItem(drawer.id)"
                class="flex items-center space-x-1 p-1 rounded cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700"
              >
                <svg v-if="treeExpanded[drawer.id]" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>
                <svg v-else xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>
                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
                <span>{{ drawer.name }}</span>
              </div>
              
              <!-- Further nesting would be handled with recursive components in production -->
            </div>
          </div>
        </div>
      </div>
      
      <!-- Content area -->
      <div class="dms-content flex-1 overflow-y-auto">
        <!-- Loading indicator -->
        <div v-if="isLoading" class="flex justify-center items-center h-full">
          <Loading />
        </div>
        
        <!-- Empty state -->
        <div v-else-if="currentItems.length === 0" class="flex flex-col justify-center items-center h-full text-gray-500">
          <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
          <p class="mt-2">This folder is empty</p>
        </div>
        
        <!-- List view -->
        <div v-else-if="viewMode === 'list'" class="p-4">
          <div 
            v-for="item in currentItems" 
            :key="item.id" 
            @click="navigateToItem(item)"
            class="flex items-center p-2 border-b border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800"
            :class="selectedItem?.id === item.id ? 'bg-primary/10 dark:bg-primary/20' : ''"
          >
            <span class="mr-3" v-html="renderSvgIcon(getItemIcon(item), 24)"></span>
            <div class="flex-1">
              <div class="font-medium">{{ item.name }}</div>
              <div v-if="item.type === 'file'" class="text-xs text-gray-500">
                {{ item.extension.toUpperCase() }} · {{ item.size }} · Modified {{ item.modified }}
              </div>
            </div>
          </div>
        </div>
        
        <!-- Grid view -->
        <div v-else-if="viewMode === 'grid'" class="p-4 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4">
          <div 
            v-for="item in currentItems" 
            :key="item.id" 
            @click="navigateToItem(item)"
            class="flex flex-col items-center p-4 rounded-lg cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 text-center"
            :class="selectedItem?.id === item.id ? 'bg-primary/10 dark:bg-primary/20' : ''"
          >
            <span class="mb-2" v-html="renderSvgIcon(getItemIcon(item), 48)"></span>
            <div class="w-full truncate text-sm font-medium">{{ item.name }}</div>
            <div v-if="item.type === 'file'" class="text-xs text-gray-500">{{ item.size }}</div>
          </div>
        </div>
        
        <!-- Details view -->
        <div v-else-if="viewMode === 'details'" class="p-4">
          <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
            <thead class="bg-gray-50 dark:bg-gray-800">
              <tr>
                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Name</th>
                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Type</th>
                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Size</th>
                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Modified</th>
              </tr>
            </thead>
            <tbody class="bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-800">
              <tr 
                v-for="item in currentItems" 
                :key="item.id" 
                @click="navigateToItem(item)"
                class="cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800"
                :class="selectedItem?.id === item.id ? 'bg-primary/10 dark:bg-primary/20' : ''"
              >
                <td class="px-6 py-4 whitespace-nowrap">
                  <div class="flex items-center">
                    <span class="mr-3" v-html="renderSvgIcon(getItemIcon(item), 24)"></span>
                    <div class="font-medium">{{ item.name }}</div>
                  </div>
                </td>
                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400 capitalize">
                  {{ item.type }}
                </td>
                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
                  {{ item.type === 'file' ? item.size : '—' }}
                </td>
                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
                  {{ item.type === 'file' ? item.modified : '—' }}
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      
      <!-- Details panel - shown when a file is selected -->
      <div v-if="selectedItem && selectedItem.type === 'file'" class="dms-details w-72 border-l border-gray-200 dark:border-gray-700 overflow-y-auto p-4">
        <div class="flex flex-col items-center mb-6">
          <span class="mb-3" v-html="renderSvgIcon(getItemIcon(selectedItem), 64)"></span>
          <h3 class="text-lg font-medium text-center">{{ selectedItem.name }}</h3>
          <p class="text-gray-500 text-sm">{{ selectedItem.type }}</p>
        </div>
        
        <div class="border-t border-gray-200 dark:border-gray-700 pt-4">
          <div class="mb-4">
            <h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Properties</h4>
            <div class="text-sm">
              <div class="flex justify-between py-1">
                <span class="text-gray-500">Type</span>
                <span>{{ selectedItem.extension.toUpperCase() }} File</span>
              </div>
              <div class="flex justify-between py-1">
                <span class="text-gray-500">Size</span>
                <span>{{ selectedItem.size }}</span>
              </div>
              <div class="flex justify-between py-1">
                <span class="text-gray-500">Modified</span>
                <span>{{ selectedItem.modified }}</span>
              </div>
            </div>
          </div>
          
          <div class="mb-4">
            <h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Actions</h4>
            <div class="flex flex-col gap-2">
              <rs-button size="sm" block>
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>
                Preview
              </rs-button>
              <rs-button size="sm" block>
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
                Download
              </rs-button>
              <rs-button size="sm" block>
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><polyline points="6 9 6 2 18 2 18 9"></polyline><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"></path><rect x="6" y="14" width="12" height="8"></rect></svg>
                Print
              </rs-button>
            </div>
          </div>
          
          <div>
            <h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Access Control</h4>
            <p class="text-sm text-gray-500 mb-2">You have full access to this document</p>
            <rs-button size="sm" block color="secondary">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>
              Request More Access
            </rs-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.dms-explorer {
  height: calc(100vh - 64px);
}

/* Ensure scrollbars look nice across browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156, 163, 175, 0.7);
}
</style> 