/* ======================================== */
/* SIDEBAR (CÂY THƯ MỤC) - BLUE THEME      */
/* ======================================== */

.file-explorer, .sidebar {
    grid-area: explorer;
    /* QUAN TRỌNG: Dùng màu #111827 giống hệt Topbar */
    background-color: #111827 !important; 
    border-right: 1px solid #1f2937; /* Viền xanh nhẹ */
    display: flex;
    flex-direction: column;
    min-height: 0;
    color: #e5e7eb; /* Màu chữ sáng */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
}

/* --- HEADER CỦA SIDEBAR --- */
.file-explorer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 5px 0 15px;
    height: 35px;
    
    /* Màu nền Header cũng là Xanh Than để liền mạch */
    background-color: #111827 !important; 
    border-bottom: 1px solid #1f2937;
    
    font-size: 11px; font-weight: bold; color: #9ca3af; /* Chữ xám xanh */
    flex-shrink: 0;
}

.file-explorer-header > span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1; margin-right: 5px; letter-spacing: 0.5px;
}

.explorer-actions { display: flex; gap: 2px; flex-shrink: 0; }

.explorer-actions .icon-btn {
    width: 20px; height: 20px; font-size: 14px;
    border-radius: 3px; color: #9ca3af;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border: none; background: transparent;
    transition: color 0.2s;
}
.explorer-actions .icon-btn:hover { color: #fff; background-color: rgba(255,255,255,0.1); }

/* --- DANH SÁCH FILE (TREE) --- */
.file-tree-list {
    list-style: none; padding: 0; margin: 0;
    overflow-y: auto; flex: 1;
   overflow-y: auto;  
    overflow-x: hidden; 
    background-color: #111827 !important; 
}

/* --- ITEM CHUNG (FILE & FOLDER) --- */
.tree-item {
    display: flex; align-items: center; width: 100%;
    padding: 4px 10px; 
    cursor: pointer; color: #e5e7eb;
    font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border: 1px solid transparent;
    transition: background 0.1s;
}

/* Hover vào file/folder */
.tree-item:hover {
    background-color: #1f2937; /* Màu hover sáng hơn nền một chút */
    color: #ffffff;
}

/* Khi item được chọn (Active) */
.tree-item.active, .tree-item.selected {
    background-color: #1f2937; /* Giữ nền tối nhưng có viền xanh */
    color: #ffffff;
    border-left: 2px solid #008c8c; /* Viền xanh ngọc */
}

/* Icon file/folder */
.file-icon {
    width: 16px; height: 16px; margin-right: 6px;
    vertical-align: middle; object-fit: contain; flex-shrink: 0;
}

/* --- FOLDER SPECIFIC --- */
.tree-item.folder { font-weight: 600; color: #e5e7eb; }

.tree-item.folder::before {
    content: '▸'; display: inline-block; width: 18px;
    text-align: center; font-size: 10px; color: #6b7280;
    transition: transform 0.1s; margin-right: 2px;
}

.tree-item-folder.open > .tree-item.folder::before { transform: rotate(90deg); }

/* Danh sách con (Nested) */
.nested {
    display: none; list-style: none; margin: 0;
    padding-left: 14px;
    border-left: 1px solid #1f2937; /* Đường kẻ dọc mờ */
}
.tree-item-folder.open > .nested { display: block; }

/* --- FILE SPECIFIC --- */
.tree-item.file { padding-left: 28px; color: #d1d5db; }

/* --- INPUT NHẬP TÊN (INLINE) --- */
.tree-item-input-wrapper { display: flex; align-items: center; padding: 2px 10px; }
.tree-item-input {
    background: #1f2937; color: #ffffff;
    border: 1px solid #008c8c;
    outline: none; padding: 2px 4px; font-size: 13px;
    font-family: inherit; width: 100%; margin-left: 5px;
    border-radius: 2px;
}

/* --- CONTEXT MENU (CHUỘT PHẢI) --- */
.context-menu {
    position: fixed; 
    background: #111827; /* Menu cũng màu xanh than */
    border: 1px solid #374151;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border-radius: 6px; padding: 4px 0;
    list-style: none; min-width: 160px; z-index: 99999;
}

.context-menu li {
    padding: 8px 15px; cursor: pointer; font-size: 13px; color: #e5e7eb;
    display: flex; align-items: center; gap: 8px;
}

.context-menu li:hover {
    background-color: #1f2937;
    color: #fff;
}

.context-menu .separator {
    height: 1px; background-color: #374151; margin: 4px 0; padding: 0;
}
.context-menu.hidden { display: none !important; }